Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline Jopi  
#1 Posted : 14 September 2021 12:13:45(UTC)
Jopi


Rank: Member

Groups: Registered
Joined: 12/03/2019(UTC)
Posts: 19
Germany

Was thanked: 1 time(s) in 1 post(s)
Hallo,
Thanks to PTC's weird policy, I'm now trying to switch completely to Smath and have started rebuilding my main sheets.
Now I'm running into a problem here that I can't solve:
I build a matrix in half a second, but I can't display it. Even displaying a single element doesn't finish unless I shrink the matrix w.
The optimization of all equations is set to "numerical", the matrix elements should then be ready calculated, right? Does anyone know such a behavior?
The complete sm file and the data for it will come tomorrow.
Best regards,
Johannes

Extract Matrix element.png (1,023kb) downloaded 40 time(s).

Edited by user 14 September 2021 14:45:51(UTC)  | Reason: Not specified

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Jopi  
#2 Posted : 14 September 2021 14:43:02(UTC)
Jopi


Rank: Member

Groups: Registered
Joined: 12/03/2019(UTC)
Posts: 19
Germany

Was thanked: 1 time(s) in 1 post(s)
Putting eval() around the matrix definition solved this.

But what is then the setting "numerical" good for?
Offline Jean Giraud  
#3 Posted : 14 September 2021 15:46:12(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Jopi Go to Quoted Post
But what is then the setting "numerical" good for?

You are in the learning curve of Smath.
It toke me ~ 6 years to convert most of my MCD 11.
Wait to glance your promised document ... Jean

Offline oscampo  
#4 Posted : 14 September 2021 16:49:38(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 238
Man
Colombia
Location: Cali, Colombia

Was thanked: 79 time(s) in 60 post(s)
Originally Posted by: Jopi Go to Quoted Post
Hallo,
Thanks to PTC's weird policy, I'm now trying to switch completely to Smath and have started rebuilding my main sheets.
Now I'm running into a problem here that I can't solve:
I build a matrix in half a second, but I can't display it. Even displaying a single element doesn't finish unless I shrink the matrix w.
The optimization of all equations is set to "numerical", the matrix elements should then be ready calculated, right? Does anyone know such a behavior?
The complete sm file and the data for it will come tomorrow.
Best regards,
Johannes

Extract Matrix element.png (1,023kb) downloaded 40 time(s).


Please, can you share your .sm file?

Oscar
Offline Jopi  
#5 Posted : 15 September 2021 10:57:37(UTC)
Jopi


Rank: Member

Groups: Registered
Joined: 12/03/2019(UTC)
Posts: 19
Germany

Was thanked: 1 time(s) in 1 post(s)
Here is the file.
I have inserted a random source matrix, that needs a longer calculation time than my original.
But the effect is the same.


Extract matrix element.sm (11kb) downloaded 19 time(s).
Offline Jean Giraud  
#6 Posted : 15 September 2021 15:14:57(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Originally Posted by: Jopi Go to Quoted Post
Here is the file.
I have inserted a random source matrix, that needs a longer calculation time than my original.
But the effect is the same.

Sorry Collab, I don't quite understand your matrix wrt Smath code.

Random [rnd(n)] LAMDA.sm (6kb) downloaded 5 time(s).
Random Scatter 3D.sm (20kb) downloaded 5 time(s).
Random_5 Matrix [RGB].sm (103kb) downloaded 4 time(s).
Offline overlord  
#7 Posted : 15 September 2021 15:42:20(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,124
Turkey

Was thanked: 506 time(s) in 337 post(s)
Originally Posted by: Jopi Go to Quoted Post
Here is the file.
I have inserted a random source matrix, that needs a longer calculation time than my original.
But the effect is the same.

2021-09-15_15-32.png

This product evaluation may seem small on paper.
But actually it is a huge calculation.
And it gets bigger if t.max/i.max gets higher.
It takes 26s on my pc and my CPU is i7 6700k.
Not one of the fastest but not a slow one either.

Obviously you have to wait until that product is finished.
After that you can display elements of matrix w individually, and in an instant.
SMath is smart, it won't recalculate if you try to display an element of matrix after it is finished.
It will take microseconds to show the elements of matrix.
Unless you don't change something before "the long process calculation" of course.

Regards

2021-09-15_15-39.png
Offline Jean Giraud  
#8 Posted : 15 September 2021 16:10:12(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
The classical Iterated Product.

Lagrange.PNG
Offline Jopi  
#9 Posted : 15 September 2021 17:18:16(UTC)
Jopi


Rank: Member

Groups: Registered
Joined: 12/03/2019(UTC)
Posts: 19
Germany

Was thanked: 1 time(s) in 1 post(s)
Thank you for your answers.

My concern was NOT that the evaluation of
Matrix := complicated definition
took a long time, it was about the extraction of a single element,
Matrix[x,y]=
As i noted above, with a different definition:
Matrix := eval(complicated definition)
the following
Matrix[x,y]=
performed as expected in milliseconds.

I did not expect that a calculation, that is set to "numerical optimization", needs this additional eval() to calculate to the numerical end.

My original matrix is times bigger, but includes a lot of zeros. It now performs in a second.

Thank you , Johannes
Offline overlord  
#10 Posted : 15 September 2021 20:12:43(UTC)
overlord


Rank: Advanced Member

Groups: Registered
Joined: 23/07/2013(UTC)
Posts: 1,124
Turkey

Was thanked: 506 time(s) in 337 post(s)
Originally Posted by: Jopi Go to Quoted Post
I did not expect that a calculation, that is set to "numerical optimization", needs this additional eval() to calculate to the numerical end.

Because that is what eval() "may" does, usually.
Simplify expression, reduce calculation time.
I didn't get what you mentioned earlier, sorry.
I thought you were complaining about you couldn't
display elements, unless you shrink the matrix w.

Regards

2021-09-15_20-07.png
thanks 1 user thanked overlord for this useful post.
on 15/09/2021(UTC)
Offline oscampo  
#11 Posted : 15 September 2021 20:26:08(UTC)
oscampo


Rank: Advanced Member

Groups: Registered
Joined: 10/12/2009(UTC)
Posts: 238
Man
Colombia
Location: Cali, Colombia

Was thanked: 79 time(s) in 60 post(s)
Originally Posted by: Jopi Go to Quoted Post
Here is the file.
I have inserted a random source matrix, that needs a longer calculation time than my original.
But the effect is the same.


Extract matrix element.sm (11kb) downloaded 19 time(s).


If you define your matrix as a function, you have an alternative and faster "extraction of a matrix element":

FasterEvaluation.png

Offline Jean Giraud  
#12 Posted : 15 September 2021 21:02:30(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,868
Canada

Was thanked: 980 time(s) in 808 post(s)
Random.PNG
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.