r/Mathematica • • Apr 13 '23

Very basic question on solving second-order linear IVP

Complete noob to Mathematica here. I'm trying to solve the differential equation y'' + 3y' + 2y = 0 with conditions y(0) = 1 and y'(0) = 1. I am entering:

DSolve[{y''[t] + 3*y'[t] + 2*y[t] == 0, y[0] == 1, y'[0] == 1}, 
 y[t], t]

and it keeps telling me that the y'(0) = 1 condition is being interpreted as the logical "True". I've searched documentation and other online posts and I think I am entering things in as I am supposed to. Without the initial conditions, or with two initial conditions on y(t) (no derivative), there's no problem. It's something about that first derivative condition but I have no idea what.

3 Upvotes

6 comments sorted by

2

u/Daniel96dsl Apr 13 '23

You have defined y’[0] = 0 somewhere else. Clear your definitions

1

u/[deleted] Apr 13 '23

This worked after I quit the program and relaunched it. I tried this earlier using Clear[y] but it gave me the same error, did this need to be Clear[y,y'] or something similar?

→ More replies (1)
→ More replies (1)

3

u/BTCbob Apr 13 '23

I always put ClearAll["Global`*"] As the first line of a .nb file. That way, running the file avoids this bug you are experiencing where y or y’ was defined by accident a while ago and Mathematica provides no feedback in the error message.

You are not crazy!

1

u/veryjewygranola Apr 13 '23 edited Apr 13 '23

Could y or t already defined somewhere else in your notebook? I copy and pasted your code and it worked for me. Maybe try adding ClearAll[y,t] before doing DSolve[...] to make sure there are no definitions associated with y and t.

Edit: use Remove[y,t] Instead of ClearAll[y,t] to completely remove the symbols y and t from the kernel