1 Pages (8 items)
Units snippet - Messages
#1 Posted: 7/9/2012 4:50:04 AM
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*anyPossibleUnit
snippet updated: see reply #4
units_examples.sm (44 KiB) downloaded 118 time(s).

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*anyPossibleUnit
snippet updated: see reply #4
units_examples.sm (44 KiB) downloaded 118 time(s).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
4 users liked this post
Radovan Omorjan 7/9/2012 6:03:00 AM, sergio 7/9/2012 7:23:00 AM, Oscar Campo 7/9/2012 11:15:00 AM, Andrey Ivashov 7/9/2012 1:55:00 PM
#2 Posted: 7/10/2012 10:06:44 AM
Thank you very much for these useful functions!!
Could be possible a function to remove units from an equation in order to apply Solve ?
please look at
http://en.smath.info/forum/yaf_postst652_solving-equation.aspx
Could be possible a function to remove units from an equation in order to apply Solve ?
please look at
http://en.smath.info/forum/yaf_postst652_solving-equation.aspx
#3 Posted: 7/10/2012 12:07:46 PM
WroteThank you very much for these useful functions!!
Could be possible a function to remove units from an equation in order to apply Solve ?
please look at
http://en.smath.info/forum/yaf_postst652_solving-equation.aspx
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
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#4 Posted: 7/24/2012 5:32:19 PM
WroteThank you very much for these useful functions!!
Could be possible a function to remove units from an equation in order to apply Solve ?
please look at
http://en.smath.info/forum/yaf_postst652_solving-equation.aspx
snippet updated!
now there are [MATH]uSolve.2(#)[/MATH] and [MATH]uSolve.4(#)[/MATH] to reproduce [MATH]solve(2)[/MATH] and [MATH]solve(4)[/MATH] with units
see the attachment for the usage
regards,
w3b5urf3r
units_examples.sm (61 KiB) downloaded 87 time(s).
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2 users liked this post
#5 Posted: 7/24/2012 6:15:02 PM
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 ?
Is this usolve function able to deal with equations involving multiple units as in the example I cited above ?
#6 Posted: 7/24/2012 7:40:02 PM
Hi kilele
This snippet is a "little workaround" so have some limitations:
- [MATH]uSolve.2(#)[/MATH] and [MATH]uSolve.4(#)[/MATH] first argument must be a single-argument function
- [MATH]uSolve.2(#)[/MATH] 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


This snippet is a "little workaround" so have some limitations:
- [MATH]uSolve.2(#)[/MATH] and [MATH]uSolve.4(#)[/MATH] first argument must be a single-argument function
- [MATH]uSolve.2(#)[/MATH] 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
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#7 Posted: 7/24/2012 9:52:09 PM
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
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
#8 Posted: 7/25/2012 7:15:10 AM
Hi,
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

Wroteso 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
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 Pages (8 items)
-
New Posts
-
No New Posts