I
(a) deleted all calls to ev,
(b) removed all calls to ratsimp,
(c) inserted one call to trigreduce,
(d) deleted unused code: EP1:genmatrix(ev(aa),DD,DD); g:2.
I'm guessing that (a) was the most important; I doubt (d) is necessary.
I don't know about (b) and (c). Try not to use 'ev.' I'll let others
comment about the evils of ev.
DD:3;
f(i,j,x,y) := cos(i*(x+y)/2)*sin(j*(x-y)/4);
pp(x) := cos(x)+cos(2*x);
Dint(f,v,a,b) :=
block([FF:integrate(trigreduce(f),v)],subst(b,v,FF)-subst(a,v,FF));
fn(i,j,x,y) := f(i,j,x,y)/sqrt(Dint(Dint(f(i,j,x,y)*f(i,j,x,y),x,-4
*%pi,4*%pi),y,-4*%pi,4*%pi));
wf(i,x,y) := fn(floor(i/4),mod(i,4)+1,x,y);
for i from 0 thru DD do (for j from 0 thru DD do
aa[i,j]:
Dint(Dint(wf(i,x,y)*wf(j,x,y)*(pp(x)+pp(y)),x,-%pi,%pi),y,-%pi,%pi));
(%o1) 3
(%o2) f(i,j,x,y):=cos((i*(x+y))/2)*sin((j*(x-y))/4)
(%o3) pp(x):=cos(x)+cos(2*x)
(%o4)
Dint(f,v,a,b):=block([FF:integrate(trigreduce(f),v)],subst(b,v,FF)-subst(a,v,FF))
(%o5)
fn(i,j,x,y):=f(i,j,x,y)/sqrt(Dint(Dint(f(i,j,x,y)*f(i,j,x,y),x,(-4)*%pi,4*%pi),y,(-4)*%pi,4*%pi))
(%o6) wf(i,x,y):=fn(floor(i/4),mod(i,4)+1,x,y)
(%o7) done
(%i8) aa[0,0];
(%o8) -2/(15*%pi^2)
(%i9) aa[0,1];
(%o9) -256/(3465*%pi^2)
(%i10) aa[0,2];
(%o10) 2/(15*%pi^2)
Barton
-----maxima-bounces at math.utexas.edu wrote: -----
>To: Maxima Mailing List <maxima at math.utexas.edu>
>From: Detlef Schmicker <d.schmicker at physik.de>
>Sent by: maxima-bounces at math.utexas.edu
>Date: 05/02/2007 01:23AM
>Subject: Error message: Too many contexts
>
>Hi,
>
>I have a simple batch program, which causes a to many context error.
>
>DD:3;
>f(i,j,x,y):=cos(i*(x+y)/2)*sin(j*(x-y)/4);
>pp(x):=cos(x)+cos(2*x);
>Dint(f,v,a,b):=block([FF:ratsimp(integrate(f,v))],subst(b,v,FF)-subst(a,v,
>FF));
>fn(i,j,x,y):=ratsimp(f(i,j,x,y)/ev(sqrt(Dint(Dint(f(i,j,x,y)*f(i,j,x,y),x,
>-4*%pi,4*%pi),y,-4*%pi,4*%pi))));
>wf(i,x,y):=fn(floor(i/4),mod(i,4)+1,x,y);
>EP1:genmatrix(ev(aa),DD,DD);
>g:2;
>for i from 0 thru DD do (for j from 0 thru DD do
>aa[i,j]:(Dint(Dint(wf(i,x,y)*wf(j,x,y)*(pp(x)+pp(y)),x,-%pi,%pi),y,-%pi,
>%pi)));
>
>***
>If I remove the second cos from the function pp everything is fine.
>Is there a way to increase the number of contexts? If so, it would be
>great to include this into the error message.
>
>Detlef
>_______________________________________________
>Maxima mailing list
>Maxima at math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima