Another lame question : defining function by a result.
Subject: Another lame question : defining function by a result.
From: Jordan Tuzsuzov
Date: Wed, 22 Dec 2004 06:59:48 -0800 (PST)
Thank you. The fact, that at A := B the B is not
evaluated explains all...
--- "Viktor T. Toth" <vttoth@vttoth.com> wrote:
> Try define(f(x),%o2); it'll work.
>
> The reason is simple: when you define a function
> with :=, the RHS is NOT
> evaluated. In other words, your function definition
> will contain the SYMBOL
> %o2, not its value. When you use define(), the
> second argument IS evaluted:
>
> (%i5) define(f(x),%o2);
> 2 x + 1
> 2
> ATAN(-------)
> LOG(x + x + 1) SQRT(3)
> LOG(x - 1)
> (%o5) f(x) := - --------------- -
> ------------- + ----------
> 6 SQRT(3)
> 3
>
> Compare this with your line %o3.
>
>
> Viktor
>
>
> -----Original Message-----
> From: maxima-admin at math
> [mailto:maxima-admin@math.utexas.edu] On
> Behalf Of Jordan Tuzsuzov
> Sent: Wednesday, December 22, 2004 8:08 AM
> To: maxima@math.utexas.edu
> Subject: Another lame question : defining
> function by a result.
>
> Hello,
>
> It is just about the expectance of work. I want to
> define a function f(x) by a result of previous
> calculation, related to x. Example :
> (%i1) 1 / ( x^3 - 1 );
> 1
> (%o1) ------
> 3
> x - 1
> (%i2) integrate(%,x);
> 2 x + 1
> 2 ATAN(-------)
> LOG(x + x + 1) SQRT(3) LOG(x - 1)
> (%o2) - --------------- - ------------- +
> ----------
> 6 SQRT(3) 3
> (%i3) f(x) := %o2;
> (%o3) f(x) := %o2
> (%i4) f(10);
> 2 x + 1
> 2 ATAN(-------)
> LOG(x + x + 1) SQRT(3) LOG(x - 1)
> (%o4) - --------------- - ------------- +
> ----------
> 6 SQRT(3) 3
>
> The x is not substituted by 10 in call %i4. Why ?
>
> Thanx.
> Jordan
>
>
>
> __________________________________
> Do you Yahoo!?
> Take Yahoo! Mail with you! Get it on your mobile
> phone.
> http://mobile.yahoo.com/maildemo
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
> _______________________________________________
> Maxima mailing list
> Maxima@www.math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com