Ask Your Question
1

How to find second order differential equation from general solution?

asked 2021-03-26 17:33:33 +0200

Presto.creator gravatar image

I've looked everywhere on Sage but I simply cannot find any command that'll help me with this.

It's essentially using desolve, but backwards, like if I'm given

y=C1*e^-x + C2*x*e^-x

how would I figure out the original second order differential equation? Thanks!

edit retag flag offensive close merge delete

Comments

Welcome to Ask Sage! Thank you for your questions!

slelievre gravatar imageslelievre ( 2021-03-26 18:30:39 +0200 )edit

2 Answers

Sort by » oldest newest most voted
1

answered 2021-03-26 18:39:21 +0200

slelievre gravatar image

updated 2021-03-26 18:45:03 +0200

In this case, the function in the question has two parameters, so it describes a vector space of dimension 2 inside the space of functions from ℝ to ℝ.

So we might look for a linear differential equation of order two.

Then for each of the functions $x \mapsto e^{-x}$ and $x \mapsto x e^{-x}$, we can look for linear relations between the function, its derivative, and its second derivative.

See Ask Sage question 56390 about that.

Then we can find a common linear dependence relation that works for both.

That will be the desired differential equation.

For another approach, use power series expansions of the functions and the ore-algebra package, see in particular the guessing module.

edit flag offensive delete link more

Comments

I didn't know my questions were so similar, thank you again! You're a good person

Presto.creator gravatar imagePresto.creator ( 2021-03-26 21:36:31 +0200 )edit
1

answered 2021-03-26 23:55:46 +0200

Juanjo gravatar image

You can derive two times the identity $y=C_1e^{-x} + C_2 x e^{-x}$, take the two derivatives for solving $C_1$ and $C_2$, and then replace these constants in the initial identity, that is:

var("C1, C2")
y = function("y")(x)
f = C1*e^(-x) + C2*x*e^(-x)
sol = solve([diff(y==f,x), diff(y==f,x,2)], C1, C2)
ode = (y-f==0).subs(sol).full_simplify()
show(ode)

The output is

$$y\left(x\right) + 2 \, \frac{\partial}{\partial x}y\left(x\right) + \frac{\partial^{2}}{(\partial x)^{2}}y\left(x\right) = 0$$

You can prettify it by using, for example, the following code inspired by @slelievre's answer to this question, i.e.:

y1 = function("y1", latex_name="y'")(x)
y2 = function("y2", latex_name="y''")(x)
ode_pretty = ode.subs({diff(y(x), x):y1, diff(y(x), x, x): y2})
show(ode_pretty)

which yields

$$y\left(x\right) + 2 \, y'\left(x\right) + y''\left(x\right) = 0$$

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2021-03-26 17:33:33 +0200

Seen: 61 times

Last updated: Mar 26