Post Reply 
Differential Equations
03-25-2017, 02:13 AM
Post: #1
Differential Equations
I've always enjoyed the articles by Valentin Albillo. One of my favorites was his "Long Live the HP-25 !" In that article he gave two examples of programs to Solve Differential Equations which demonstrate just how powerful the HP-25 could be with its 49 program steps.

I have entered those programs into my 25C emulator and the programs work perfectly.

There's just one problem. As a retired financial guy, I don't understand what Differential Equations are or what they are supposed to do. I've googled them and have watched some online videos, but I still can't quite get my arms around what Differential Equations are.

Does anyone here know if a resource I can go to in order to understand them?

Thanks.


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-25-2017, 03:29 AM
Post: #2
RE: Differential Equations
Differential equations deal with system (or formulas describing such) that undergo continuous change. In general, rather than knowing the equation a system follows, we know an equation that tells us how the equation changes. (There's a lot to this. A first course in differential equations follows a couple of courses in calculus.) If one knows what a derivative and an integral are; knows that these are inverses of each other; then the following may make sense (if I write it well enough.)

Lets take a simple example that doesn't even need calculus. We wish to describe how a car moves at constant speed. From physics, we know that the change in distance of the car, per unit time, is its velocity. So a simple equation would be S(t2-t1)=V*(t2-t1) which describes the movement of a care moving at velocity V over time t1 to t2. The distance (S for space) is the velocity times the time. Equivalently the velocity is the distance covered divided by the time if the velocity is constant. (If the font allows) this can be written as ΔS=V*Δt.

We are interested in the case where Δt is instantaneous; it's written dt and the instantaneous change in distance is written dS. Formally (without lots of necessary but tedious proof steps) we write dS=V(t)dt which means the instantaneous change in distance is the velocity at a given time an infinitesimal amount of time. (Advanced calculus courses teach the proofs and concepts necessary to get all this to work correctly.)

Now consider how to describe a car driven by a reasonably intelligent kangaroo which does not move at constant speed. Assume we are given a function describing the velocity at a given time V(t) and want the distance covered. We can solve the above differential equation dS=V(t)dt by integrating both sides with respect to distance and time respectively. The trick is to treat the differentials (carefully) as objects themselves. This gives us the equation S = V*t + C. The distance is the velocity times the elapsed time plus an undetermined constant (one always get such a constant which can be determined by boundary conditions) which in this case is the starting point.

A more interesting case (which cannot easily be solved with high-school algebra) is the formula for radioactive decay or for loss of medicine given to a person or growth of a fungus in a petri dish. In this case, physics (ok chemistry or biology) tell us that the amount of change is proportional to the amount present. Uranium loses a constant percentage each time unit; similarly for the other examples. Here the differential equation describing things is given by dX/dt = a*X with dX/dt describing the ratio of change and "a" is the constant of proportionality. By gathering Xs and ts on separate sides of the = sign we get: dX/X = a*dt. Both sides can be integrated to give Log(X) = a*t +C. Or one can exponentiate both sides and get X(t)=C*Exp(at). The constant C is the amount originally present and the decay rate is give by a. Thus proportional decay leads to an exponential loss.

Some differential equations have algebraic solutions but many have to be solved numerically. There is a bunch of lore on this too.

A couple of further examples of a more complicated nature: if one drops a brick or bomb or lawn dart from some height; the law of gravity states that the body has a constant acceleration thus dV/dt=a. Also (as above) one gets that dS/dt = V which can be combined if desired into a second order differential equation which I don't know this board's fonts well enough to show. Anyway, either way, one solves things the same way; integrate dV=adt giving V=at+C1 then pluggin this into the next equation dS/dt=V=at+C1 or dS/dt=at+C1 and gathering terms giveng dS=atdt+C1dt which can be integrated to yield S=(a*t^2)/2+C1*t+C2. C1 can be interpreted as the initial velocity and C2 as the initial position.
Find all posts by this user
Quote this message in a reply
03-25-2017, 04:45 AM (This post was last modified: 03-25-2017 04:47 AM by Han.)
Post: #3
RE: Differential Equations
Any calculus book will be a perfectly fine introduction into differential equations. Once you learn the concept of a (mathematical) derivative, then you have essentially all the tools to understand what a differential equation is. (Solving them, however, requires a bit more mathematics.)

Perhaps a finance example might be helpful. Consider an account that accrues an effective annual rate of 5%, and that any interest earned is reinvested. Suppose \( P \) represents the (future) value of the account after t years of investment. In mathematical terms, \( P \) is a function of \( t \); the notation \( P(t) \) is generally used. For brevity, mathematicians may simply write \( P \) when it is understood that \( t \) is the independent variable. The average annual rate of change in \( P \), which is essentially the interest earned over a one-year period, is
\[ \underbrace{\frac{\Delta P}{\Delta t}}_{\text{interest}} = (\text{interest rate}) \times (\text{current value of account}) =
0.05 \cdot P \]
The left hand side is an approximation of what is mathematically called the "derivative" of the function \( P \). The derivative of a function measures "instantaneous" rates of change as opposed to an "average rate of change." An easy analogy would be driving at an average speed of 60mph over a 1 hour period, whereas at any given moment one's actual (instantaneous) speed may be slightly above or below 60mph (i.e. not necessarily 60mph, but relatively close to it "most of the time").

If we instead looked at smaller growth periods (perhaps interest compounded not annually, but monthly, or weekly, or daily, or hourly, etc.) then the average rate of change more closely resembles the instantaneous rate of change (the derivative). In the interest example above, this would be equivalent to looking at interest compounded continuously (with a nominal rate that is slightly less than 5%).

The common notation for a derivative (using the example above) is \( \displaystyle \frac{dP}{dt} \), or \( P'(t) \), or \( P' \) for brevity.

Anyway, a differential equation is merely an equation that involves a derivative of any sort. Solving a differential equation amounts to finding a function whose derivative satisfies the differential equation. To use another (finance) example, consider the formula for simple interest. Let \( P_0 \) denote the present value, and \( P(t) \) be the future value with an annual rate of \( r \) over \( t \) years. The formula is
\[ P(t) = P_0 + P_0 \cdot r \cdot t \]
and \( P(t) \) satisfies the differential equation
\[ \frac{dP}{dt} = P_0 \cdot r \]
with an initial condition of \( P(0) = P_0 + P_0 \cdot r \cdot 0 = P_0 \) (i.e. the present value is \( P_0 \)).

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
03-25-2017, 02:01 PM
Post: #4
RE: Differential Equations
Hello friends,

what is a differential equation?

Maybe it is a good idea to explain the mathematical idea of this with an comparison of "normal" equation.

An equation is an expression which can be evaluated as true or false. If there is a variable situated in the equation, you have to assign a value to that variable and then you can evaluate wether it's true or not.

In a differential equation you are not looking for one value (or a lot of values) which satisfies your equation, you are looking for a function, which satisfies the equation. That is a more complicate situation.

An example: f'(x) = g(x), you are looking for a function where f : x |--> f(x) with the condition f'(x) = g(x). So with a differential equation you are looking not only for values, your are looking for every x value a corresponding value f(x) with the condition of a defined change "rate" f'(x).

If there exist no analytical solution for such an equation, you can "solve" (means here finding for every x value a corresponding value f(x) with the condition of a defined change "rate" f'(x) ) it by numerical calculation in little steps.

The analytical or numerical way of finding that function f is the integration.
I hope that helps to get the main idea of the fascinating topic in mathematics.

Sincerely peacecalc
Find all posts by this user
Quote this message in a reply
03-26-2017, 04:36 PM
Post: #5
RE: Differential Equations
My favorite text is:

'Differential Equations with Applications and Historical Notes', by George F. Simmons.

It is relatively easy to follow, has many interesting historical notes detailing why the topic of that chapter was pursued/studied.

It was the text that I was 'schooled on' and has been used my many Mathematics and Engineering curricula.

Regards/Happy Travels!
TomC

(03-25-2017 02:13 AM)bshoring Wrote:  I've always enjoyed the articles by Valentin Albillo. One of my favorites was his "Long Live the HP-25 !" In that article he gave two examples of programs to Solve Differential Equations which demonstrate just how powerful the HP-25 could be with its 49 program steps.

I have entered those programs into my 25C emulator and the programs work perfectly.

There's just one problem. As a retired financial guy, I don't understand what Differential Equations are or what they are supposed to do. I've googled them and have watched some online videos, but I still can't quite get my arms around what Differential Equations are.

Does anyone here know if a resource I can go to in order to understand them?

Thanks.
Find all posts by this user
Quote this message in a reply
03-27-2017, 03:49 AM
Post: #6
RE: Differential Equations
Thanks everyone for your kind explanations and suggestions. I'll check out the book 'Differential Equations with Applications and Historical Notes', by George F. Simmons.

I think I'm a little closer to understanding what's going on.

I have played around with the program by Fernando del Rey at the bottom of Valentin's article "Long Live the HP-25 ! I have plugged into it the formula for calculating Simple Interest on the basis of a 365-day year with the formula:
(n/365)*PV*i = INT (simple interest)
where PV (present value)=5,000 and i=.05 and n is provided by the program and is subject to change.

Using this formula we get:
1 day INT= .684932
2 days " = 1.369863
3 " " = 2.054795
4 " " = 2.739726
5 " " = 3.424658

Now when I run the 4th order Differential Equations program and store initial values of 0 in R1 and R2 and a step size of 1 in R0, I get the following results at steps 1 through 5:
1. .342466 (50% of 1 day's interest)
2. 1.369863 (100% of 2 day's interest)
3. 3.082192 (150% of 3 day's interest)
4. 5.479452 (200% of 4 day's interest)
5. 8.561644 (250% of 5 day's interest)

So I can see that at each step there is some relationship to the actual interest. But what I don't yet get is, "What are these numbers trying to tell me?"

The other question that comes to mind is, what is the difference between a first order vs 3rd order or 4th order Differential Equations? Is it a matter of the higher the order the greater the accuracy or is there some other issue?

Again, thanks all for all your kind explanations and patience!


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-27-2017, 06:46 AM
Post: #7
RE: Differential Equations
The order of a derivative refers to the order of rate of change. For example, if \( s(t) \) is a function that measures the distance \( s \) traveled after \( t \) hours, then the first (order) derivative of \( s(t) \) is the rate of change of \( s \) with respect to \( t \). Conceptually, this is the instantaneous speed, which (for convenience), we will call the velocity function \( v(t) \). Mathematically, it is written as \( v(t) = s'(t) \). We may then consider the rate of change of velocity over time, i.e. the first (order) derivative of \( v(t) \). Conceptually, this is the instantaneous acceleration, which may be written as \( a(t) = v'(t) \). Now \( a(t) \) is the first (order) derivative of \( v(t) \), but it is a second (order) derivative of \( s(t) \) -- it is the rate of change of the rate of change of \( s \) with respect to \( t \) -- and we write \( a(t) = s''(t) \).

Mathematically speaking, we can compute higher order derivatives by simply computing the derivative of previous (lower order) derivatives. These (higher order) derivatives may or may not have immediate interpretations in the real world beyond the first few orders, but mathematically they exist.

The order of a differential equation, then, is simply the highest order of any derivative involved in the differential equation. So for example, the acceleration due to gravity is described by the second order differential equation \[ s''(t) = -9.8 \] since \( s''(t) \) is the second (order) derivative of \( s(t) \) -- which we mentioned earlier was the acceleration function -- and is the highest order derivative (in fact the only derivative) involved in the equation above.

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
03-27-2017, 08:22 AM
Post: #8
RE: Differential Equations
(03-27-2017 03:49 AM)bshoring Wrote:  I have played around with the program by Fernando del Rey at the bottom of Valentin's article "Long Live the HP-25 ! I have plugged into it the formula for calculating Simple Interest on the basis of a 365-day year with the formula:
...

I am sure that almost everyone here will have the quoted Albillo article at hand, ...but I don't. I think I read it some years ago but at the moment even Google cannot find the original PDF. But without knowing how the mentioned 4th order program works noone is able to help interpreting its output. So, do you have a link to that article, or can you post the program here? 49 steps should not be much of a problem. ;-) Be sure to also include your code for the interest function.

Dieter
Find all posts by this user
Quote this message in a reply
03-27-2017, 08:46 AM
Post: #9
RE: Differential Equations
(03-27-2017 08:22 AM)Dieter Wrote:  I am sure that almost everyone here will have the quoted Albillo article at hand, ...but I don't. I think I read it some years ago but at the moment even Google cannot find the original PDF.

You can find an archive of Valentin’s articles here.
Find all posts by this user
Quote this message in a reply
03-27-2017, 08:47 AM
Post: #10
RE: Differential Equations
https://www.thecalculatorstore.com/epage...s/Articles
Find all posts by this user
Quote this message in a reply
03-27-2017, 08:57 AM (This post was last modified: 03-27-2017 09:56 AM by Dieter.)
Post: #11
RE: Differential Equations
(03-27-2017 03:49 AM)bshoring Wrote:  I have played around with the program by Fernando del Rey at the bottom of Valentin's article "Long Live the HP-25 ! I have plugged into it the formula for calculating Simple Interest on the basis of a 365-day year with the formula:
(n/365)*PV*i = INT (simple interest)
where PV (present value)=5,000 and i=.05 and n is provided by the program and is subject to change.

...

Now when I run the 4th order Differential Equations program and store initial values of 0 in R1 and R2 and a step size of 1 in R0, I get the following results at steps 1 through 5:
1. .342466 (50% of 1 day's interest)
2. 1.369863 (100% of 2 day's interest)
3. 3.082192 (150% of 3 day's interest)
4. 5.479452 (200% of 4 day's interest)
5. 8.561644 (250% of 5 day's interest)

So I can see that at each step there is some relationship to the actual interest. But what I don't yet get is, "What are these numbers trying to tell me?"

I think I now have an idea of what's going on here, even without knowing the program you mention. To me it sounds like this:

The program you got does not solve 4th order differential equations (which would be quite a job to do with the limited properties of the HP25). Maybe it uses a 4th order method like this one on this website. But it actually does something completely different: it solves simple first order differential equations. Such equations are defined by

y' = f(x,y)

I assume you know what a derivative is. So here the derivative of a function is defined by its argument and its original function value y(x).

Programs that solve such differential equations try to calculate y for a number of different x. In other words: you tell the program what the derivative y' is, and the program approximates the original function y for different x. Based on a known pair (x,y) that you enter as initial values.

In your case you now have a function of n, where y is the interest rate:

y(n) = n * PV * i / 365

Now remember: the program wants you to enter the function y'(n), using x and y as its arguments. But you entered something different into the program. You obviously entered the original interest function y(n), not y'(n, y) as expected by the program. So the program now works with

y'(n) = n * PV * i / 365

i.e. with y'(n) = n times a constant PV*i/365 = n * 0,684932

Now – it's just simple calculus – if y'(n) = n * const, then y(n) = n²/2 * const. *) And this is what you get:

Code:
 y' = n * PV*i/365
    = n * daily_interest
    = n * 0,684932

Integrate wrt n to get

 y  = n²/2 * daily_interest
    = n² * daily_interest/2
    = n² * 0,342466

n    n²*0,5*daily_interest
------------------------------------------------
1    0,5 * daily_interest = 0,5 * 1-day-interest
2     2  * daily_interest =  1  * 2-day-interest
3    4,5 * daily_interest = 1,5 * 3-day-interest
4     8  * daily_interest =  2  * 4-day-interest
5   12,5 * daily_interest = 2,5 * 5-day-interest
 

And that's exactly what you get. If n runs from 1 to 5 the program returns y = n²/2*0,684932.
Or, if you want to relate this to the n-day-interest = n*0,684932, simply divide by the latter to get n/2 times the n-day-interest.
So for n=3 the program returns 3/2 = 150% of the 3-day-interest.

Now, "what are these numbers trying to tell me?". I cannot tell since the original equation does not make much sense: you entered y'(n) instead of y(n).

Dieter
__________
*) Actually the solution is n²/2*const + C. But you said that if x=0 then y=0 as well, so C is 0 and can be omitted.
Find all posts by this user
Quote this message in a reply
03-27-2017, 09:58 AM (This post was last modified: 03-27-2017 10:17 AM by Dieter.)
Post: #12
RE: Differential Equations
(03-27-2017 08:47 AM)Ángel Martin Wrote:  https://www.thecalculatorstore.com/epage...s/Articles

Yes, I have seen that site as well but all I get is an error message when I try to follow a link. Not only for the HP25 article.

Dieter
Find all posts by this user
Quote this message in a reply
03-27-2017, 10:08 AM (This post was last modified: 03-27-2017 10:11 AM by Dieter.)
Post: #13
RE: Differential Equations
(03-27-2017 08:46 AM)Didier Lachieze Wrote:  You can find an archive of Valentin’s articles here.

Ah, thank you, this time it works. And indeed it's not a 4th order differential equation program but a 4th order method, which is used to solve a first-order diff. equation.

Dieter
Find all posts by this user
Quote this message in a reply
03-27-2017, 07:27 PM
Post: #14
RE: Differential Equations
The first derivative of the distance is the velocity.
The first derivative of the velocity is the acceleration.
The first derivative of the acceleration is the jerk.
The first derivative of the jerk is the snap.
The first derivative of the snap is the crackle.
The first derivative of the crackle is the pop.

For really high impact problems (like the rocket sled experiments) high order expansions seem necessary to get an accurate description.
Find all posts by this user
Quote this message in a reply
03-27-2017, 08:55 PM
Post: #15
RE: Differential Equations
(03-27-2017 07:27 PM)ttw Wrote:  The first derivative of the distance is the velocity.
The first derivative of the velocity is the acceleration.
The first derivative of the acceleration is the jerk.
The first derivative of the jerk is the snap.
The first derivative of the snap is the crackle.
The first derivative of the crackle is the pop.

For really high impact problems (like the rocket sled experiments) high order expansions seem necessary to get an accurate description.

They need to make a Rice Crispies cereal box with some physics on the box cover! I didn't realize that there were terms for the higher order derivatives past jerk!

Graph 3D | QPI | SolveSys
Find all posts by this user
Quote this message in a reply
03-27-2017, 11:14 PM
Post: #16
RE: Differential Equations
I have ordered the book 'Differential Equations with Applications and Historical Notes', by George F. Simmons, from Amazon. My local library doesn't have it.

Hopefully, as I get into the book, this will all start to make a little more sense to me. I appreciate everyone's explanations and enlightenment !


Regards,
Bob
Find all posts by this user
Quote this message in a reply
03-27-2017, 11:46 PM
Post: #17
RE: Differential Equations
(03-27-2017 07:27 PM)ttw Wrote:  The first derivative of the distance is the velocity.
The first derivative of the velocity is the acceleration.
The first derivative of the acceleration is the jerk.
The first derivative of the jerk is the snap.
The first derivative of the snap is the crackle.
The first derivative of the crackle is the pop.

For really high impact problems (like the rocket sled experiments) high order expansions seem necessary to get an accurate description.
I got my first exposure to real calculus as a freshman Civil Engineering student. During an early practice session, we were shown the basic of stress analysis, with the example of a uniform, prismatic, horizontal beam, supported at both ends. The prof then started defining the beam's weight as a function of distance along the beam (not weight, of course, but density, but you get the idea). Being a uniform prismatic beam, this function is constant.

Then comes the first integral, which gives you shear stress.
The second gives you torque.
The third gives you bend.
The fourth gives you sag.

Any loads are added to the weight function; the specifics of the supports are expressed as boundary conditions.

The whole thing was more complicated than this, of course. The prof didn't just say "integrate shear stress and poof, you get torque" – he worked it all out on the blackboard with diagrams and infinitisemals. And it was extremely cool to see calculus come to life like that, with an extremely tangible real-world application.
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 




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