> -----Original Message-----
> From: maxima-bounces at math.utexas.edu
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of sen1 at math.msu.edu
> Sent: Tuesday, June 12, 2007 8:35 AM
> To: Robert Dodier
> Cc: maxima at math.utexas.edu
> Subject: Re: [Maxima] what do these mean?
>
> Is this one of those situations where '0,1' means 'true,
> false' instead
> of the integers?
>
> Perhaps I still don't quite get it.
>
> I know about (setq A) in lisp.
>
> But, I thought that the function produced in (%o4) below was a real
> valued function.
>
No, %o4 is a symbolic expression with a "free variable" x in it.
What you define in %i2 is a function f, which when called, computes afresh,
an interpolating function to go through three points. So, even though the
points don't change, the computation is done again, and a new symbolic
expression is returned, always equal to the previous one. That is why %o3
and %o4 are the same.
RJf
> Otherwise, how does one multiply by the real numbers in the
> expressions?
>
> So, it seems that the natural thing is that after entering the (%i4)
> operation, one should be able to do f(2), f(%pi), etc.
>
> But, here is what happens.
>
> (%i1) load(interpol);
> (%o1) /usr/local/share/maxima/5.12.0/share/numeric/interpol.mac
> (%i2) f(x):= linearinterpol([[2,1], [3,2], [4,3]]);
> (%o2) f(x) := linearinterpol([[2, 1], [3, 2], [4, 3]])
> (%i3) f(2);
> (%o3) (x - 1) charfun2(x, minf, 3) + (x - 1) charfun2(x, 3, inf)
> (%i4) f(4);
> (%o4) (x - 1) charfun2(x, minf, 3) + (x - 1) charfun2(x, 3, inf)
>
>
> So, one has to do an extra evaluation like
>
> %i5) linearinterpol([[2,1], [3,2], [4,3]]);
> (%o5) (x - 1) charfun2(x, minf, 3) + (x - 1) charfun2(x, 3, inf)
> (%i6) f(x):= ''%;
> (%o6) f(x) := (x - 1) charfun2(x, minf, 3) + (x - 1) charfun2(x, 3,
> inf)
> (%i7) f(2);
> (%o7) 1
> (%i8) f(3)
> ;
> (%o8) 2
> (%i9) f(2.4);
> (%o9) 1.4
>
> Why is this necessary?
>
> TIA,
> -sen
>
> On Tue, 12 Jun 2007, Robert Dodier wrote:
>
> > On 6/11/07, sen1 at math.msu.edu <sen1 at math.msu.edu> wrote:
> >
> >> (%o4) f(x) := (0.3 x - 0.02) charfun2(x, minf, 0.2)
> >> + (1.9 x - .8999999999999999) charfun2(x, 0.9, inf)
> >> + (1.7 x - .7199999999999995) charfun2(x, 0.8, 0.9)
> >> + (1.5 x - .5600000000000003) charfun2(x, .7000000000000001, 0.8)
> >> + (1.3 x - .4200000000000002) charfun2(x, .6000000000000001,
> >> .7000000000000001) + (1.1 x - 0.3) charfun2(x, 0.5,
> .6000000000000001)
> >> + (.8999999999999998 x - .1999999999999999) charfun2(x, 0.4, 0.5)
> >> + (.7000000000000002 x - .1200000000000001) charfun2(x, 0.3, 0.4)
> >> + (0.5 x - 0.06) charfun2(x, 0.2, 0.3)
> >> (%i5) f(2);
> >> (%o5) 2.9
> >> (%i6) plot2d('(f(x)),[x,0,1]);
> >>
> >> Why does one need the apostrophe and the parentheses in
> the expression
> >> in (%i6), and what does it mean?
> >
> > In Maxima 5.11 and earlier, a Boolean expression could only
> > evaluate to true or false, otherwise it would trigger an error.
> > e.g. when x is not yet assigned a value, if x > 0 then foo else bar
> > triggered an error.
> >
> > The quote mark around f(x) is probably intended to prevent
> that error.
> > It doesn't appear to be needed in Maxima 5.12.0.
> >> From what I can tell, plot2d(f(x), ...) works OK.
> > (So does plot2d(f, ...), which also works in some, maybe all,
> > pre-5.12 versions.)
> >
> > I guess the documentation can be updated to cut out the quote mark.
> >
> > HTH
> > Robert
> >
>
> --
>
> --------------------------------------------------------------
> -------------
> | Sheldon E. Newhouse | e-mail:
> sen1 at math.msu.edu |
> | Mathematics Department |
> |
> | Michigan State University | telephone: 517-355-9684
> |
> | E. Lansing, MI 48824-1027 USA | FAX: 517-432-1562
> |
>
> --------------------------------------------------------------
> -------------
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>