Mathematica: 2nd order PDE, variable coefficients

Join the discussion
Ask a follow-up here, or get your own question answered by working scientists, mathematicians and engineers — people, not an autocomplete.
Real named experts · corrections over time · the nuance an AI answer skips
7 replies · 6K views
hasidim
Messages
15
Reaction score
0
[tex]a\text{''}[t]+B[t]*a'[t]-A[t]*a[t]==0[/tex]

a[0] = 10^-9
a'[0] = 0
a[t] = ?

The coefficients A and B are variable over time. I HAVE solved (experimental and theoretical values) for the values of A and B over the time interval of interest!

I attempted to solve for a[t] using NDSolve as one normally would when coefficients are not variable over time. No luck.

Any help would be greatly appreciated!
 
Physics news on Phys.org
Oh geez, yeah, I meant ODE... it was a little late at night.

So, here is code. SolutionA, SolutionB and SolutionC are for R(t), R'(t), and R''(t). For coefficients A and B:
[tex]A[\text{t$\_$}] = \text{constants}*\frac{R\text{''}[t]}{R[t]}-\frac{\text{constants}}{\rho *(R[t])^3}+\frac{R'[t]}{(R[t])^3}*\left(\text{constants}*\frac{1}{1+2*\psi /R[t]}\right);[/tex]
[tex]\text{AA}= \text{Evaluate}[A[t]\text{/.}\text{SolutionA}\text{/.}\text{SolutionB}\text{/.}\text{SolutionC}][/tex][tex]B[\text{t$\_$}] =3 \frac{R'[t]}{R[t]}+\frac{\text{constants}}{(R[t])^2}*\left(\frac{\text{constants}}{\text{constants}*R[t]}\right);[/tex]
[tex]BB = Evaluate[B[t] /. SolutionA /. SolutionB /. SolutionC];[/tex]
Attempt at using NDSolve (for SolutionD):

[tex]SolutionD = <br /> NDSolve[{a''[t] + BB*a'[t] - AA*a[t] == 0, a[0] == 10^-9, <br /> a'[0] == 0}, a[t], {t, 0, tmax}];[/tex]I've tried making AA and BB into tables, I've tried using DSolve, and so on.

Thanks a million for the help.
 
Last edited:
Although that's a lot of detail (and it's probably best to use a code block, rather than latex) it's still hard to tell what could be causing the problem.
One small thing (which is probably a problem with you're copy/pasting) is that the you should bracket {t,0,tmax}.
Can you:
1) Supply the error message that NDSolve is giving
2) Give the form of Solution* (and are \psi and \rho numerical?)
3) Provide a copy of the notebook (preferably with any extraneous stuff removed)

I'm guessing that R[t] must be some numerical/interpolated function. Here's a simple example showing the use of an interpolated function and NDSolve. Note that the interpolation becomes bad at around x=4.
Code:
data=Table[{x,Cos[Exp[x]]},{x,0,5,.05}];
AA=Interpolation[data];
Code:
Plot[{Cos[Exp[x]],AA[x]},{x,0,5}]
Code:
sol1=NDSolve[{y'[x]+Cos[Exp[x]] y[x]==0,y[0]==1},y,{x,0,5}];
sol2=NDSolve[{y'[x]+AA[x] y[x]==0,y[0]==1},y,{x,0,5}];
Code:
Plot[Evaluate[Flatten[y[x]/.{sol1,sol2}]],{x,0,5}]
 
This is very difficult to me, because i am a new user here.
==================================
http://www.bestbankrates.net"
 
Last edited by a moderator:
phyzguy and Simon_Tyler, thanks for the help.

I found the issue: it wasn't with my finding a[t] directly, it was solving for R[t], R'[t], and R''[t] (I wasn't getting real values). Also, I was reaching my maximum number of steps when using NDSolve to find a[t].

Also, I am still new and learning (mathematica and forums), I didn't realize there was a code block, so for what it is worth, this worked beautifully:

Code:
SolutionD = 
  NDSolve[{a''[t] + BB*a'[t] - AA*a[t] == 0, a[0] == 10^-9, 
    a'[0] == 0}, a[t], {t, 0, tmax}, MaxSteps -> 700000000];

CC = Evaluate[a[t] /. SolutionD];
 
Glad you got it sorted!