3
$\begingroup$

I would like to solve the following equation $y^2=x^2+ax^2y^2+by^2x^3+cy^3x^2$ where $a,b,c$ are small, so $y\approx x+O(x^3)$. I would like to have a series approximation of the solution rather than an exact one, i.e. like $y=x+c_1x^3+c_2x^4+...$.

Is there a default function in mathematica that does that?

$\endgroup$
4
$\begingroup$

Quick-and-dirty solution:

y^2 - (x^2 + a x^2 y^2 + b y^2 x^3 + c y^3 x^2) /. 
       y -> x + c1 x^2 + c2 x^3 + c3 x^4 + O[x]^5 // FullSimplify
Solve[% == 0, {c1, c2, c3}]
y -> x + c1 x^2 + c2 x^3 + c3 x^4 + O[x]^5 /. % // TeXForm

$$y\to x+\frac{a x^3}{2}+\frac{1}{2} (b+c) x^4+O\left(x^5\right)$$

Compare to the exact solution:

FullSimplify[
    Series[
        Solve[y^2 - (x^2 + a x^2 y^2 + b y^2 x^3 + c y^3 x^2) == 0, y][[3, 1, 2]]
    , {x, 0, 4}],
c > 0
]
$\endgroup$
2
  • $\begingroup$ thanks a lot! I'm new to mathematica, would you briefly explain to me the difference between your two methods? and what does the [3,1,2] mean? $\endgroup$
    – Shadumu
    Nov 4 '18 at 20:59
  • $\begingroup$ [[3,1,2]] accesses a nested list. On the first level the 3rd element, on the next level the 1st element and and the 3rd level the 2nd element. In C++ it would look like this: x[3][1][2] $\endgroup$ Nov 5 '18 at 10:15
5
$\begingroup$

Could use implicit differentiation, solve for all derivatives at x==0.

ee = y^2 - (x^2 + a x^2 y^2 + b y^2 x^3 + c y^3 x^2) /. y -> y[x];
dpolys = Table[D[ee, {x, j}], {j, 0, 5}] /. x -> 0

(* {y[0]^2, 2*y[0]*Derivative[1][y][0], -2 - 2*a*y[0]^2 - 2*c*y[0]^3 + 
     2*Derivative[1][y][0]^2 + 2*y[0]*Derivative[2][y][0], 
   -6*b*y[0]^2 - 12*a*y[0]*Derivative[1][y][0] - 
  18*c*y[0]^2*Derivative[1][y][0] + 
     6*Derivative[1][y][0]*Derivative[2][y][0] + 
  2*y[0]*Derivative[3][y][0], 
   -48*b*y[0]*Derivative[1][y][0] + 6*Derivative[2][y][0]^2 - 
     12*a*(2*Derivative[1][y][0]^2 + 2*y[0]*Derivative[2][y][0]) - 
     12*c*(6*y[0]*Derivative[1][y][0]^2 + 
     3*y[0]^2*Derivative[2][y][0]) + 
     8*Derivative[1][y][0]*Derivative[3][y][0] + 
  2*y[0]*Derivative[4][y][0], 
   -60*b*(2*Derivative[1][y][0]^2 + 2*y[0]*Derivative[2][y][0]) + 
     20*Derivative[2][y][0]*Derivative[3][y][0] - 
     20*a*(6*Derivative[1][y][0]*Derivative[2][y][0] + 
          2*y[0]*Derivative[3][y][0]) - 
  20*c*(6*Derivative[1][y][0]^3 + 
          18*y[0]*Derivative[1][y][0]*Derivative[2][y][0] + 
          3*y[0]^2*Derivative[3][y][0]) + 
  10*Derivative[1][y][0]*Derivative[4][y][0] + 
     2*y[0]*Derivative[5][y][0]} *)

soln = Solve[dpolys == 0]

(* Out[139]= {{y[0] -> 0, Derivative[1][y][0] -> -1, 
  Derivative[2][y][0] -> 0, 
     Derivative[3][y][0] -> -3*a, Derivative[4][y][0] -> 12*(-b + c)}, 
   {y[0] -> 0, Derivative[1][y][0] -> 1, Derivative[2][y][0] -> 0, 
     Derivative[3][y][0] -> 3*a, Derivative[4][y][0] -> 12*(b + c)}} *)

So two solutions, both getting up to the fourth order term. We create a table, then use the solutions to fill in values and recast as a Taylor polynomial for each solution branch.

derivs = Table[D[y[x], {x, j}], {j, 0, 4}] /. x -> 0;
derivs.(x^Range[0, 4]/Factorial[Range[0, 4]]) /. soln

(* Out[142]= {-x - (a x^3)/2 + 1/2 (-b + c) x^4, 
 x + (a x^3)/2 + 1/2 (b + c) x^4} *)
$\endgroup$
4
$\begingroup$

Substitute $y=xu$ to handle the node at the origin, differentiate and use AsymptoticDSolveValue:

x * AsymptoticDSolveValue[{
    D[y^2 == (x^2 + a x^2 y^2 + b y^2 x^3 + c y^3 x^2) /. 
       y -> x * u[x] // Simplify[#, x != 0] &, x],
    u[0] == 1}, u[x], {x, 0, 3}] // Collect[#, x] &

$$x+ \frac{a x^3}{2}+\frac{1}{2} x^4 (b+c)$$

$\endgroup$
1
$\begingroup$

The new in M12 function AsymptoticSolve can be used to find the series:

AsymptoticSolve[y^2 == x^2 + a x^2 y^2 + b y^2 x^3 + c y^3 x^2, {y, 0}, {x, 0, 4}]

{{y -> -x - (a x^3)/2 + 1/2 (-b + c) x^4}, {y -> x + (a x^3)/2 + 1/2 (b + c) x^4}}

$\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.