Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 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.sm (9kb) downloaded 7 time(s). |
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: mkraska What is wrong with the innocent use of sum(1)?
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 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. But ... (always there are one but) Finally, units are assumed as reals, even it could be remains undefined: sum1.sm (15kb) downloaded 4 time(s).Best regards. Alvaro.
|
1 user thanked Razonar for this useful post.
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
In the switch from MCD 2000 => MCD 11, Tom had similar observation in dot product behavior.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: Razonar 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.sm (10kb) downloaded 6 time(s).Edited by user 30 June 2021 22:57:26(UTC)
| Reason: Not specified |
|
1 user thanked mkraska for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: mkraska 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 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: 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
|
1 user thanked Razonar for this useful post.
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: Razonar 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* *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. |
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 28/08/2014(UTC) Posts: 1,356 Was thanked: 815 time(s) in 516 post(s)
|
Originally Posted by: mkraska Are you aware of any programming language which produces the same rubbish (the above (a* *c example) without warning? Nope. Originally Posted by: mkraska 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): 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.
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: mkraska What is wrong with the innocent use of sum(1) ? I expected to get the sum of all elements. Sanity code Greville Pseudo-Centroid.
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 23/07/2013(UTC) Posts: 1,126 Was thanked: 507 time(s) in 338 post(s)
|
Putting variable into a matrix is also usable. Regards
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
Originally Posted by: overlord Putting variable into a matrix is also usable. Regards yes, this is another workaround just like using units or the vectorize function. Unfortunately, all not obvious for unexperienced users. |
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 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).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: Jean Giraud the algebra of the project may not be commutative.
|
|
|
|
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.