Message Boards Message Boards

Error solving initial value problem

Posted 11 months ago

Hey everyone! I am in a Differential Equations class and we are working on an assignment using Mathematica. I have been running into a few issues with it when trying to use the DSolve. I am to solve the inital value problem { (dh/dt) = −0.25h^2 + 1.25h − 1.3125, h(0) = 0.5 When I go to compute it I keep getting errors regarding 0.25 not being a valid variable. If anyone could help that would be great. I have attached an image of the error.

enter image description here

POSTED BY: Anna Ruffley
4 Replies
Posted 11 months ago

Hi,

I don't know a good introduction to using WL/Mathematica for solving differential equations for people who are new to Mathematica. There are some good introductions to Mathematica, but differential equations is usually a later chapter, if it appears at all. For instance, this nice introduction does not cover it: https://www.wolfram.com/language/elementary-introduction/3rd-ed/ The documentation bundled with Mathematica has this tutorial/book Symbolic Difcerential Equation Solving Chapter 1 and the beginning of chapter 7 might be of use to you). There is also Fast Introduction for Math Students, which has a chapter on differential equations. The problem with most Wolfram documentation and books, imo, is that they do not show new users how to find and correct the mistakes that new users commonly make. A troubleshooting guide is needed here, but I do not know of one.

Sometimes the documentation for the error message has troubleshooting info, but often not. For some years now, Wolfram has hidden the message name in the popup that appears when you click on the three red dots next to the warning/error message. The popup menu has a link to the documentation for the message, and that might have information that helps you debug the problem.

The message name is a key to the problem that might help unlock it. I don't know why it is hidden like an irrelevant technical detail. On Stackexchange, when I come across a question about a message, I add the name if it's not there, so that the issue may be Googled. A message is a symptom, and the same symptom can have several causes. Each Q&A on Stackexchange tends to have a single cause, and so you may have to go through several hits to find a fix to your own issue. Again a troubleshooting guide that goes through several possible causes for each common message would be helpful.

Google Set::write on Mma.SE

Google DSolve::dsfun Mma.SE

POSTED BY: Updating Name

You probably accidentally executed h = 0.25 at some point. You also have h[0] = 0.5 in the first line with a single equals, instead of a double ==; the correct form is in the definition of initialCondition a few lines later. Try either Clear[h] or Quit[] to remove the unintended definitions.

When you get more experience with Mathematica, you can often figure this out from the output you got: Each h is replaced with 0.25. That means h has been set equal to 0.25. Sometimes that can happen when you don't mean it. Sometimes you don't even notice that you did it.

POSTED BY: Michael Rogers
Posted 11 months ago

I have just started using it last week. It has a bit confusing. I had no clue you could clear unintended definitions my teacher has not taught us that. Thank you that has helped a lot. Would you happen to know any good resources for the commands like DSolve and Clear?

POSTED BY: Anna Ruffley
Posted 11 months ago

Wolfram-U has a free course on differential equations. You might find it helpful.

POSTED BY: Rohit Namjoshi
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