How to prevent evaluation.



%if is a simplifying function. Thus for the input %if(i < 0, expand((x
+1)^2), expand((x-1)^2)),
expand is called *before* the simplification function for %if (simp-%if) is
called. Maybe you can do
what you want by quoting? Example:

 (%i1) load(to_poly_solver)$

Define a function

 (%i22) f(i,x) := %if(i < 0, 'expand((x+1)^2), 'expand((x-1)^2));
 (%o22) f(i,x):=%if(i<0,expand((x+1)^2),expand((x-1)^2))

Expand isn't called:

 (%i23) f(k,s);
 (%o23) %if(-k>0,expand((s+1)^2),expand((s-1)^2))

Expand still isn't called :(

 (%i24) f(10,z);
 (%o24) expand((z-1)^2)

To expand, we need to ev(%, nouns):

 (%i25) ev(%,nouns);
 (%o25) z^2-2*z+1

Barton

-----"Richard Hennessy" <rich.hennessy at verizon.net> wrote: -----

>To:?"Barton?Willis"?<willisb at unk.edu>,?"Richard?Fateman"
><fateman at cs.berkeley.edu>
>From:?"Richard?Hennessy"?<rich.hennessy at verizon.net>
>Date:?12/27/2009?09:31PM
>cc:?"Maxima?List"?<maxima at math.utexas.edu>
>Subject:?Re:?[Maxima]?How?to?prevent?evaluation.
>
>Thanks?for?the?feedback.??I?don't?know?if?%if?can?be?changed?the?way?I
>want.??I?would?need?to?know?a?lot?more?about
>Maxima?.?.?.
>
>Rich