Re: help with "no more memory" at mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg91053] Re: help with "no more memory" at mathematica
- From: David Bailey <dave at Remove_Thisdbailey.co.uk>
- Date: Mon, 4 Aug 2008 03:27:06 -0400 (EDT)
- References: <g73u1c$nhd$1@smc.vnet.net>
lopmart wrote:
> we have the next code in mathematica 6, when we use n = 200 we get
> the next error
>
>
> h = Import["h.dat"]; v = Import["v.dat"];
> n = 200
>
>
> MSE2 =
> Sum[(a[i - 1, j] - v[[i, j]] a[i, j])^2 + (a[i, j - 1] -
> h[[i, j]] a[i, j])^2, {i, 2, n}, {j, 2, n}] +
> Sum[(a[1, j - 1] - h[[1, j]] a[1, j])^2, {j, 2, n}] +
> Sum[(a[i - 1, 1] - v[[i, 1]] a[i, 1])^2, {i, 2, n}];
>
> s1 = Table[Simplify[D[MSE2, a[Floor[i/n] + 1, Mod[i, n] + 1]]], {i,
> 1, (n*n) - 1}];
>
> s3 = SparseArray[
> Table[Simplify[D[s1, a[Floor[i/n] + 1, Mod[i, n] + 1]]], {i,
> 1, (n*n) - 1}]];
> ar = ArrayRules[s3];
> Export["matrix1.txt", ar];
>
> b = SparseArray[Table[Simplify[-1*D[s1, a[1, 1]]]]];
> b2 = ArrayRules[b];["B.txt", b2];
>
>
> No more memory available.
> Mathematica kernel has shut down.
> Try quitting other applications and then retry.
>
> How to solve?
>
> thanks
>
You have not told us what is in the array 'a', or indeed in the two
files the you import, so it is hard to answer this specifically.
However, I would start by adding Print statements between each part of
the calculation to see where this error happens. I suspect 'a' contains
symbolic expressions and you are creating some horrendously complicated
expressions that are using up the memory (it is awfully easy to do this
with any symbolic algebra system).
It might also help to describe what your code is meant to do.
David Bailey
http://www.dbaileyconsultancy.co.uk