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+Δxi,...,xn)-F(x1,x2,...,xi-Δxi,...,xn)] / (2*Δxi)
Memory usage:
A...Z | Not used |
i | Index |
n | Independent variable (xi) |
Σx | Δxi |
Σy | Not used |
Σx2 | Original value of independent variable |
Σy2 | Not used |
Σxy | Not used |
Program usage:
Write the program for F-function (LBL F...RTN).
Load Δxi into 29th variable (Σx): 29 STO i 5E-6 STO (i). (Try other Δxi.)
Load values of all variables used 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 register 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⇔ I STO (i) STO i RCL (i) Σx − STO (i) XEQ F 31 STO i R↓ STO (i) n STO i RCL (i) Σx 2 × + STO (i) XEQ F Σx2 − Σx 2 × ÷ Σx STO- (i) R↓ 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 × Q x2 STO S 16 STO i XEQ D RCL × R x2 RCL + S √x RTN LBL F RCL O RCL + P 1/x RCL × P RCL × O RTN
Where is the extremum of f(x)=x2*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 its precision?
Used equation: 1/f=1/p+1/o
where 'f' is the 'focal-distance', 'p'is the 'picture-distance' and 'o' is the 'object'-distance.
The used form: f=p*o/(o+p)
The error of 'f': Δf=sqrt[(Δo*df/do)2+(Δp*df/dp)2] where o=120, p=20, Δo=1 and Δp=1. Derivatives calculated with these values.
For calculating error, use the 'E' program, then you can calculate the 'f': ('E' sets the variables.)
XEQ E → Δf=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