> I'm wondering if there if it is possible to make Maxima neglect small
> terms from a sum based on their numerical values and a factor value
> that tells the function when it is ok to neglect a term ?
Here is some code to do that, though I'm not sure I see the point:
threshsum(expr,vals,factor):=
/* if expr not a sum, just return it */
if atom(expr) or part(expr,0)#"+" then expr
else
block([prederror:false, /* keep terms of unknown magnitude */
symterms: args(expr), /* symbolic terms */
evterms, /* evaluated terms */
minterm], /* minimum term to keep */
evterms: makelist(abs(float(subst(vals,term))),term,symterms),
/* evaluate each term with given values */
minterm: apply('max,evterms)/factor,
apply("+",
map( lambda([symterm,evterm],
if is(evterm<minterm)=true
then (if debugmode then print("Excluding term
",symterm=evterm),
0)
else symterm),
symterms,
evterms )));
Examples:
threshsum(a+b+a*b,[a=1e-2,b=1e-4],1e3);
Excluding term a b = 1.0E-6
b + a
You can also use this with assume:
assume(a>0,a<.1, b>100)$
threshsum(a+b+a*b,[],10);
Excluding term a b = a b
b + a
But unfortunately Maxima's symbolic comparison subsystem isn't very
powerful:
is(a<=max(a,b)) => unknown
assume(a>1,b>1)$
is(a*b>1) => unknown
assume(x>0,x<1/2)$
is(x^3<1/2) => unknown
so this is of limited usefulness.
----------------------
But perhaps what you really want is taylor expansions? Look at the
documentation: describve(taylor).
-s