home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
DP Tool Club 8
/
CDASC08.ISO
/
VRAC
/
UCALC18.ZIP
/
EXAMPLES.DOC
< prev
next >
Wrap
Text File
|
1993-09-14
|
7KB
|
220 lines
The Ultimate Calculator 1.8 (UNREGISTERED version) [F1] for help
Copyright (C) 1992, 1993 by Daniel Corbier. All rights reserved.
ucalc> ;*******************************************************************
ucalc> ; This text file is a sample session which demonstrates some of the
ucalc> ; features available in the Ultimate Calculator. The sections are
ucalc> ; entitled:
ucalc> ;
ucalc> ; 1. General Calculations
ucalc> ; 2. Physics for Thought
ucalc> ; 3. HBO for Thought
ucalc> ; 4. Are you converted yet?
ucalc> ; 5. Maybe I should use some FORCE
ucalc> ; 6. You must pay
ucalc> ; 7. Let's get a few FACTS straight
ucalc> ;*******************************************************************
ucalc>
ucalc> ; ***********************
ucalc> ; 1. General Calculations
ucalc> ; ***********************
ucalc>
ucalc> 17*(5+8)^2
Answer: 2873
ucalc> cos(pi)+8/pi + sinh(14)
Answer: 601303.688561062095
ucalc> test(x) = x^pi + sin(x) ; User defined function.
ucalc> test(14)
Answer: 3988.18506502600842
ucalc> sum(x*2+3^x,1..100) ; Summation
Answer: 7.73066281098016997E+47
ucalc>
ucalc> ; **********************
ucalc> ; 2. Physics for Thought
ucalc> ; **********************
ucalc>
ucalc> mass = 77.2 ; g
ucalc> Volume = 4.0 ; cm^3
ucalc>
ucalc> mass / Volume ; Density
Answer: 19.3
ucalc>
ucalc> mass = 13 ; Lets try a different mass
ucalc>
ucalc> mass / Volume ; Now lets see the new density
Answer: 3.25
ucalc> ; Quantum Mechanics
ucalc>
ucalc> h = 6.63E-34 ; J s
ucalc> m = 9.11E-31 ; kg
ucalc> L = 2E-11 ; m
ucalc>
ucalc> E(x) = (h^2/(8*m*L^2))*x^2 ; Allowed energies for a particle in a box.
ucalc>
ucalc> E(1)
Answer: 1.50785194840834248E-16
ucalc> ; Oops, you meant L=2E-10, no problem use the Up arrow.
ucalc> L = 2E-10
ucalc> E(1) ; You didn't have to retype the eq. ! Time saver, isn't it?
Answer: 1.50785194840834248E-18
ucalc> E(5)
Answer: 3.7696298710208562E-17
ucalc>
ucalc> ; ******************
ucalc> ; 3. HBO for Thought
ucalc> ; ******************
ucalc>
ucalc> mode hbo ; Results will be displayed in Hex, Binary, and Octal
ucalc>
ucalc> #h1E or #hAFF ; ORing two hexadecimal numbers
Decimal: 2815 Hex: AFF Binary: 101011111111 Octal: 5377
ucalc>
ucalc> $1E or $AFF ; Same as above (shortcut notation for hex)
Decimal: 2815 Hex: AFF Binary: 101011111111 Octal: 5377
ucalc>
ucalc> #b1010101 or #b111000 + 44/2
Decimal: 95 Hex: 5F Binary: 1011111 Octal: 137
ucalc>
ucalc> mode hbo ; Toggle HBO mode back off
ucalc>
ucalc> ; *************************
ucalc> ; 4. Are you converted yet?
ucalc> ; *************************
ucalc>
ucalc> feet_inches(x) = x * 12 ; You can put these and more in
ucalc> meters_feet(x) = 3.281 * x ; UCELC.DEF if you use them often.
ucalc> celsius_fa(x) = 9/5 * x + 32 ; Celsius to Fahrenheit.
ucalc>
ucalc> celsius_fa(50)
Answer: 122
ucalc> feet_inches(3)
Answer: 36
ucalc>
ucalc> ; ********************************
ucalc> ; 5. Maybe I should use some FORCE
ucalc> ; ********************************
ucalc>
ucalc> ; Force = integral( pgh dA )
ucalc>
ucalc> integ(6.24*(3-x)*2*sqr(9-x^2),-3..3)
Answer: 529.07649351285467
ucalc> integ(3*x^2*(x+7),4..7,500) ; 500 subdivisions for higher precision
Answer: 3561.75
ucalc>
ucalc> ; ***************
ucalc> ; 6. You must pay
ucalc> ; ***************
ucalc>
ucalc> ; You can do all your financial calculations with Ucalc.
ucalc>
ucalc> ; Lets take a loan to buy a nice house
ucalc>
ucalc> payment(PV,i,n) = PV*i/(1-(1+i)^(-n)) ; Formula for monthly payments
ucalc>
ucalc> PV = 175000 ; Loan balance
ucalc> i = .01 ; Interest rate (1% monthly)
ucalc> n = 240 ; Number of payments (20 years)
ucalc>
ucalc> payment(PV,i,n)
Answer: 1926.90073374681746
ucalc> n = 360 ; Maybe we can negotiate better terms
ucalc>
ucalc> payment(PV,i,n)
Answer: 1800.07204461963275
ucalc> payment(215000,i,n) ; Can we afford a bigger loan?
Answer: 2211.51708338983452
ucalc>
ucalc> ; You want to become a millionaire by investing $50,000 and
ucalc> ; earning 14% interest each year. How many years will it take?
ucalc>
ucalc> Term(FV,PV,i) = ln(FV/PV) / ln(1+i)
ucalc>
ucalc> FV = 1000000 ; Future investment value
ucalc> PV = 50000 ; Present investment value
ucalc> i = .14 ; Annual interest
ucalc>
ucalc> Term(FV,PV,i)
Answer: 22.8632526947680305
ucalc> ; It will take around 23 years
ucalc>
ucalc> ; *********************************
ucalc> ; 7. Let's get a few FACTS straight
ucalc> ; *********************************
ucalc>
ucalc> 3 + fact(1500)*2
Answer: 9.62399559355954973E+4114
ucalc> ; Wow, not even the US budget deficit is that big of a number.
ucalc> ; Can your pocket calculator get a factorial that high?
ucalc>
ucalc> solve( exp(x)+3*x = 15 )
Answer: 2.14698767937181217
ucalc> ; 'last' stores the answer to the previous operation.
ucalc> exp(last)+3*last ; You can use that concept for accuracy checks.
Answer: 15
ucalc> solve( sin(x) = 1, 0..pi )
Answer: 1.57079632679489662
ucalc> sumtable(x^2+2*x,0..10)
Count Value Cumulative
0 0 0
1 3 3
2 8 11
3 15 26
4 24 50
5 35 85
6 48 133
7 63 196
8 80 276
9 99 375
10 120 495
Answer: 495
ucalc>
ucalc> ; Compound functions can be defined by using relational operators.
ucalc>
ucalc> ; / x^2+3, x > 0
ucalc> ; tst(x) = | 2, x = 0
ucalc> ; \ x^2-3, x < 0
ucalc>
ucalc> tst(x) = (x^2+3)*(x>0) + (2)*(x=0) + (x^2-3)*(x<0)
ucalc> tst(15)
Answer: 228
ucalc> tst(-8)
Answer: 61
ucalc> 3*tst(0)^2+pi
Answer: 15.1415926535897932
ucalc>
ucalc> ; These are just some of the things you can do with Ucalc.
ucalc>
ucalc> ; Please remember to pay the registration fee. This will allow me
ucalc> ; spend the necessary amount of time in order to add some of the
ucalc> ; features that you would like to see in the next version.
ucalc>