# Mathematica 8.0 - solve two recursive relations

by EigenCake
Tags: mathematica, recursive, relations, solve
 P: 13 Wow, Bill, you are amazing! So far as I know, there is a mistake on your code On you code: y[n_,x_]:=y[0,x]Integrate[1/y[0,t]^2,{t,0,x}] Integrate[y[0,s](w[s]y[n-1,s]-Sum[e[j]y[n-j,s],{j,1,n}]), {s,-Infinity,t}]; Because the upper bound of the integral "ds" is "t", so the integral "dt" includes the integration over "ds", which means here is to evaluate a double integral, instead of evaluating two separate and independent integrals. So I think it must be: y[n_,x_]:=y[0,x]Integrate[(1/y[0,t]^2)*Integrate[y[0,s](w[s]y[n-1,s]-Sum[e[j]y[n-j,s],{j,1,n}]), {s,-Infinity,t}], {t, 0, x}]; I don't know whether the modified code I gave to you will give correct answer or not, because until now I do NOT know how to run your code on my computer properly. Whatever, if the above code does not give the correct answer, which is: y1 = (-((3*x^2)/8) - x^4/16)/E^(x^2/4) then the code is wrong. Before I post my message, I wrote the following code to calculate y1, by properly setting value for y0[t], then the following code: y1[x_] == y0[x]*Integrate[(1/((y0[t])^2))*Integrate[y0[s]*((s^4/4)*y0[s] - (3/4)*y0[s]), {s, -Infinity, t}], {t, 0, x}] gives Output: (1/8 E^(-(x^2/ 4)) (-3 + x^4) (\[Pi] Erfi[x/Sqrt[2]] + x^2 HypergeometricPFQ[{1, 1}, {3/2, 2}, x^2/2]))[x_] == E^(-(x^2/4)) (-((3 x^2)/8) - x^4/16) By observing this Output, the last part E^(-(x^2/4)) (-((3 x^2)/8) - x^4/16) is the right answer, but I don't know why Mathematica also give an expression about HypergeometricPFQ, which is not only useless but also ruins the result to calculating E2, so that E2 is just a piece of mess! If use y1 = (-((3*x^2)/8) - x^4/16)/E^(x^2/4) to calculate E2, then E2 = -21/8. The correct answer for the first four E's are: E0 = 1/2; E1 = 3/4; E2 = -21/8; E3 = 333/16; If any code does give output E's like those, then something must be wrong in the code. Okay, now I need to figure out a way to run your code on my computer. Could you correct that mistake on your code please? After correction, I wanna know whether your code is able to give right answer or not. Thank you so much, Bill!
 P: 13 Mathematica 8.0 - solve two recursive relations Now I know how to run your code on my computer in[1] := e[0] = 1/2; y[0, x_] := Exp[-(x^2/4)]; w[x_] := x^4/4; e[n_] := Integrate[ y[0, x] (w[x] y[n - 1, x] - Evaluate[Sum[e[j] y[n - j, x], {j, 1, n - 1}]]), {x, -Infinity, Infinity}]/Integrate[y[0, x]^2, {x, -Infinity, Infinity}]; y[n_, x_] := y[0, x] Integrate[(1/y[0, t]^2)* Integrate[ y[0, s] (w[s] y[n - 1, s] - Evaluate[Sum[e[j] y[n - j, s], {j, 1, n}]]), {s, -Infinity, t}], {t, 0, x}] ; This code gives correct answers for all four E's mentioned on my last message. So I believe that the code is able to give correct answer to all E's. However, the computation is so slow that I have to wait for 10 minutes in order to have the answer E5 = 916731/256, and my computer is half-freezed. This is slower than what I expected. So I have to find another way to find E200, instead of using the recursive relations. Nonetheless, the problem on the main message is solved, and the code is quite neat! Thank you a lot, Bill! I highly appreciate your help! You're amazing! :)