Mathematica: 2nd order PDE, variable coefficients

In summary, Mathematica is a software program commonly used by scientists to solve complex mathematical equations, including 2nd order PDEs with variable coefficients. Its ability to handle complex equations and provide accurate solutions, as well as its vast library of built-in functions and packages, make it a valuable tool for solving these types of equations. Mathematica can also handle boundary conditions and initial value problems, and in some cases, can find analytical solutions to 2nd order PDEs. It is also capable of solving these equations in multiple dimensions, making it useful for a wide range of problems.
  • #1
hasidim
15
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
  • #3
I agree that NDSolve should work for this. Just for the record, this is an ODE, not a PDE.
 
  • #4
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 =
NDSolve[{a''[t] + BB*a'[t] - AA*a[t] == 0, a[0] == 10^-9,
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:
  • #5
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}]
 
  • #6
This is very difficult to me, because i am a new user here.
==================================
http://www.bestbankrates.net"
 
Last edited by a moderator:
  • #7
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];
 
  • #8
Glad you got it sorted!
 

1. What is Mathematica and how is it used to solve 2nd order PDEs with variable coefficients?

Mathematica is a software program that is commonly used by scientists to perform complex mathematical calculations and solve equations. It can also be used to solve differential equations, including 2nd order PDEs with variable coefficients. Mathematica uses a combination of numerical and symbolic methods to find solutions to these types of equations.

2. What are the benefits of using Mathematica to solve 2nd order PDEs with variable coefficients?

One of the main benefits of using Mathematica is its ability to handle complex equations and provide accurate solutions. It also allows for the manipulation and visualization of equations and solutions, making it easier to analyze and understand the results. Additionally, Mathematica has a vast library of built-in functions and packages that can be used to solve a wide range of mathematical problems.

3. Can Mathematica handle boundary conditions and initial value problems for 2nd order PDEs?

Yes, Mathematica has built-in functions that can handle both boundary conditions and initial value problems for 2nd order PDEs with variable coefficients. These functions allow for the specification of boundary conditions and initial values, and can then solve the equation with these conditions in mind.

4. Is it possible to solve 2nd order PDEs with variable coefficients analytically using Mathematica?

In some cases, it is possible to find an analytical solution to a 2nd order PDE with variable coefficients using Mathematica. However, in most cases, the equation will need to be solved numerically. Mathematica has powerful numerical methods that can provide accurate solutions to these types of equations.

5. Can Mathematica handle 2nd order PDEs with variable coefficients in multiple dimensions?

Yes, Mathematica has the capability to solve 2nd order PDEs with variable coefficients in multiple dimensions. This is useful for problems that involve multiple variables, such as heat transfer in three-dimensional objects. Mathematica also has built-in functions for visualizing and analyzing solutions in multiple dimensions.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
268
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
228
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
Replies
4
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Differential Equations
Replies
5
Views
2K
  • Programming and Computer Science
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
8
Views
1K
Back
Top