0
$\begingroup$

I am planning to solve this ode numerically by ode45 in MATLAB. But there is an integral and as the $ y $ parameter is not calculated, I can not calculate the integral and it is not possible to solve this differential equation.

$$ \frac{d^2y}{dt^2}+\left(1-\exp\left[{{-0.5y^2+\int_{0}^{1}\frac{y^2}{2}dt}}\right]\right)y=0$$

I would be appreciated it if you could help me how to solve it in MATLAB numerically.

Regards

$\endgroup$
  • 1
    $\begingroup$ @Nima : What are the initial and/or boundary conditions ? $\endgroup$ – JJacquelin Apr 18 '18 at 16:00
  • $\begingroup$ assume that y(0)=y0, y′(0)=v0 are given. $\endgroup$ – Nima Apr 18 '18 at 18:25
0
$\begingroup$

I would suggest the following procedure. Since $\int_0^1(y^2/2)\,dt$ is a positive number, look at the equation $$ y''+\bigl(1-\lambda\,e^{-y^2/2}\bigr)y=0,\quad\lambda>0. $$ Solve it (with the appropriate initial and/or boundary conditions) for an initial value of $\lambda$, let $y_\lambda$ be its solution and let $e=\int_0^1(y_\lambda^2/2)\,dt-\lambda$. If $e=0$, you have found the solution. If not, change the value of $\lambda$. At first you do not know wether $\lambda$ has to increase or decrease to make $e$ smaller, but you can guess it after the second calculation. Keep doing this until you get $e=0$. This can be probably automated, but I do not know how.

$\endgroup$
1
$\begingroup$

This is a slightly more systematic perspective on the same idea that was stated in the other answers. I assume that $y(0)=y_0,y'(0)=v_0$ are given. (Other boundary conditions can be handled too, but the method will be somewhat different.) Define $y_p$ to be the solution to the ODE IVP

$$y_p''+(1-pe^{-0.5y^2})y_p,y_p(0)=y_0,y_p'(0)=v_0.$$

Here $p$ is a real parameter. We need $p \geq 1$ because it stands in for $\exp \left ( \int_0^1 \frac{y(t)^2}{2} dt \right )$. But otherwise we don't know anything about it.

For a given $p$, $y_p$ is now well-defined on $[0,1]$. More importantly, we have a way to numerically compute it (e.g. ode45). Thus we can define $F(p)=\exp \left ( \int_0^1 \frac{y_p(t)^2}{2} dt \right )$, and ask that $p=F(p)$. This is now an algebraic equation for $p$. We can solve it using one of the standard root finding methods for scalar equations. If I were implementing it from scratch, I would suggest the secant method, but in MATLAB you can use fsolve or fzero instead.

This is a variation on the shooting method, which is usually used for ODE BVPs. The idea of the shooting method is to introduce a free parameter whose true value is part of the solution, but which if we knew it, we could solve the problem by simply solving an ODE IVP. In order to introduce this free parameter, we must relax one of our other requirements. Then we solve an ODE IVP for a particular value of the parameter, and violate whichever requirement we relaxed. Then we change the parameter until the requirement is not violated by too much.

$\endgroup$
0
$\begingroup$

Fixing $\lambda = \lambda_k$ compute

$$ \frac{d^2 y_k}{dt^2}+(1-\lambda_ke^{-0.5y_k^2})y_k = 0 $$

Solve then

$$ \lambda_{k+1} = e^{\int_0^1 y_k^2 dt} $$

with successive loops in the hope to find a fixed point. Note that $\lambda_k > 0$

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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