Maxima's default evaluation policy for variables is one-time evaluation.
To shed some light on it, try this:
[a, b, c, d, e] : '[b, c, d, e, FOO]; /* assign several variables */
a;
''%;
''%;
''%;
''%;
You might try the evaluation flag infeval to repeatedly evaluate.
ev(a, infeval); => FOO or, at the input prompt, just this: a, infeval;
One-time evaluation is easier to predict so that's why it's the default.
HTH
Robert Dodier
On 5/18/11, Steven Boege <sjboege at yahoo.com> wrote:
> I would like to build long expressions or functions.
>
> I tried it this way:
>
> (%i1) a:b+c;
> (%o1)??????????????????????????????? c + b
> (%i2) b:d+e;
> (%o2)??????????????????????????????? e + d
> (%i3) c:f+g;
> (%o3)??????????????????????????????? g + f
> (%i4) a;
> (%o4)??????????????????????????????? c + b
>
> I was hoping to see
>
> (%o4)??????????????????????????????? g + f + e + d
>
> instead of
>
> (%o4)??????????????????????????????? c + b
>
> So then I read a few tutorials and realized that I needed to tell Maxima to
> recalculate a.
>
> (%i5) ''a;
> (%o5)??????????????????????????? g + f + e + d
>
> OK.
>
> Next I tried to change one of the values upon which a is dependent:
>
> %i6) a;
> (%o6)??????????????????????????????? c + b
> (%i7) d:0;
> (%o7)????????????????????????????????? 0
> (%i8) ''a;
> (%o8)??????????????????????????? g + f + e + d
> (%i9) d;
> (%o9)????????????????????????????????? 0
> (%i10) ''a;
> (%o10)?????????????????????????? g + f + e + d
>
>
> So d was set to 0, but a doesn't realize that.? I clearly am looking at this
> wrong.? Since d = 0, please explain why I didn't get:
>
> (%o10)?????????????????????????? g + f + e
>
> Next I tried functions:
> %i1) a(x):=b(x)+c(x);
> (%o1)???????????????????????? a(x) := b(x) + c(x)
> (%i2) b(x):=d(x)+e(x);
> (%o2)???????????????????????? b(x) := d(x) + e(x)
> (%i3) c(x):=f(x)+g(x);
> (%o3)???????????????????????? c(x) := f(x) + g(x)
> (%i4) a(x);
> (%o4)????????????????????? g(x) + f(x) + e(x) + d(x)
> (%i5)? g(x):= value1;
> (%o5)?????????????????????????? g(x) := value1
> (%i6) f(x):=value2;
> (%o6)?????????????????????????? f(x) := value2
> (%i7) e(x):=value3;
> (%o7)?????????????????????????? e(x) := value3
> (%i8) d(x):=value4;
> (%o8)?????????????????????????? d(x) := value4
> (%i9) a(x);
> (%o9)????????????????? value4 + value3 + value2 + value1
> (%i10) value4:0;
> (%o10)???????????????????????????????? 0
> (%i11) a(x);
> (%o11)???????????????????? value3 + value2 + value1
>
> This seems to work.? But how would I clear the definition for value4?? Also,
> I had to add "(x)" to the function definitions even though it's not really a
> function of x.? But if I leave the "(x)" out, Maxima complains.
>
> I looked for answers in the faq, but didn't find anything.? Thanks for
> reading.? Please consider taking a few minutes to get me rolling with this.
>
> Steve