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 mkraska  
#1 Posted : 30 June 2021 12:46:50(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
What is wrong with the innocent use of sum(1)? I expected to get the sum of all elements.

Also, the complaint of "a not defined" doesn't make sense, when the numeric value after dividing the result by the unit is pure numeric.

sum1.png
sum1.sm (9kb) downloaded 7 time(s).
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx

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

Offline Jean Giraud  
#2 Posted : 30 June 2021 14:51:40(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: mkraska Go to Quoted Post
What is wrong with the innocent use of sum(1)?


Sum.PNG

Offline Razonar  
#3 Posted : 30 June 2021 16:17:51(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Hi Martin. "a" is not assumed as complex, like in maple, thus don't populate across dot products. (I remember some comment from Andrey about that somewhere). You need to use vectorize.

Clipboard01.jpg

But ... (always there are one but)

Clipboard02.jpg

Finally, units are assumed as reals, even it could be remains undefined:

Clipboard03.jpg

sum1.sm (15kb) downloaded 4 time(s).

Best regards.
Alvaro.
thanks 1 user thanked Razonar for this useful post.
on 30/06/2021(UTC)
Offline Jean Giraud  
#4 Posted : 30 June 2021 20:48:44(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
BigBug.PNG

In the switch from MCD 2000 => MCD 11,
Tom had similar observation in dot product behavior.
Offline mkraska  
#5 Posted : 30 June 2021 22:53:15(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: Razonar Go to Quoted Post
Hi Martin. "a" is not assumed as complex, like in maple, thus don't populate across dot products. (I remember some comment from Andrey about that somewhere). You need to use vectorize.



At times I forget the survival rule "don't trust symbolic evaluation"... Too bad that it is the default.

If undefined variables were assumed to be non-scalar, then simplifying (a*b ) *c to a*b*c would be illegal.

I am aware of using units as an enabler of universal happiness. Yet,usually they are pre-occupied in an un-clearable way with some content, which makes it awkward to use them as symbolic variables. That's why I use 'a.0 instead of just 'a in the above example.

It is a pain to explain these things to students.

Worksheet3.png
Worksheet3.sm (10kb) downloaded 6 time(s).

Edited by user 30 June 2021 22:57:26(UTC)  | Reason: Not specified

Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 30/06/2021(UTC)
Offline Razonar  
#6 Posted : 01 July 2021 06:04:29(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: mkraska Go to Quoted Post

At times I forget the survival rule "don't trust symbolic evaluation"... Too bad that it is the default.


Good rule, annotated.

Originally Posted by: mkraska Go to Quoted Post

I am aware of using units as an enabler of universal happiness.


I agree that the existence theorem for that statement is true, but I sincerely hope that the uniqueness theorem is not.

Here a workaround:

Clipboard01.jpg

As explanation for your students try to show that in other languages you need to introduce another operator for vectorial (or matricial and tensorial) products: https://reference.wolfra...om/language/ref/Dot.html . In mathematica Dot operator is {a}.{b}, not {a}*{b}. Also in old maple versions, whith linalg, you need to call evalm (eval for matrices) for actually do matrix operations.

Best regards.
Alvaro.

Edited by user 01 July 2021 06:06:10(UTC)  | Reason: Not specified

thanks 1 user thanked Razonar for this useful post.
on 01/07/2021(UTC)
Offline mkraska  
#7 Posted : 01 July 2021 10:27:45(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: Razonar Go to Quoted Post

As explanation for your students try to show that in other languages you need to introduce another operator for vectorial (or matricial and tensorial) products: https://reference.wolfra...om/language/ref/Dot.html . In mathematica Dot operator is {a}.{b}, not {a}*{b}. Also in old maple versions, whith linalg, you need to call evalm (eval for matrices) for actually do matrix operations.

Best regards.
Alvaro.


Are you aware of any programming language which produces the same rubbish (the above (a*Cool*c example) without warning?

I present SMath Studio to the students as a means for performing and documenting engineering calculations. I try to avoid problems which I would not have without SMath Studio.

Yet, some problems can't be avoided, as they are related to physical understanding, just like the units of temperature and change of temperature or the difference between angular velocity and frequency.





Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Razonar  
#8 Posted : 01 July 2021 11:10:15(UTC)
Razonar


Rank: Advanced Member

Groups: Registered
Joined: 28/08/2014(UTC)
Posts: 1,356
Uruguay

Was thanked: 815 time(s) in 516 post(s)
Originally Posted by: mkraska Go to Quoted Post

Are you aware of any programming language which produces the same rubbish (the above (a*Cool*c example) without warning?


Nope.

Originally Posted by: mkraska Go to Quoted Post

I present SMath Studio to the students as a means for performing and documenting engineering calculations. I try to avoid problems which I would not have without SMath Studio.

Yet, some problems can't be avoided, as they are related to physical understanding, just like the units of temperature and change of temperature or the difference between angular velocity and frequency.



Me too. It's I was pointing out how matrix and vector products handle mathematics and maple just to indicate that it is probably not possible to implement them without introducing a different notation than the one used for the product between two scalars, real or complex. And point that out to the students. And I think I did not explain very well why I pointed out why I made those notes.

It is incredible how many errors can be seen in experienced engineers (let alone students) because they have done some simple calculations in excel or some other software, including matlab and mathematica (maple seems to be more reluctant to allow very silly errors) just for mixing unconverted units, getting mixed up with parentheses in simple but long expressions, making a mistake in some sign or many other causes. Well, I must confess that I include myself among those who do not trust the calculations I have done in Excel ... well, add matlab. Mathematica is complicated enough to prevent me from making silly mistakes, it just lets me make less noticeable mistakes.

And you are absolutely right to point out that it is really a shame that SMath has such errors.

I also use the rule: Don't trust linear algebra calculations in SMath (numeric or symbolic):

Clipboard01.jpg

It is sometimes difficult to justify using a program that miscalculates the rank of a matrix only filled with ones and zeros.

Best regards.
Alvaro.
Offline Jean Giraud  
#9 Posted : 01 July 2021 13:38:14(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: mkraska Go to Quoted Post
What is wrong with the innocent use of sum(1) ?
I expected to get the sum of all elements.

Sanity code Greville Pseudo-Centroid.

PseudoCentroid.PNG
Offline overlord  
#10 Posted : 01 July 2021 14:39:27(UTC)
overlord


Rank: Advanced Member

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

Was thanked: 507 time(s) in 338 post(s)
Putting variable into a matrix is also usable.

Regards

2021-07-01_14-37.png
Offline mkraska  
#11 Posted : 01 July 2021 16:15:55(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,986
Germany

Was thanked: 1124 time(s) in 721 post(s)
Originally Posted by: overlord Go to Quoted Post
Putting variable into a matrix is also usable.

Regards

2021-07-01_14-37.png


yes, this is another workaround just like using units or the vectorize function. Unfortunately, all not obvious for unexperienced users.



Martin Kraska

Pre-configured portable distribution of SMath Studio: https://smath.com/wiki/SMath_with_Plugins.ashx
Offline Jean Giraud  
#12 Posted : 01 July 2021 16:20:21(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
On the other hand of the discussion ...
the algebra of the project may not be commutative.
2D rotation, 3D rotation, Cholesky polyfit ...

Poly 0 Read First Edu.sm (38kb) downloaded 3 time(s).
Offline Jean Giraud  
#13 Posted : 01 July 2021 16:31:12(UTC)
Jean Giraud

Rank: Guest

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

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: Jean Giraud Go to Quoted Post
the algebra of the project may not be commutative.


NotCommutative.PNG
Users browsing this topic
Guest
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.