4
$\begingroup$

I want to figure out $x(u)$ and $y(v)$ by solving differential equations. $v(u)$ is a function of $u$ and I want $y(v)$ expressed by $v$. I'm trying this using DSolve.

Hereis a simple example that unfortunately produces an error:

v = 1/u;
DSolve[{y[v] == -x'[u], x[u] == y'[v]}, {y[v], x[u]}, u]

DSolve::litarg: To avoid possible ambiguity, the arguments of the dependent variable in y[1/u] should literally match the independent variables.

I can solve this simple example by hand, but the equation I want to solve is too complicated.

How can I solve this?

$\endgroup$
7
$\begingroup$

DSolve requires the arguments of the unknown functions being sought to be the same variables. Set z[u] == y[1/u] and differentiate to figure out you have to substitute z[u] for y[v] and u^2 z'[u] for y'[v]. There is a function DChange for making such substitutions, which might be useful in your more complicated use-case. In simple cases, I just use calculus by hand:

D[z[u] == y[1/u], u]
(*  z[u] == -(y'[1/u]/u^2)  *)

DSolve[{z[u] == -x'[u], x[u] == u^2 z'[u]}, {z, x}, u];
sol = {y -> Function @@ {u, Simplify[z[1/u] /. First@%]}, x -> (x /. First@%)}
(*
{y -> Function[u, 
   1/(2 Sqrt[1/
     u]) (-(C[1] + Sqrt[3] C[2]) Cos[
        1/2 Sqrt[3] Log[1/u]] + (Sqrt[3] C[1] - C[2]) Sin[
        1/2 Sqrt[3] Log[1/u]])], 
 x -> Function[{u}, 
   Sqrt[u] C[1] Cos[1/2 Sqrt[3] Log[u]] + 
    Sqrt[u] C[2] Sin[1/2 Sqrt[3] Log[u]]]}
*)

Slightly more general processing of the solution, in case DSolve returns more than one solution (for a nonlinear system).

DSolve[{z[u] == -x'[u], x[u] == u^2 z'[u]}, {z, x}, u];
sol = {y -> Inactive[Function][u, z[1/u]], Inactive[Symbol]["x"] -> x} /. % //
    Simplify[#, u > 0] & // Activate
(*
{{y -> Function[u, 
    1/2 Sqrt[u] (-(C[1] + Sqrt[3] C[2]) Cos[
         1/2 Sqrt[3] Log[u]] + (-Sqrt[3] C[1] + C[2]) Sin[
         1/2 Sqrt[3] Log[u]])], 
  x -> Function[{u}, 
    Sqrt[u] C[1] Cos[1/2 Sqrt[3] Log[u]] + 
     Sqrt[u] C[2] Sin[1/2 Sqrt[3] Log[u]]]}}
*)
| improve this answer | |
$\endgroup$
0
$\begingroup$

Another way

Clear[x, y, yy, u, v]

v = 1/u

de1 = y[v] == -x'[u]

And convert the differential equation.

de11 = de1 /. {y -> (yy[1/#] &)}
(*yy[u] == -x'[u]*)

de2 = x[u] == y'[v]

and convert

de22 = de2 /. {y -> (yy[1/#] &)}
(*x[u] == -u^2 yy'[u]*)

sol = DSolve[{de11, de22}, {yy[u], x[u]}, u] // Flatten // FullSimplify
(*{x[u] -> u^(1/2 - Sqrt[5]/2) (C[2] u^Sqrt[5] + C[1]), 
 yy[u] -> 1/2 u^( 1/2 (-1 - Sqrt[5])) ((Sqrt[5] - 1) C[1] - (1 + Sqrt[5]) C[2] u^Sqrt[5])}*)

x[u_] = (x[u] /. sol)

yy[u_] = yy[u] /. sol

y[u_] = yy[1/u]

Check the results. For the converted diff eq with x and yy

de11 // Simplify
(*True*)

de22 // Simplify
(*True*)

And the original unconverted differential equations with x andy

de1 // Simplify
(*True*)

de2 // Simplify
(*True*)

FWIW the solution by Michael E2 also satisfies de1 and de2 showing the form of solution can vary widely depending on the method used.

| improve this answer | |
$\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.