How to set eps^n =0 for all n>= 10 where eps is a symbolic variable.
Here is some Reduce code for an perturbation calculation:
1 factor eps;
2 x:=-1;
3 let eps^10=>0;
4 for iter:=1:2 do begin
5 write res:=x^2+x-eps;
6 write x:=x+a*res;
7 end;
and corresponding Mathematica code:
1 Clear[x,res,eps]
2 eps^n_ ^:=0 /; n>6;
3 x=-1;
4 While[res=!=0,
5 res=x^2+x-eps // Simplify;
6 x=Expand[x+res];
7 Print[x]
8 ];
I would like to know how to do line 3 in the Reduce code that sets all powers of eps^10 or greater equal to zero. The Mathematica code on line 2 does the same. I thought I could get subsex to do this but I can not figure out how to make say eps^12 =0 if eps^10=0, ie. obey the algebraic rules for powers like reduce does: eps^12 = eps^10 eps^2 = 0 since we let eps^10=0. I think maple’s function algsubs might be able to do this.Here is some Reduce code for an perturbation calculation:
1 factor eps;
2 x:=-1;
3 let eps^10=>0;
4 for iter:=1:2 do begin
5 write res:=x^2+x-eps;
6 write x:=x+a*res;
7 end;
and corresponding Mathematica code:
1 Clear[x,res,eps]
2 eps^n_ ^:=0 /; n>6;
3 x=-1;
4 While[res=!=0,
5 res=x^2+x-eps // Simplify;
6 x=Expand[x+res];
7 Print[x]
8 ];
I would like to know how to do line 3 in the Reduce code that sets all powers of eps^10 or greater equal to zero. The Mathematica code on line 2 does the same. I thought I could get subsex to do this but I can not figure out how to make say eps^12 =0 if eps^10=0, ie. obey the algebraic rules for powers like reduce does: eps^12 = eps^10 eps^2 = 0 since we let eps^10=0. I think maple’s function algsubs might be able to do this. Here is some Reduce code for an perturbation calculation:
1 factor eps;
2 x:=-1;
3 let eps^10=>0;
4 for iter:=1:2 do begin
5 write res:=x^2+x-eps;
6 write x:=x+a*res;
7 end;
and corresponding Mathematica code:
1 Clear[x,res,eps]
2 eps^n_ ^:=0 /; n>6;
3 x=-1;
4 While[res=!=0,
5 res=x^2+x-eps // Simplify;
6 x=Expand[x+res];
7 Print[x]
8 ];
I would like to know how to do line 3 in the Reduce code that sets all powers of eps^10 or greater equal to zero. The Mathematica code on line 2 does the same. I thought I could get subsex to do this but I can not figure out how to make say eps^12 =0 if eps^10=0, ie. obey the algebraic rules for powers like reduce does: eps^12 = eps^10 eps^2 = 0 since we let eps^10=0. I think maple’s function algsubs might be able to do this. algsubs, subsex MATLAB Answers — New Questions