Matlab code for finding exact solution

440 Views Asked by At

I am trying to find an exact solution to this problem $$y''=\frac18(32+2x^3-yy')$$ and I get "Warning: Unable to find symbolic solution."

What is my mistake?

% define symbolic variables
syms y(x)
eqn = diff(y,2) == (1/8)*(32+(2*x^3)-y*diff(y))
% Solution without initial conditions
sol = dsolve(eqn)
% Define initial conditions
conds = [y(1) == 17, y(3) == 43/3]
% Get solution with initial conditions
sol_conds = dsolve(eqn, conds)
3

There are 3 best solutions below

5
On BEST ANSWER

You should try your code to solve the differential equation: $$y''=-\frac18 yy'$$

  eqn = diff(y,2) == -(1/8)*y*diff(y))

Because if you integrate the original DE you get Riccati's differential equation and most of the time it can't be integrated as Lutz Lehmann has pointed in the comment.

0
On

The code looks fine. But there is no guarantee that a symbolic solution exists with the functions and solution methods coded into Matlab.

You can comment out the lines asking for a symbolic solution and have Matlab solve just the problem with the initial conditions. If your code is good, you should get a (numerically determined) solution.

0
On

The ODE to be solved is

$$y''(x) -\frac{1}{8} \left(2 x^3+32-y(x) y'(x)\right)=0\tag{1}$$

Integrating once gives the first integral

$$y'(x) - \frac{x^4}{16}-4x+\frac{y(x)^2}{16} = c\tag{2}$$

where $c$ is an arbitrary constant.

Just to give you an impression here is the solution for the initial conditions $y(0)=y'(y)=0$ obtained by Mathematica from integrating the first integral with $c=0$

$$f(x) = \frac{1}{x}\left(16+x^3+\frac{384}{e^{\frac{x^3}{24}} x \left(x^2 E_{\frac{1}{3}}\left(\frac{x^3}{24}\right)-4\ 3^{2/3} \Gamma \left(\frac{2}{3}\right)\right)-24}\right)\tag{3}$$

Here $E_{a}(z)$ is the exponential integral function and $\Gamma(z)$ is the Euler gamma function.

An approximation with a relative error of less than 6.5% is

$$f(x) \simeq x^2\left(\frac{ x^3+32}{x^3+16}\right)\tag{4}$$