4
$\begingroup$

Whenever I run the my code, the output of Mathematica is only a copy of the input again.

RSolve[{x[1 + k] == (-(Cos[(k π)/2]/k!) + z[k])/(1 + k), 
y[1 + k] == (1/k! + z[k])/(1 + k), 
z[1 + k] == (x[k] - y[k])/(1 + k), 
x[0] == x0, y[0] == y0, z[0] == z0}, {x[k], y[k], z[k]}, k]

I cannot find what I am doing wrong with my simple code.

$\endgroup$
  • 2
    $\begingroup$ Your "simple code" is not so simple. Mathematica does not know how to solve it. $\endgroup$ – m_goldberg Nov 27 '16 at 17:29
  • $\begingroup$ Do you perhaps know the solution? $\endgroup$ – Mirko Aveta Nov 27 '16 at 17:29
  • $\begingroup$ @MirkoAveta, No,I do not have the solution. $\endgroup$ – Sima Nov 27 '16 at 17:41
  • $\begingroup$ Please. Can you clarify if you mean 1/k! Or (1/k)! ? Also try substitution to grin the argument K alone (Against using 1+k in arguments $\endgroup$ – Jose Enrique Calderon Nov 27 '16 at 17:56
  • $\begingroup$ @JoseECalderon ,Thank you. I have done it, the output is same as before $\endgroup$ – Sima Nov 27 '16 at 18:08
3
$\begingroup$

You can use the first two equations to get an algebraic equation for z[k]:

(* x[k+1] - y[k+1] then compare to third equation *)
zksol = Simplify[(-(Cos[(k π)/2]/k!) + z[k])/(1 + k) - (1/k! + 
   z[k])/(1 + k) /. k -> (k - 2), Assumptions -> {k ∈ Integers}] 
(* -((2 Sin[(k π)/4]^2)/((-1 + k) (-2 + k)!)) *)

Then you can solve a smaller system

{xksol[k_], yksol[k_]} = {x[k], y[k]} /. 
First@RSolve[{x[1 + k] == (-(Cos[(k π)/2]/k!) + zksol)/(1 + k), 
             y[1 + k] == (1/k! + zksol)/(1 + k)}, {x[k], y[k]}, k]
    (* {(2 Cos[1/2 (-1 + k) π] (-3 + k)! - 
  k Cos[1/2 (-1 + k) π] (-3 + k)! - (-1 + k)! + 
  Cos[1/2 (-1 + k) π] (-1 + k)!)/((-2 k + 
    k^2) (-3 + k)! (-1 + k)!), (-2 (-3 + k)! + 
  k (-3 + k)! - (-1 + k)! + 
  Cos[1/2 (-1 + k) π] (-1 + k)!)/((-2 k + 
    k^2) (-3 + k)! (-1 + k)!)} *)

Check:

Simplify[{x[1 + k] == (-(Cos[(k π)/2]/k!) + z[k])/(1 + k), 
         y[1 + k] == (1/k! + z[k])/(1 + k)} /. 
         {x[p_] -> xksol[p], y[p_] -> yksol[p], z[k] -> zksol}]
(* {True, True} *)

Notice there is no freedom left for initial conditions.

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