Post Reply 
(48G 49G 50G) Runge-Kutta Diff Eqn solver
06-19-2021, 02:24 AM
Post: #18
RE: (48G 49G 50G) Runge-Kutta Diff Eqn solver
(06-15-2021 09:09 PM)rcthacker Wrote:  HP Solve doesn't solve DEs numerically.

I know, but that's beside the point. HP Solve is just one example of the general RPL feature we are talking about here, namely that for numeric evaluation any symbolic object may be replaced with a program object, provided the latter conforms to the input/output syntax of an algebraic expression. The same holds true for the plotter, for example, where any program equivalent to an expression (that is, which takes no arguments from the stack, and returns exactly one number) can be used instead of an expression.

(06-15-2021 09:09 PM)rcthacker Wrote:  Werner's guess that a << program object>> could be substituted for an 'algebraic object/expression', which is undocumented.

Presenting this general feature as a lucky “guess” on Werner's part verges on the absurd, when it has been clearly and officially documented since the times of the HP-28C. Indeed, in the HP-28C Reference Manual, which is available here, we may read the following:

Algebraic objects and programs have identical internal structures. Both types of procedures are sequences of objects that are processed sequentially when the procedures are evaluated. The algebraic 'X+Y' and the program « X Y + » are both stored as the same sequence (the RPN form). Algebraics are “marked” as algebraics so that they will be displayed as mathematical expressions and to indicate that they satisfy algebraic syntax rules. (p. 60)
If we take the above expression and rewrite it again by removing the parentheses, and placing the functions after their arguments, we obtain the RPN form of the expression. [...] This defines a program that has algebraic syntax, and is effectively equivalent to the corresponding algebraic object. (p. 62)

(06-15-2021 09:09 PM)rcthacker Wrote:  I really do not think the firmware writers gave this much thought.

And I really do not think that you do yourself a favor by calling people like Bill Wickes and Charlie Patton toughtless or sloppy.

In any event, here is some more background information on the subject by the firmware writers themselves (see “An Advanced Scientific Graphing Calculator” by Diana K. Byrne, Charles M. Patton, David Arnett, Ted W. Beers, and Paul J. McClellan, in: Hewlett-Packard Journal, Vol. 45 no. 4, August 1994, p. 21):

The HP 48G/GX contains two differential equation solvers and solution plotters. These solvers and solution plotters can be accessed via their input forms or invoked programmatically via commands. We provide a programmatic interface to the differential equation solvers and their subtasks so the user can use them with the calculator’s general solver feature to determine when a computed differential equation solution satisfies some condition, or to implement custom differential equation solvers from their subtasks.

In implementing the differential equation solution plots, one challenge was to identify and implement good solution methods. Another challenge was to merge this new plot type with the new 3D plot types described earlier and with the existing HP 48SX plot environment in a backward-compatible manner.

The HP 48G/GX specifically solves the initial value problem, consisting of finding the solution y(t) to the first-order equation y’(t) = f(t,y) with the initial condition y(t0) = y0. Here y'(t) denotes the first derivative of a scalar-valued or vector-valued solution y with respect to a scalar-valued parameter t. Higher-order differential equations can be expressed as a first-order system, so this problem is more general than it might at first appear.

Many solution methods have been developed over the years to solve the initial value problem. We decided to implement two methods, a Runge-Kutta-Fehlberg method for simplicity and speed of execution and a Rosenbrock method for reliability. The first method is easier to use, requiring less information from the user, but can fail on stiff problems.
[*] The Rosenbrock method requires more information from the user, but can solve a wider selection of initial value problems. Both initial value problem solution methods require the user to provide the function f(t,y), the initial conditions, the final value of t, and an absolute error tolerance. The Rosenbrock method also requires the derivative of f(t,y) with respect to y (FYY) and the derivative of f(t,y) with respect to t (FYT).

All plot types use the contents of the variable
EQ, typically to specify the function to be plotted. If the user selects the stiff (Rosenbrock) method the extra functions are passed to the solver by binding EQ to a list of functions f(t,y), FYY, and FYT. Otherwise, EQ is bound to the function f(t,y) needed by the Runge-Kutta-Fehlberg method.

Both methods solve the initial value problem by computing a series of solution steps from the initial conditions towards the final value, by default taking steps as large as possible subject to maintaining the specified error tolerance. The solution plotter plots the computed values and by default draws straight lines between the plotted points. However, although the computed steps may be accurate, the line segments drawn between the step endpoints may poorly represent the solution between those points. The plot parameter
RES is used by many plot types to control the plot resolution. If RES is zero the initial value problem solution plotter imposes no additional limits on the step sizes. If RES is nonzero the plotter limits each step to have maximum size RES.

For the scalar-valued initial value problem it is typical to plot the computed solution y(t) on the vertical axis and the parameter t on the horizontal axis. However, in the vector-valued case the choice of what is to be plotted is not as clear. The user may wish a particular component of the computed solution plotted versus t or may wish two components plotted versus each other. The HP 48G/GX allows the user to specify the computed scalar solution, any component of the computed vector solution, or the parameter t to be plotted on either axis. This flexibility was introduced into the plot environment by expanding the
AXES plot parameter. Previously, this parameter specified the coordinates of the axes origin. This parameter was expanded so that an optional form is a list specifying the origin and the horizontal and vertical plot components.

By judiciously expanding the meaning of the various plot parameters we were able to accommodate the differential equation solution plot type while maintaining backward compatibility with previous plot types.

[*] Stiff problems typically have solution components with large differences in time scale. More information is needed by a solver to compute a solution efficiently.
Find all posts by this user
Quote this message in a reply
Post Reply 

Messages In This Thread
RE: (48G 49G 50G) Runge-Kutta Diff Eqn solver - Giuseppe Donnini - 06-19-2021 02:24 AM

User(s) browsing this thread: 1 Guest(s)