Jallo!
Another question, is there a way to compare outputs of
reveal function?
namely, i want to compare
reveal(-a*b,1)
and
reveal(-a*b,2).
z = -a*b
is(equal( reveal(z,1), reveal(z,2))) does not work : says
unable to compare predikate.
thank you
s
On Wed, 07 Nov 2012 11:46:08 +0000
Jaime Villate <villate at fe.up.pt> wrote:
> On 11/07/2012 02:02 AM, Sean wrote:
>
>> Jamie, thank you, that is the form i was looking for.
> You're welcome. Keep in mind that nt() will count also
>constants. For instance:
>
> (%i9) nt (-a*b*c*d + e/f^2 + exp(g));
> (%o9) 9
>
> because exp(g) is represented as %e^g and both %e and
>the exponent 2 were counted. If you want to count only
>variables, use this other variant:
>
> (%i11) nt2([y]) := if length(y) < 1 then 0 else (if
>mapatom(first(y)) then (if constantp(first(y)) then
>apply(nt2,rest(y)) else 1+apply(nt2,rest(y))) else
>apply(nt2,args(first(y))) + apply(nt2,rest(y)))$
>
> (%i12) nt2(-a*b*c*d + e/f^2 + exp(g));
> (%o12) 7
>
> (%i13) nt2(-a*b*c*h(d) + cos(e/f^2) + exp(g));
> (%o13) 7
>
> Notice that there are several concepts involved in the
>definition of nt2: variable number of arguments,
>recursion, etc. For a beginner that may look confusing,
>but if you keep using Maxima you will find out that it is
>very versatile and a very valuable program.
>
> Best regards,
> Jaime
>