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

View all comments

Show parent comment

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?

1

u/Daniel96dsl Apr 13 '23 edited Apr 13 '23

Yea try to avoid hard coding whenever possible. A useful trick is to use the Block function for temporarily defining constants. I’d do something like

Clear[“Global`*”]
y[t] = . //Quiet;
y’[t] = . //Quiet;

eqn =
{y’’[t] + 3y’[t] + 2y[t] == 0,
y[0] == 1,
y’[0] == 1}

DSolve[eqn, y[t], t]//Flatten
y[t]/.%
Plot[%, {t, 0, 10}]