Message Boards Message Boards

Mathematica 8 - problem with NDSolve function for differential equation

Posted 9 years ago

I need to solve one differential equation:

equation:

equation:

boundary conditions:

boundary conditions:

But when I use NDSolve function for it in Mathematica 8.0 it shows some error:

ND Solve error:

I consulted my finite element analysis teacher but he said that he can't see any error in my formula and I need to figure it out by myself.

Is it even possible to solve this kind of equation using NDSolve? If yes than how can I enter NDSolve formula for this equation to solve it ?

POSTED BY: Jacek Michalski
8 Replies

Yes, running 10.02 on Windows 8.1

POSTED BY: Kay Herbert

Weird, becuase when I copy your codes to Mathematica it still shows errors. So something must be wrong with my program. Maybe it's because I have Mathematica 8. I suppose you have newer version, don't you ?

POSTED BY: Jacek Michalski

I usually break it up to make it more readable:

ClearAll["Global'*"]

eqns = {D[u[x, y], x, x] + D[u[x, y], y, y] - 3 u[x, y] == x y, 
  u[0, y] == 0, (D[u[x, y], x] /. x -> 2) == 0, u[x, 0] == 0, u[x, 1] == 0}

Traditional form lets me check if my equations make sense!

TraditionalForm[eqns]

s = NDSolve[eqns, u, {x, 0, 2}, {y, 0, 1}]

Plot3D[u[x, y] /. s[[1]], {x, 0, 2}, {y, 0, 1}]
POSTED BY: Kay Herbert

In the future please post your code usind <> on the toolbar so we can copy it. It's a little more tricky:

s = NDSolve[{D[u[x, y], x, x] + D[u[x, y], y, y] - 3 u[x, y] == x y, 
   u[0, y] == 0, (D[u[x, y], x] /. x -> 2) == 0, u[x, 0] == 0, 
   u[x, 1] == 0}, u, {x, 0, 2}, {y, 0, 1}]

Plot3D[u[x, y] /. s[[1]], {x, 0, 2}, {y, 0, 1}]

plot of result

POSTED BY: Kay Herbert

Unfortunatelly it looks like this mistake is not a problem here, because I've found previous version of my project and this boundary condition is correct there: u^(1,0)[2,y]==0 and that error message is still appearing.

POSTED BY: Jacek Michalski
Posted 9 years ago

In psudeo-math-english,

in the top you have del u/del x when x equals 2 is zero

while in the bottom you have u[2,y] is zero.

That was why I suggested you carefully compare the top and bottom half, character by character, to stumble onto this.

Exactly how to resolve that is another issue.

POSTED BY: Bill Simpson

Thank you for your help but you misunderstood me. My teacher said that I need to figure it out by myself not because I need to learn how to solve such problems but because he just doesn't know what is wrong and can't help me as he is a mechanical engineering (not math) expert. And if he - Doctor of Engineering can't solve it then how I - second year student can do it ?

What's more he suggested that I should either ask on some forum or leave this problem and continue with the rest of my project, becuase it's very small part of my finite element analysis project and it's only needed to check if whole thing is correct. I don't have time to sweat blood to find solution.

Also complex differential equations are not important part of my studies as I study biomedical engineering, not mathematics.

So could you please tell me where is the mistake in my formula ? I would be very grateful.

POSTED BY: Jacek Michalski
Posted 9 years ago

Since your teacher clearly told you to that you need to figure this out by yourself, I am very reluctant to tell you how to fix this.

I will give you one hint: Spend a minute concentrating on the idea that you know absolutely nothing about your problem, you have never seen this problem before, all you have is what you are about to see on the screen above this. When you have reached that state then compare the top half of your question with the lower grey screenshot of your question. Compare those a single character at a time. You are looking to find any tiny differences between the two.

If you find those then you need to figure out what the problem really is. Maybe it was just a mistake in your trying to desktop publish the top half of your question, if so then that probably solves nothing. Maybe it was a mistake in your trying to tell Mathematica what you wanted to solve. If that is the problem then you have an opportunity. That may involve figuring out how to tell Mathematica what you want AND in a way that Mathematica will understand you. I am guessing that won't be the way you think it should be written. If you think you know how to do that then try much simpler little experiments, things so simple that you know what the answer should be, but not so simple that you aren't even solving the same class of problem, to see if Mathematica understands what you are trying to tell it. But you need to figure that out.

Yes it is possible to solve this kind of problem using NDSolve. No I won't ruin your opportunity to learn from this. I urge you to not go ask somebody else somewhere else to just tell you the answer, you will lose everything if you do that. I hope it works out for you.

POSTED BY: Bill Simpson
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract