[Maxima] part of equation as function
javier.arantegui at gmail.com
Tue Mar 13 05:58:04 CDT 2012
The difference between ":=" and "define" is a topic that has been
discussed several times. It's one of those things that separate
newbies (like me) and experts. For experts, the difference seems to be
very clear, but most of the new users think that := is the way to
define functions in Maxima. And, frankly the difference is very hard
to tell if you just read the documentation.
Let's see what the Maxima Manual says about := :
And, what about define:
There is only (I think) one small difference between them:
"The function definition operator. f(x_1, ..., x_n) := expr defines a
function named f with arguments x_1, …, x_n and function body expr. :=
never evaluates the function body (unless explicitly evaluated by
"Defines a function named f with arguments x_1, …, x_n and function
body expr. define always evaluates its second argument (unless
explicitly quoted). "
Because it's a FAQ, maybe a new sentence should be added to explain
the consequences of that difference, and a new example should be added
showing the different behaviour. Now, the set of examples is the same
in both cases.
On Tue, Mar 13, 2012 at 10:04 AM, Jaime Villate <villate at fe.up.pt> wrote:
> On 03/13/2012 07:53 AM, Jan Hendrik Müller wrote:
>> Hi all,
>> how can I use parts of an equation as a function, e.g.
>> o% z = x*y
>> and I would like to define f(x,y):=x*y by using the output.
>> f(x,y):=rhs(eq) doesn't work if I want to evaluate e.g. f(1,2)
> define (f(x,y), rhs(eq));
> for mathematical functions use always define() instead of :=. Think of := as
> a way to define a small program, rather than defining a function.
> Maxima mailing list
> Maxima at math.utexas.edu
Lee mi blog: "Un pequeño paso para Neil" http://up3n.wordpress.com/
¡Ahora también en Twitter! http://twitter.com/javierarantegui
More information about the Maxima