Subject: assignment, evaluation, and substitutions
From: Sebastian P. Luque
Date: Tue, 11 Oct 2011 11:26:46 -0500
Hi,
I'm slowly learning these important topics in maxima by working through
a simple exercise in geometry. Starting with the expression for the
volume of an object, based on 2 radii (r1, r2) and height (h):
Vtr: (1/3) * %pi * h * ((r1^2) + (r2^2) + ((r1^2) * (r2^2)));
So the expression has been assigned to the variable Vtr, and now I want
to find the expression where the radii are defined in terms of the
perimeter (p):
r: p / (2 * %pi);
How can this substitution be made efficiently, so as not to type this
for each radius? If Vtr above and the perimeter-based equivalent are
needed as functions to call with different heights and radii/perimeters,
when should the function definitions (i.e. :=) be made? In other words,
is it better to work with simple variable assignments until after the
substitutions are made? Thanks.
Cheers,
--
Seb