Ask Your Question
0

Infinite initial conditions in ODE and arbitrary constant

asked 2017-02-09 02:37:45 +0100

this post is marked as community wiki

This post is a wiki. Anyone with karma >750 is welcome to improve it.

Is it possible to include infinite initial conditions in an ODE? For example,

ode_soln = desolve(ode, q, ics[0, -Infity])

throws and error.

Alternatively, I can leave the initial condition blank:

ode_soln = desolve(ode, q)
soln = solve(ode_soln, q)
show(soln[0])

Then output Includes an arbitrary constant written C $$ q\left(t\right) = -\frac{p}{C {\left(p + 1\right)} + {\left(p + 1\right)} t} $$

I tried to set a value for $C$ via,

show(soln[0].substitute(C = 0))

but it made no difference. Here $p$ I declared as a variable, and I can do things like

show(soln[0].substitute(p = 1))

to produce the expected output

$$ q\left(t\right) = -\frac{1}{2 {\left(C + t\right)}} $$

So it seems that I need to refer to the arbitrary constant by some other name than $C$. How can I do this?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2017-02-09 12:43:50 +0100

eric_g gravatar image

The answer to your second question (substituting for $C$) is

soln[0].substitute({SR.var('_C'): 0})

This is because constants that appear in solutions of ODEs, like _C (which is displayed as $C$), are not put in the global namespace, hence they have to be recovered from their names in the Symbolic Ring (SR) by SR.var('_C').

edit flag offensive delete link more

Comments

Excellent. That does the job, thank you.

Paul Bryan gravatar imagePaul Bryan ( 2017-09-07 13:42:11 +0100 )edit

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: 2017-02-09 02:37:45 +0100

Seen: 369 times

Last updated: Feb 09 '17