HP35s and numerical differentiation
|
10-05-2014, 10:58 AM
Post: #1
|
|||
|
|||
HP35s and numerical differentiation
What would be the simplest way of estimating a slope of tangent to function/expression (say, already stored in equation library) for a specified variable at a specified point?
I imagine I could write a programme that would use, say, two-point secant formula (or some higher precision formulas), but how would I parse a function from an equation library to it? Is there a simpler way? |
|||
10-05-2014, 11:47 AM
Post: #2
|
|||
|
|||
RE: HP35s and numerical differentiation
(10-05-2014 10:58 AM)mcjtom Wrote: What would be the simplest way of estimating a slope of tangent to function/expression (say, already stored in equation library) for a specified variable at a specified point? There are several ways of evaluating the derivative of a function, a quite elegant one is shown below. Quote:I imagine I could write a programme that would use, say, two-point secant formula (or some higher precision formulas), but how would I parse a function from an equation library to it? Is there a simpler way? There is no way to access the equation list from within a user program. Sorry. However, if the original function is defined in user code, another program may determine the derivative. A quite elegant way uses the 35s' complex mode. This has been discussed earlier in the old forum. A discussion with a working example in a 35s program can be found in this thread. Label F defines the function, label D calculates the derivative. When entering the function F, be sure to use only commands the 35s can handle in complex mode, e.g. use x^ 0.5 instead of sqrt(x). Dieter |
|||
10-05-2014, 04:43 PM
Post: #3
|
|||
|
|||
RE: HP35s and numerical differentiation
In addition to the user programs suggested, here is one that calculates the numerical derivate, using the Five Stencil Method.
Use the label U, the function is called at step 41. Start with point to be calculated on the X stack. Code:
f'(X) = D = 1/(12H) * ( f(x-2H) - 8*f(x-H) + 8*f(x+H) - f(x+2H)) + H^4/30*f^(5)(o) (error term omitted in calculation) Source: Burden, Richard L. and J. Douglas Faires. "Numerical Analysis 8th Edition" Thomson Brooks/Cole. Belton, CA 2005 |
|||
10-05-2014, 09:39 PM
Post: #4
|
|||
|
|||
RE: HP35s and numerical differentiation
(10-05-2014 04:43 PM)Eddie W. Shore Wrote: \[\frac{f(x-2h)-8f(x-h)+8f(x+h)-f(x+2h)}{12h}\] This expression can be transformed into: \[\frac{4\frac{f(x+h)-f(x-h)}{2\cdot h}-\frac{f(x+2h)-f(x-2h)}{2\cdot 2h}}{4-1}\] Now we can see that this is the 1st step of the Richardson extrapolation for \(\frac{f(x+h)-f(x-h)}{2\cdot h}\): This can be extended similar to Romberg's method. Cheers Thomas |
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 2 Guest(s)