# How can I resolve the insufficient memory to complete the computation problem for solving function with iterated variables?

I am trying to solve for a value x in a function where the variables varies with iterations of K. Also, there is one variable called "rvsum" which is updated with a certain formula as well. I have created the formula but it shows the error saying insufficient memory to complete the computation.. The code that I am struggling to get the solution is the following:

 rvsum1[1] = 5320007.301;
rvsum1[i + 1] :=
rvsum1[i] + (UT1[[i + 1]]*RA1[[i + 1]] - UT1[[i]]*RA1[[i]])^2;

rp[i]:=((rvsum1[i]+((UT1[[i+1]]+x)*RA1[[i+1]]-UT1[[i]]*RA1[[i]])^2)/MM1[[i]])^(1/2)

Table[x /.
Solve[-4*x* RA1[[K]] +
Sqrt[dt] *
Z[[K]] ((
RA1[[K + 1]] (RA1[[K + 1]]*(x + UT1[[K + 1]]) -
RA1[[K]] *UT1[[K]]))/(
MM1[[K]]*rp[K]))/(4*x*a1[[K]] +
0.5*4*x*4*
x*\L[[K]] - (-4*x* RA1[[K]] +
Sqrt[dt] *
Z[[K]] (
RA1[[K +
1]] (RA1[[K + 1]]*(x + UT1[[K + 1]]) -
RA1[[K]] *UT1[[K]])/(MM1[[
K]]* \[Sqrt](1/
MM1[[K]] (rvsum1[
K] + (RA1[[K + 1]]*(x + UT1[[K + 1]]) -
RA1[[K]] *UT1[[K]])^2)))))) - (MU[[
K + 1]]/(rp[K] - MU[[K + 1]])) == 0, x][[1]], {K, 1, 10}] //
Simplify // N


The values for the double brackets are all already available. I know the code is quite long but this is the only way that I can get my desired result. Is there a way to resolve this insufficient memory to complete the computation since I cannot even get the values that I need? If I am wrong with my code, I may try to fix it, but since it is the matter of insufficient memory to complete the computation issue, I am not even able to do that work at all.. Thank you very much in advance.

• If you post a working self-contained code this might be more amenable to analysis. That way others do not need to guess at values for RA1[[whatever]], or read through the code to figure out dimensions, or what are the variables in need of values. That's asking a lot of ones readers. Sep 15 '14 at 19:51
• Ok. I'll try listening.
– Eric
Sep 15 '14 at 20:53

Ok, here you have it, but in the future this kind of questions will most likely be closed because the main problem arises from very basic errors. You can't expect others do the debugging for you. Take a look at the functions' definitions.

{UT1, RA1, MM1, Z, MU, a1, L} = Transpose[RandomReal[{0, 1}, {10, 7}]];
dt = 1;
rvsum1[1] = 5320007.301;
rvsum1[i_] :=  rvsum1[i - 1] + (UT1[[i]]*RA1[[i]] - UT1[[i - 1]]*RA1[[i - 1]])^2

rp[i_] := ((rvsum1[i] + ((UT1[[i + 1]] + x)*RA1[[i + 1]] - UT1[[i]]*RA1[[i]])^2)/ MM1[[i]])^(1/2)

Table[x /.
FindInstance[-4*x*RA1[[K]] +  Sqrt[dt]* Z[[K]] ((RA1[[K + 1]] (RA1[[K + 1]]*(x + UT1[[K + 1]]) -
RA1[[K]]*UT1[[K]]))/(MM1[[K]]*rp[K]))/(4*x*a1[[K]] + 0.5*4*x*4*x* L[[K]] -
(-4*x*RA1[[K]] + Sqrt[dt]* Z[[K]] (RA1[[K + 1]] (RA1[[K + 1]]*(x + UT1[[K + 1]]) -
RA1[[K]]* UT1[[K]])/(MM1[[K]]*[Sqrt](1/ MM1[[K]] (rvsum1[
K] + (RA1[[K + 1]]*(x + UT1[[K + 1]]) -
RA1[[K]]*UT1[[K]])^2)))))) - (MU[[K + 1]]/(rp[K] - MU[[K + 1]])) == 0, x],
{K, 2, 5}]

(*  {{-0.513926}, {-0.468765}, {-0.328148}, {-1.49684}} *)

• Awesome! However, after I simplified my code using your method like :=, I was able to run my code using Solve function quite well, but I have the following error message..: Solve::verif: Potential solution {x->1.200925058789213380622074066442*10^-11}(possibly discarded by verifier) should be checked by hand. May require use of limits.
– Eric
Sep 15 '14 at 20:51
• Do you know what this type of error says? I have the results but I don't know whether I can ignore this error message and if I can't I wonder what I should do about it. However, thanks a lot!
– Eric
Sep 15 '14 at 20:53
• It probably means that in attempting to validate that solution, Solve noted both a numerator and denominator (approximately) vanishing. So it could not tell whether the solution was legitimate or a parasite. Sep 15 '14 at 22:32
• Ok. Thanks a lot!
– Eric
Sep 15 '14 at 22:50