# PDE's: examples I can do, real equations No.

crepincdotcom
Hey all,

I've been working my way through various Calc books I have to reach this point: the infamous Partial Differential. In school I was in Algebra 2 last year due to some track issues shall we say... but I was so set on learning how to use some of the great physics equations in my code such as the Navier-Stokes and Wave equation that I managed to plod my way through differentiation and now have arrived at partials.

I've got the theory well enough, and if you give me an equation of the form f(x,y) = something I can find $$\frac{\partial f(x,y)}{\partial x}$$ or $$\frac{\partial f(x,y)}{\partial y}$$. I was so excited when I checked my answers to some problems in the book and they were right!

I ran to The Oracle (Google) to find a physics equation I could code and see results. I found the Wave equation: the simplest one, so I was told.

Turns out the simplest real equation is beyond me: $$T \frac{\partial^2 y}{\partial x^2} = U \frac{\partial^2 y}{\partial t^2} =$$. (I think I have that correct)

Now: second order equations I could probably handle, but really, what is that thing! I mean, there are TWO sets of $$\frac{\partial^2 }{\partial V^2}$$ (where V is some variable). I mean, the idea is that knowing x and t, you can find the height y of a tiny section of string. I simply have no idea how to go about putting in an X or T, getting an equation in terms or Y, etc. All I know is that through some magic, there are solutions to that equation of the form y(x,t).

Thanks for any help you can give, sorry I have to bother all of you "learned scholars",

-Jack Carrozzo
http://www.crepinc.com/
Jack {[at]} crepinc.com

Woxor
It would be a mistake to approach this problem by "plugging in" values for x and t; that's a luxury you have when you have solved the problem and discovered what y(x,t) is. However, you DO have to have additional specifications to the problem in order to find out exactly what y(x,t) is. These are called "boundary conditions," or "initial conditions," depending on the application. They consist of equations like "y(0,0) = 3," or "y(-4.5,t) = cos(t)." These equations are necessary to specify the solution completely.

However, it is possible to solve this equation generally, and then plug the boundary conditions in at the end, usually in order to determine values for various constants or other. As a warning: unless you've taught yourself some integration as well, solving differential equations will be pretty difficult.

Here's how you can solve the wave equation:

First assume that y(x,t) can be expressed as the product of a function of x with a function of t; that is, let y(x,t) = f(x)*g(t). Now if we find f and g, we will know y.

Using the product rule, plug f and g into the wave equation:

$$T \frac{\partial^2}{\partial x^2}(f(x)g(t)) = U \frac{\partial^2}{\partial t^2}(f(x)g(t))$$

This simplifies to:

$$Tf''(x)g(t) = Uf(x)g''(t)$$

Rearranging, we get:

$$\frac{g(t)}{g''(t)} = \frac{Uf(x)}{Tf''(x)}$$

Clearly, the left-hand side is a function of t alone (that is, not of x and t), and the right-hand side is a function of x (and not t). So the fact that they equal each other must mean that they are both, in fact, equal to a constant. Call this N. Thus, you have:

$$\frac{g(t)}{g''(t)} = \frac{Uf(x)}{Tf''(x)} = N$$

Rearrange this into two equations:

$$g(t) = Ng''(t)$$

$$f(x) = \frac{NT}{U}f''(x)$$

So our partial differential equation of two variables has reduced to two ordinary differential equations. Given the simple form of these ODEs, you can plug in trig functions of the form $$g(t) := Acos(\sqrt{N}t)+Bsin(\sqrt{N}t)$$ to find the answer to the first one, and use $$f(x) := Ccos(\sqrt{\frac{NT}{U}}x)+sin(\sqrt{\frac{NT}{U}}x)$$ on the second. (You don't have to have another constant in front of the sin function because it's just going to be multiplied by other arbitrary constants anyway -- you'll see what I mean if you work it out).

You have six unknown constants: A, B, C, N, T, and U. You can use the above two equations to find two of them (in terms of the others). This gives you the "general solution" to the PDE.

Then, you'll need about two boundary conditions to further specify the constants, and you'll be left with the fact that T/U can be treated as a single constant, and that any solution y(x,t) will also give you E*y(x,t) as a solution, so that's another degree of freedom right there. Effectively five constants, and four restrictions (two equations, two boundary conditions), with one degree of freedom left over. If you have another boundary/initial condition, you can find y(x,t) completely.

Of course, this is, unfortunately, a simplistic treatment of it. You'd do better to spend a LOT of time researching this type of problem; PDEs are things you have to spend a lot of time on, as opposed to something like an arithmetic problem.

Last edited:
crepincdotcom
Wow.

I'm going to have to spend some time ripping that apart tonight, thanks a lot for the great response. You suggest that I spend a lot of time researching this, and I agree that that would probably be a good idea. Do you know of a good place to find some info? I've looked around quite a bit on google, and haven't found anything that I either didn't already know or expected that you knew something I hadn't yet learned.

Thanks again,

-Jack Carrozzo
http://www.crepinc.com/
Jack {[at]} crepinc.com

Woxor
Off-hand, I don't know any specific resources besides MathWorld and http://planetmath.org/encyclopedia [Broken], but the key ideas involved are PDEs, the wave equation, separation of variables (which is what you call the method I used), boundary conditions, and ODEs. That might help a little on your google searches.

By the way, if you haven't studied integration, do that first if at all possible. After that, if you haven't studied any ordinary differential equations, you almost have to do that before starting partial differential equations.

Last edited by a moderator:
crepincdotcom
I've spent quite some time since this post's inception working on this.... here's where I'm stuck at the moment.
By what therom, name, or process does this part take place?

Woxor said:
So our partial differential equation of two variables has reduced to two ordinary differential equations. Given the simple form of these ODEs, you can plug in trig functions of the form $$g(t) := Acos(\sqrt{N}t)+Bsin(\sqrt{N}t)$$ to find the answer to the first one, and use $$f(x) := Ccos(\sqrt{\frac{NT}{U}}x)+sin(\sqrt{\frac{NT}{U}}x)$$ on the second. (You don't have to have another constant in front of the sin function because it's just going to be multiplied by other arbitrary constants anyway -- you'll see what I mean if you work it out).

I haven't read anywhere about doing this. Is it problam-specific that trig functions happen to work, or a general idea?

Thanks,

-Jack Carrozzo
http://www.crepinc.com/

Spectre5
Those come from solving the ordinary differential equations of f and g separately. Do you have any experience with solving ODE's? If not, then you should really study them first...such as separation of variables, integrating factor method, etc, etc.

The way you actually get cos and sin in the answer though, come by trying exponential solutions of the form exp(rt) [t is the independent variable]...then you will get equation for r when you put that solution into the ODE. exp(rt) is never zero, so you will end up with an equation for "r". This is known as the auxilary equation. Solve it (quadratic formula, assuming a second order ODE) to get your values of r that satisfy the equation. Sin and Cos come into play becuase you will get imaginery numbers for r, and you then use euler's identity to get the oh-so-familar sin/cos forms.
If you still don't understand this, post back and I will work it out slower.

Last edited:
Pseudo Statistic
crepincdotcom said:
I've spent quite some time since this post's inception working on this.... here's where I'm stuck at the moment.
By what therom, name, or process does this part take place?
I haven't read anywhere about doing this. Is it problam-specific that trig functions happen to work, or a general idea?
Thanks,
-Jack Carrozzo
http://www.crepinc.com/
It's somewhat a general idea that trig functions will, after a certain number of derivatives are taken, be pretty much the same as the original function multiplied or divided by constants. (Thanks to our good old friend the chain rule)
Alternatively you could have said that the original function was e^mx, similar to what Spectre5 said, and end up with what we call the "auxillary equation", try to solve it using the quadratic formula, and find that the roots are imaginary...
That's where you're going to have to use sine and cosine-- unless you like keeping things in exponential-imaginary form. :}
Here's an example... let's say you had this, a second order differential equation with constant co-efficients:
y'' + 3y' + 2y = 0
We can guess that the original function will be something along the lines of y = e^mx, then:
y' = me^mx, y'' = m^2 e^mx
Nice, alright, let's plug it into the differential equation:
m^2 e^mx + 3m e^mx + 2 e^mx = 0
Factorizing...
e^mx (m^2 + 3m + 2) = 0
Because e^mx will never, ever be zero (so far as we're concerned) just pull it out:
m^2 + 3m + 2 = 0
We call this the auxillary equation, solve it using the quadratic formula, you'll find:
m = -2, m = -1
Nice, so we have two ms, but don't we only have one term for m in our proposed solution to the differential equation? Not quite; there are some rules for what the original solution is after solving the auxillary equation:

If the two roots, we'll call them m1 and m2, are unequal and real, then the solution to the differential equation is:
y = Ae^(m1 x) + Be^(m2 x)
Where A and B are some constants you can find thanks to initial-conditions.

If the two roots m1 and m2 are equal, the solution to the differential equation is:
y = (A + Bx)e^mx

If the two roots m1 and m2 are complex conjugates (in the form a +/- bi), you can write the solution as:
y = [e^(ax)][A cos Bx + B sin Bx]

You can indeed test these out and find that they do, indeed, work..

Back to our original question, we found:
m1 = -2, m2 = -1, so the solution is:
y = ae^(-2x) + Be^(-x)

Hope that made a little bit of sense. :rofl:

crepincdotcom
Thanks a lot, both of you. I'm going to spend a few hours pouring over this tonight to attempt to wrap my mind around it, and see what I come up with.

For clarification, I'm wondering how we can simply "assume" that if we have an ODE of some form that f(x) takes a particular form. Is it that f(x) can take any form we want, given our contraints?

And Yes spectre, I have a (somewhat small) experience with BASIC ODE's, but I can't say I'm exactly comfertable with them. I understand the concept, but generally they way I learn best is to integrate an idea into a program, and I haven't see any good ODE examples I can use for this yet.

Thanks again,

-Jack Carrozzo
http://www.crepinc.com/

Spectre5
Yes, you can use ANY form of f(x), IF it works as a solution...try some other random forms of f, and you shall find that they do not work (their constants will be forced to be zero, thus creating the already-known, trivial solution, zero).

For example, using Psuedo's example, try a solution of the form
A*x^2 + B*x + C. Plug that in, and you will find that the only constants A, B, and C that make it a solution are A = B = C = 0. Thus y=0. We already knew that, it doesn't help any.

We know to use e^rx by experience (it works for many of these problems, but definitely NOT always!!
(i.e. cauchy-euler equation, bernoulli equation, ricatti equation, etc, etc, etc)