Numerical solution to a partial differential equation

In summary, the conversation discusses solving an inhomogenous partial differential equation using the NDSolve function in Mathematica for a specific interval. The conversation also mentions initial conditions and common mistakes that may occur when inputting the equation into Mathematica. It is advised to carefully test the solution to ensure its accuracy.
  • #1
Catria
152
4

Homework Statement



Solve the inhomogenous partial differential equation [itex]\frac{∂^{2}u}{∂t^{2}}-\frac{∂^{2}u}{∂x^{2}}=-6u^{5}+(8+4ε)u^3-(2+4ε)u[/itex] by using the NDSolve function in Mathematica for the interval [0,10] x [-5,5].

Homework Equations



Initial conditions:

u(0,x)= tanh(x)
u'(0,x)= 0

The Attempt at a Solution



NDSolve[{D[u[t, x], t, t] - D[u[t, x], x, x] ==
6 u^5 + (8 + 4 a) u^3 - (2 + 4 a) u, u[t, x] /. t -> 0 == Tanh[x],
D[u[t, x], t] /. t -> 0 == 0, u}, u[t, x], {t, 0, 10}, {x, -5, 5}]

But when I enter this into Mathematica, I get the message NDSolve::deqn: "Equation or list of equations expected instead of u[0==Tanh[x],x] in the first argument...
 
Physics news on Phys.org
  • #2
You have a few problems.

You appear to be missing a minus sign in front of

6 u^5

and this

6 u^5 + (8 + 4 a) u^3 - (2 + 4 a) u

should be this

-6 u[t, x]^5 + (8 + 4 a) u[t, x]^3 - (2 + 4 a) u[t, x]

which is a very common mistake that newer users make

and this

u[t, x] /. t -> 0 == Tanh[x]

should probably be this

u[0, x] == Tanh[x]

and your second boundary condition

D[u[t, x], t] /. t -> 0 == 0

might perhaps be

Derivative[1, 0][0, x] == 0

But I don't think that is enough to resolve your boundary condition problems because with these changes I'm getting a "non-numerical" complaint about derivatives when t is 0 and I can't track that down.

Unfortunately at the moment my Mathematica PDE brain cells are hiding and I can't find them. Hopefully either these will be enough hints to help you solve this or I will track down what I've forgotten and provide a little more assistance.

Ah, what was I thinking, I should have caught this instantly. Inside NDSolve all parameters are going to have to have been assigned constant numeric values, so your parameter a without a defined value isn't going to pass. If I put

a=1;

in front of your NDSolve then the "non-numerical" complaint goes away, that may have been because of your variable, but with this

a = 1;
sol = NDSolve[{D[u[t,x], {t,2}]-D[u[t,x], {x,2}] == -6 u[t,x]^5 + (8+4 a) u[t,x]^3-(2+4 a) u[t,x],
u[0, x] == Tanh[x], Derivative[1, 0][0, x] == 0},
u[t, x], {t, 0, 10}, {x, -5, 5}][[1, 1]];
Plot3D[u[t, x] /. sol, {t, 0, 10}, {x, -5, 5}]

does provide a plot, correct or probably not.

Now there is a lot more work for you to do to deal with the error and warning messages and all the rest.

You want to test all this very carefully when you are done to make certain the result is correct.
 
Last edited:

What is a partial differential equation (PDE)?

A partial differential equation is a mathematical equation that involves multiple independent variables and their partial derivatives. It represents a relationship between a function and its partial derivatives, and is used to describe phenomena in various fields such as physics, engineering, and economics.

What is a numerical solution to a PDE?

A numerical solution to a PDE is a method of approximating the solution of the equation using numerical techniques. This involves dividing the solution domain into a grid of discrete points and using algorithms to estimate the values of the function at these points. The accuracy of the numerical solution depends on the grid size and the chosen algorithm.

Why is numerical solution important for PDEs?

Many PDEs do not have analytical solutions, meaning that they cannot be solved using traditional mathematical methods. Numerical solutions allow us to approximate the solution to these equations, providing insight into the behavior of a system and allowing for predictions and simulations.

What are some common numerical methods for solving PDEs?

Some common numerical methods for solving PDEs include finite difference methods, finite element methods, and spectral methods. These methods differ in their approach, but all involve discretizing the solution domain and using algorithms to approximate the solution.

What are the challenges of numerical solutions to PDEs?

One of the main challenges of numerical solutions to PDEs is finding an appropriate grid size and algorithm that balances accuracy and computational efficiency. Additionally, some PDEs may be difficult to solve numerically due to their complexity or the presence of boundary conditions. Regular grid structures may also lead to numerical errors near boundaries or singularities, requiring specialized techniques to overcome these issues.

Similar threads

  • Calculus and Beyond Homework Help
Replies
0
Views
69
  • Calculus and Beyond Homework Help
Replies
1
Views
383
  • Calculus and Beyond Homework Help
Replies
1
Views
664
  • Calculus and Beyond Homework Help
Replies
8
Views
119
  • Calculus and Beyond Homework Help
Replies
7
Views
135
  • Calculus and Beyond Homework Help
Replies
5
Views
560
  • Calculus and Beyond Homework Help
Replies
5
Views
198
  • Calculus and Beyond Homework Help
Replies
11
Views
689
  • Calculus and Beyond Homework Help
Replies
4
Views
636
  • Calculus and Beyond Homework Help
Replies
1
Views
797
Back
Top