How can I solve my differential equation with Mathematica?

  • Thread starter Thread starter Hertz
  • Start date Start date
  • Tags Tags
    Mathematica
Click For Summary
The discussion revolves around an issue with using Mathematica's NDSolve function for solving a partial differential equation. The user encounters an error indicating that boundary values can only be specified for one independent variable, and initial values for one value of the other variable. This highlights the importance of adhering to specific rules when setting conditions for differential equations in Mathematica. A suggested approach involves using DSolve to find a general solution, which reveals that the solution consists of complex functions that depend on unknown parameters. Understanding these complex functions may help in modifying them to meet the specified conditions of the problem.
Hertz
Messages
180
Reaction score
8
Hi, I can't quite figure out what I'm doing wrong here. I tried restarting mathematica as well which is what fixed my previous problem

Code:
Clear[eqn, soln, u, x, y]
eqn = D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}] == 0;
soln = NDSolve[{eqn, u[x, 0] == Sin[x], u[0, y] == 0, u[1, y] == 0}, 
  u[x, y], {x, 0, 1}, {y, 0, 1}]

and I'm getting the error:
Code:
NDSolve::ivone: Boundary values may only be specified for one independent variable. Initial values may only be specified at one value of the other independent variable. >>
 
Physics news on Phys.org
There are rules about how you can and can't specify conditions when trying to solve differential equations and the wording of the error message appears to fairly clearly state that you have violated that rule. There is an entire text published on only how to solve differential equations with Mathematica, and it is barely an introduction to the subject.

This will get you part way to a solution

In[1]:= Clear[eqn, soln, u, x, y];
eqn = D[u[x, y], {x, 2}] + D[u[x, y], {y, 2}] == 0;
DSolve[{eqn}, u[x, y], {x, y}]

Out[1]= {{u[x, y] -> C[1][I x + y] + C[2][-I x + y]}}

So that says the generic solution to your problem consists of unknown functions C[1] and C[2] each of which accept a complex argument. Your u[x,0]==Sin[x] puts pretty tight requirements on what C[1] and C[2] are. Do you know just enough about complex functions to guess what C[1] and C[2] are? With that you might be able to fiddle a little and guess how to then modify those to satisfy your two remaining conditions.
 

Similar threads

  • · Replies 1 ·
Replies
1
Views
2K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 13 ·
Replies
13
Views
2K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 1 ·
Replies
1
Views
3K
  • · Replies 5 ·
Replies
5
Views
2K
Replies
1
Views
2K