Message Boards Message Boards

0
|
4550 Views
|
8 Replies
|
9 Total Likes
View groups...
Share
Share this post:

DSolve simply freezing with yellow bar bracket

Posted 11 years ago
POSTED BY: Dev G
8 Replies
Posted 11 years ago

The yellow bracket means it is busy thinking, and for some problems it has to think a long time.

Issues: You have 6 unknown functions, m, bd, cm, d, eo and o. You only have 3 equations and 3 initial conditions. If you remember algebra from long ago, if I gave you a simple problem with 6 unknowns, but only 3 equations you can't find a solution for all 6 of those unknowns.

Here is a slight rewrite of your problem to make it a little more acceptable to Mathematica

a = 155/10; b = 13710*10^-8; c = 105*10^6; e = 1000;
DSolve[{m'[t] == -2 a m[t]^2 + 2 bd[t] - cm[t] d[t] + eo[t],
  d'[t] == a m[t]^2 - bd[t] - cm[t] d[t] + eo[t], o'[t] == cm[t] d[t] - eo[t],
  m[0] == 1, d[0] == 0, o[0] == 0}, {m[t], bd[t], cm[t], eo[t], d[t], 
  o[t]}, t]

Sometimes DSolve can find answers if it has exact fractions instead of numbers with decimals. But that didn't make enough of a difference and still doesn't solve the problem that there are too many unknown functions to find.

Is there more known information about the problem?

POSTED BY: Bill Simpson

Try NDSolve in this case:

logplot

Find the code in the attached notebook.

Attachments:
POSTED BY: Shenghui Yang
Posted 11 years ago

Thank you so much for your help Shenghui and Bill! Other solutions welcome as well!

POSTED BY: Dev G
Posted 11 years ago

Thank you so much for your help Shenghui! I had some quick follow up questions: Shenghui, does the need for NDSolve mean that this system cannot be solved analytically for explicit solutions? Additionally, can you explain what the difference between NDSolve and DSolve is and why one works but the other doesn't? Once again thank you so much for your help!

POSTED BY: Dev G
Posted 11 years ago

Thank you so much for your help Bill! I had some quick follow up questions Bill, I'm slightly confused by what you said. Since b, c, and e are simply given coefficients, I don't understand why you are treating bd, cm, and eo as independent unknowns in addition to the unknowns d, m, and o. I apologize if I'm looking at this the wrong way but from my perspective, there are only three unknowns, three equations, and three initial conditions. Could you please explain where my thinking is wrong? Once again, thank you so much for your help!

POSTED BY: Dev G

The system has several nonlinearities, which might make it difficult/impossible to find an analytical solution. I think that there was a misinterpretation of the input. In your first post you apparently tried to assign values to the parameters, but you used double equals which indicate an equation rather than an assignment.

a == 15.5, b == 1.3710^-4, c == 1.05 * 10^8, e == 1000

In that case Mathematica does (rightly) not find a solution. Also, you might want to run this:

ClearAll["Global`*"]

sol = ParametricNDSolveValue[{
   m'[t] == -2 a (m[t]^2) + 2 b*d[t] - c*m[t] d[t] + e*o[t], 
   d'[t] == a (m[t]^2) - b*d[t] - c*m[t] d[t] + e*o[t],
   o'[t] == c*m[t] d[t] - e*o[t], m[0] == 1, d[0] == 0, o[0] == 0},
  {m, d, o}, {t, 0, 100}, {a, b, c, e}]

Manipulate[x = sol[a, b, c, e]; 
 LogPlot[{x[[1]][t], x[[2]][t], x[[3]][t]}, {t, 0, 100}], {{a, 
   15.5}, -500, 500}, {{b, 0.0001371}, -1, 1}, {{c, 1.05*10^8}, 10^2, 
  10^10}, {{e, 1000}, -1000, 10000}]

You can modify the values of the parameters and see how your solution changes. Note that for some combinations of parameter values the solution diverges or leads to numerical instabilities.

POSTED BY: Marco Thiel

Two reasons:

  1. The differential equation is nonlinear. Usually you should try numeric method first
  2. The coefficients are not exact but machine numbers. Solve and DSolve would complain if input is not integer or symbolic values
POSTED BY: Shenghui Yang
Posted 11 years ago

You wrote

The code itself is as follows:

DSolve[{m'[t] == -2a(m[t]^2) + 2bd[t] - cm[t]d[t] + eo[t], d'[t] == a(m[t]^2) - bd[t] - cm[t]d[t] + eo[t],
o'[t] == cm[t]d[t] - eo[t], m[0] == 1, d[0] == 0, o[0] == 0, a == 15.5, b == 1.3710^-4, c == 1.05 * 10^8,
e == 1000}, {m[t], d[t], o[t]}, t]

I literally scraped your text off the screen, pasted it into Mathematica and both I and Mathematica misunderstood and completely missed the invisible *'s, or perhaps desktop published really really tiny spaces, between bd, cm and eo and so thought, because of the trailing [ t ] that these were three new unknown functions. I apologize for my mistakes.

Not requiring the use of * between variables is sometimes a convenience and all too often a source of errors.

Now with these changes

a = 155/10; b = 13710^-8; c = 105*10^6; e = 1000;
DSolve[{m'[t] == -2 a (m[t]^2) + 2 b*d[t] - c*m[t] d[t] + e*o[t], d'[t] == a (m[t]^2) - b*d[t] - c*m[t] d[t] +
e*o[t], o'[t] == c*m[t] d[t] - e*o[t], m[0] == 1, d[0] == 0, o[0] == 0}, {m[t], d[t], o[t]}, t]

It sits there with the yellow bar letting you know it is thinking and after a while returns the DSolve unchanged, and you are to understand that this means it cannot find an exact analytic solution to your problem. Then as Yang nicely shows, it is possible to get a numerical solution to your problem.

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