Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,647 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Hi all In this snippet there are several functions to work with units: - Extracting Unit of Measurement - Calculate Order of Magnitude - Rounding - Truncate - Floor - Ceiling best regards, w3b5urf3r known limitations: because 0 in SMath have no units, so UoM() return 1 every time the argument is set to 0* anyPossibleUnitsnippet updated: see reply #4Edited by user 26 July 2012 15:25:48(UTC)
| Reason: Not specified File Attachment(s): Davide Carpi attached the following image(s): |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
4 users thanked Davide Carpi for this useful post.
|
on 09/07/2012(UTC), on 09/07/2012(UTC), on 09/07/2012(UTC), on 09/07/2012(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 30/03/2011(UTC) Posts: 393
Was thanked: 132 time(s) in 113 post(s)
|
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,647 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Originally Posted by: kilele Hi, happy to be useful Actually I think the simplest way it's to insert units inside the "expression" argument of solve() (see the attachment) regards, w3b5urf3r Edited by user 10 July 2012 23:09:22(UTC)
| Reason: Not specified Davide Carpi attached the following image(s): |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,647 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Originally Posted by: kilele snippet updated! now there are uSolve.2(#) and uSolve.4(#) to reproduce solve(2) and solve(4) with units see the attachment for the usage regards, w3b5urf3r Edited by user 25 July 2012 00:34:20(UTC)
| Reason: Not specified File Attachment(s): Davide Carpi attached the following image(s): |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
2 users thanked Davide Carpi for this useful post.
|
on 25/07/2012(UTC), on 25/07/2012(UTC)
|
|
Rank: Advanced Member Groups: Registered
Joined: 30/03/2011(UTC) Posts: 393
Was thanked: 132 time(s) in 113 post(s)
|
Thank you sir for sharing your scripts, I didn't respond to your last post because I wanted to find the time to understand it well. Is this usolve function able to deal with equations involving multiple units as in the example I cited above ?
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,647 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Hi kilele This snippet is a "little workaround" so have some limitations: - uSolve.2(#) and uSolve.4(#) first argument must be a single-argument function - uSolve.2(#) need the third argument to know the unit of measurement of function argument however, taking care of these limitations, inside the function you can use multiple units and the input and output units may be different (see the attachment, introduced in the new unit_examples.sm re-attached in the post above) regards, w3b5urf3r Edited by user 25 July 2012 02:43:02(UTC)
| Reason: Not specified Davide Carpi attached the following image(s): |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 30/03/2011(UTC) Posts: 393
Was thanked: 132 time(s) in 113 post(s)
|
wow I am very much obliged to you ^^ this is really useful so the second parameter of usolve2 is also the desired output unit ? in my case the following samples always output meters: usolve2(f(x),5 m, m)=9.96 m usolve2(f(x),5 m, mm)=9.96 m usolve2(f(x),5 m, cm)=9.96 m Edited by user 25 July 2012 04:56:33(UTC)
| Reason: Not specified
|
|
|
|
Rank: Advanced Member Groups: Registered, Advanced Member Joined: 13/01/2012(UTC) Posts: 2,647 Location: Italy Was thanked: 1329 time(s) in 875 post(s)
|
Hi, Originally Posted by: kilele so the second parameter of usolve2 is also the desired output unit ? in my case the following samples always output meters: usolve2(f(x),5 m, m)=9.96 m usolve2(f(x),5 m, mm)=9.96 m usolve2(f(x),5 m, cm)=9.96 m The third parameter provide only the kind of unit (mass,length,force,pressure,etc..), the desired output unit must be set in the right side, after the evaluation (see the attachment) regards, w3b5urf3r Edited by user 18 September 2012 01:35:39(UTC)
| Reason: Not specified Davide Carpi attached the following image(s): |
If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects |
|
|
|
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.