home *** CD-ROM | disk | FTP | other *** search
- 7.2 Calculation
-
- SymbMath gives the exact value of calculation when the switch
- numerical=off (default), or the approximate value of calculation when
- the switch numerical=on or by the function num().
- SymbMath can manipulate units as well as numbers, be used as
- a symbolic calculator, and do exact computation. The range of real
- numbers is from -infinity to infinity, e.g. ln(-inf), exp(inf+pi*i),
- etc. SymbMath contains many built-in algorithms for performing
- numerical calculations when the switch numerical=on, e.g. ln(-9), i^i,
- (-2.3)^(-3.2), 2^3^4^5^6^7^8^9, etc.
- Warming that SymbMath only gives a principle value if there
- are multi-values, except for the function solve().
-
- Example 7.2.1. Find the values of sin(x) when x=pi/2
- and x=90 degree.
- Input:
- num(sin(pi/2))
- num(sin(90*degree))
- end
- Output:
- 1
- 1
- end
-
- Example 7.2.2. Set the units converter from the minute to
- the second, then calculate numbers with different units.
- Input:
- minute=60*second
- v=2*meter/second
- t=2*minute
- d0=10*meter
- v*t+d0
- end
- Output:
- 250 meter
-
- Example 7.2.3
- Input:
- 1/2+1/3
- end
- Output:
- 5/6
-
- Example 7.2.4. Assign sqrt(x) to z, then evaluate z
- when x=3 and y=4.
- Input:
- z=sqrt(x)
- subs(z, x=3) # evaluate z by substituting x=3
- x=4 # assign 4 to x
- z # evaluate z
- end
- Output:
- z = sqrt(x)
- sqrt(3)
- x=4
- 2
-
- Note that after assignment by x=4, x should be cleared from
- memory by clear(x) before differentiation of the new function.
- Otherwise the values of x still is 4 until new values assigned. If
- evaluating z by the function subs(z, x=3), the variable x is
- automatically cleared after evaluation, i.e. the variable x in subs()
- is local variable. This rule applies to other functions.
-