Units not simplified in Matrices

Units not simplified in Matrices - Units are not simplified (i.e. to ohms etc) from the base SI units, when they are in matrices. - Messaggi

#1 Pubblicato: 25/08/2020 02:07:36
henry crun

henry crun

0 apprezzamenti in 34 post.

Gruppo: User

Units are not simplified (i.e. to ohms etc) from the base SI units, when they are in matrices.
This means that I can't really use a vector to return tuples from a function or display numbers with mixed units, as the units become unrecognisable.

btw, is there an easy way to copy the smath region, and paste it into this?

Smath_Units_Matrices_Bug1.png

#2 Pubblicato: 25/08/2020 04:36:38
Alvaro

Alvaro

1.139 apprezzamenti in 1.805 post.

Gruppo: User

Hi. This is my workaround: in the unit placeholder put diag([unit1, unit2, unit3]^T)

Clipboard01.jpg

Best regards.
Alvaro.
2 utenti hanno apprezzato questo post
sergio 25/08/2020 05:13:00, Martin_B 25/08/2020 09:21:00
#3 Pubblicato: 25/08/2020 08:00:33
henry crun

henry crun

0 apprezzamenti in 34 post.

Gruppo: User

That's a very twisted solution!
Here's the catch: I want to return a tuple of two values where I don't know what the units will be.

I thought num2str() might be able to help me just return printable strings, but it also returns the expanded base units.
num2str(2.3ohm)="{23*'kg*'m^2}/{10*'A^2*'s^3}"
#4 Pubblicato: 25/08/2020 08:13:01
Alvaro

Alvaro

1.139 apprezzamenti in 1.805 post.

Gruppo: User

Wrote

...
Here's the catch: I want to return a tuple of two values where I don't know what the units will be.
...



Hi. If you want the string with the value and the unit, try this: with this post ( https://en.smath.com/forum/yaf_postst17763_Dimensions-utility.aspx ) you can seek the dimensions of an unit, further, you can add a column in the 'Dimensions matrix with the unit as string for each one dimension and return it in some function UnitString, instead the dimension name.

Or can use this if don't want to work with strings:

Clipboard01.jpg

Best regards.
Alvaro.
  • Nuovi post
  • Nessun nuovo post