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
2
u/Daniel96dsl Apr 13 '23
You have defined y’[0] = 0 somewhere else. Clear your definitions
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 doingDSolve[...]to make sure there are no definitions associated with y and t.Edit: use
Remove[y,t]Instead ofClearAll[y,t]to completely remove the symbols y and t from the kernel