This program is by Tizedes Csaba and is used here by permission.
This program is supplied without representation or warranty of any kind. Tizedes Csaba and The Museum of HP Calculators therefore assume no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof.
This program can calculate the partial derivatives of a function for any variable.
Use for the function the 'F'-labeled program (see the Examples). The program use numerical-derivation of F:
dF/dxi=(F(x1,x2,...,xi+deltaxi,...,xn)-F(x1,x2,...,xi-deltaxi,...,xn)) / (2*deltaxi)
Memory usage:
A...Z: Not used i: Index n: Independent variable (xi) sumx: deltaxi sumy: Not used sumx^2: Original value of independent variable sumy^2: Not used sumx*y: Not used
Program usage:
Write the program for F-function (LBL F...RTN).
Load deltaxi into 29th variable (sumx): 29 STO i 5E-6 STO (i). (Try other
deltaxi.)
Load values of all used variables by F.
Set the variable what you want to derive the function: var.number STO i.
Run the program: XEQ D.
You get the derivative in stack_x.
For more information see the Examples.
The program can be used with SOLVE (and INTEGRATION, but it's not a very clever idea... ;) ). (See Examples.)
LBL D 28 x change i STO (i) STO i RCL (i) sumx sub STO (i) XEQ F 31 STO i roll down STO (i) n STO i RCL (i) sumx 2 mul add STO (i) XEQ F sumx^2 sub sumx 2 mul div sumx STO- (i) roll down RTN CK=04EA 49.5 byte LBL E INPUT O INPUT P INPUT Q INPUT R 29 STO i 5E-6 STO (i) 15 STO i XEQ D RCL mul Q SQ STO S 16 STO i XEQ D RCL mul R SQ RCL add S SQRT RTN LBL F RCL O RCL add P 1/x RCL mul P RCL mul O RTN
Where is the extremum of f(x)=x^2*ln(x)?
df/dx=x*(1+2*ln(x))=0 -> x1=0 (it's not root, see ln()!), and x2=1/sqrt(e)=0.60653
With the program: (See the list below)
29 STO i 5E-6 STO (i) 24 STO i the independent variable is 'x' FN=D 0.5 STO (i) 0.7 SOLVE (i)
You'll get the right answer!
You want to calculate the focal-distance of a thin single lens. You put an object to 120mm from the lens, and you get the picture 20mm from the lens on the other side. The precision of measured distances are +-1mm. What is the focal-distance and it's precision?
Used equation: 1/f=1/p+1/o ('f' is the 'focal', 'p'is the 'picture' and 'o' is the 'object'-distance.)
The used form: f=p*o/(o+p)
The error of 'f': deltaf=sqrt((deltao*df/do)^2+(deltap*df/dp)^2) where o=120, p=20, deltao=1 and deltap=1. Derivatives calculated with this values.
For calculating error, use the 'E' program, then you can calculate the 'f': ('E' sets the variables.)
XEQ E -> deltaf=0.73497mm XEQ F -> f=17.14286mm
So, the answer is: f=(17.1+-0.7)mm
Go back to the software library
Go
back to the main exhibit hall