Processing math: 100%
Ask Your Question
1

How to find second order differential equation from general solution?

asked 4 years ago

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!

Preview: (hide)

Comments

Welcome to Ask Sage! Thank you for your questions!

slelievre gravatar imageslelievre ( 4 years ago )

2 Answers

Sort by » oldest newest most voted
1

answered 4 years ago

Juanjo gravatar image

You can derive two times the identity y=C1ex+C2xex, take the two derivatives for solving C1 and C2, 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(x)+2xy(x)+2(x)2y(x)=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(x)+2y(x)+y(x)=0

Preview: (hide)
link
1

answered 4 years ago

slelievre gravatar image

updated 4 years ago

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 xex and xxex, 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.

Preview: (hide)
link

Comments

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

Presto.creator gravatar imagePresto.creator ( 4 years ago )

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: 4 years ago

Seen: 396 times

Last updated: Mar 26 '21