I guess one of my questions is:
What kind of object is actually produced by
(%i5) linearinterpol([[2,1], [3,2], [4,3]]);
Is this a function, boolean expression, list of characters, etc?
Logically speaking, if I write
f(x):= x^2 + 2*x,
I assume that I am defining a set of ordered pairs of real numbers. In
a computer, this cannot be stored, so one only gets stored values
which can have operations on them when one attempts to evaluate the
function.
So, I am somewhat confused about the differences between
(%i10) f(x):= linearinterpol([[2,1],[3,2], [4,3]]);
(%o10) (x - 1) charfun2(x, minf, 3) + (x - 1) charfun2(x, 3, inf)
and
(%i11) f(x):= x^2 + 2*x;
2
(%o11) f(x) := x + 2 x
In the second case the ':=' appears, while in the first case it
doesn't.
What exactly are the differences?
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 |
---------------------------------------------------------------------------