1
$\begingroup$

Assuming that I have a ODE system with undetermined parameter $$x''(t) == y(t) x(t)$$ $$y'(t) == 2 - a x(t)$$

and I have some fixed solution condition $$x(0)=0$$ $$x(10)=8$$ $$y(10)=3.5$$

Is there a way to determine the parameter a, I tried to solve this ODEs with both NDSolve and DSolve, but it seems not to work.

 NDSolve[{x''[t] == y[t] x[t], y'[t] == 2 - a x[t], x[0] == 0, 
  x[10] == 8, y[10] == 3.5}, {x, y}, t]

the output is

NDSolve::ndnum: Encountered non-numerical value for a derivative at t == 0.`.

can somebody help me? Thank you very much.

$\endgroup$
4
  • 3
    $\begingroup$ In order to determine a you need one more condition. Three conditions are required to solve the differential equations for a particular parameter, since you've got (effectively) a third-order ordinary differential equation. $\endgroup$
    – march
    Sep 4, 2015 at 2:39
  • $\begingroup$ Hi, @march thank you very much, I have tried to add another condition, such as $y(0)=2.5$. However, the same problem still exist. $\endgroup$
    – Zihu Guo
    Sep 4, 2015 at 7:48
  • $\begingroup$ @ZihuGuo Do u have any conditions on the parameter "a"? $\endgroup$
    – thils
    Sep 4, 2015 at 8:02
  • $\begingroup$ @thils a is a real number $\endgroup$
    – Zihu Guo
    Sep 4, 2015 at 8:15

2 Answers 2

2
$\begingroup$

As a first step:

sol = ParametricNDSolve[{x''[t] == y[t] x[t], y'[t] == 2 - a x[t], 
   x[0] == 0, x[10] == 8, y[10] == 3.5}, {x, y}, {t, 0, 10}, {a}]

For example a = 1, you can plot

 {Plot[x[a][t] /. a -> 1 /. sol, {t, 0, 10}], 
 Plot[y[a][t] /. a -> 1 /. sol, {t, 0, 10}]}

enter image description here

To determine a, the following plots can help:

Plot[Evaluate[Table[y[a][t] /. sol, {a, -1, 1}]], {t, 0, 10}, 
 PlotRange -> All, PlotLegends -> Automatic]

enter image description here

Plot[Evaluate[Table[x[a][t] /. sol, {a, -1, 1}]], {t, 0, 10}, 
 PlotRange -> All, PlotLegends -> Automatic]

enter image description here

If you are playing with the value a then verify the bcs and ics! You never get y[0]==2.5

$\endgroup$
3
  • $\begingroup$ , Thank you very much, it is fantastic. But I am afraid it is not a general method. In this example, I just have one parameter a to determine. However, I probably have several parameters to determine in my real problem. $\endgroup$
    – Zihu Guo
    Sep 4, 2015 at 13:44
  • $\begingroup$ @Zihu Guo ParametricNDSolve can work with many Parameters. With the plots you can easily ascertain, if the conditions are complied. $\endgroup$
    – user31001
    Sep 4, 2015 at 13:58
  • $\begingroup$ thank you very much, I will try this on my problem. $\endgroup$
    – Zihu Guo
    Sep 4, 2015 at 14:20
2
$\begingroup$

As an extension to the Answer by Willinski, only limited ranges of a are consistent with the boundary conditions in the Question. So, for instance,

Plot[x[a][10] /. s, {a, -3, 1}]

generates

enter image description here

along with a number of error messages. Consistent with this figure, Willinsi's plots show that a == -1 and a == 0 satisfy the boundary condition x[10] == 8, but a == 1 does not. Warning: Some details of my figure may be incorrect, because Plot samples the function only at a discrete number of points.

Within the wide range for which the figure above shows x[10] == 8 to be satisfied, it is straightforward to obtain y[0], for instance, as a function of a.

ParametricPlot[{a, y[a][0] /. s}, {a, -2.9, -0.6}, AxesLabel -> {"a", "y[0]"}]

enter image description here

One might hope that a could be computed for a particular value of y[0] using the method described in Boundary Value Problems with Parameters.

ss = NDSolve[{x''[t] == y[t] x[t], y'[t] == 2 - a[t] x[t], a'[t] == 0,
    x[0] == 0, x[10] == 8, y[0] == -24, y[10] == 3.5}, {x, y, a}, t]

Unfortunately, this procedure does not work here, generating error message and an answer that does not satisfy the boundary conditions.

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.