[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Axiom-developer] [Piecewise Functions] (new)

From: Bill Page
Subject: [Axiom-developer] [Piecewise Functions] (new)
Date: Tue, 21 Jun 2005 23:18:53 -0500

Consider the following function, given in recursive manner:
N0(t|(t<0) or (t>1))==0
N0(t|(t>=0) and (t<=1))==1
This is a way to create (uniform) bsplines. Now try to differentiate $N$

Yack!!! This is obviously wrong! $t\mapsto N(t,0,3)$ is $C^2$ continuous
and **is not constant** Despite what Axiom seems to claim here.


On the other hand the function is not constant.
See this:
N0(t|(t<0) or (t>1))==0;
N0(t|(t>=0) and (t<=1))==1;
for x in -5..15 repeat output N(x/10,0,3)

Drawing the plot (unfortunately not available here) would
show it even more clearly.

But in 'D(N(t,0,3),t)' you are not calling the function N
with numeric parameters. In 'N(t,0,3)' the type of t is
'Variable t'. Ultimately 'N(t,0,3)=0' because of your function
definition 'N0(t|(t<0) or (t>1))==0'. This is '0' because
't>1' is 'true' when 't' is of type 'Variable t'. You can
see why if you use the option ')set message bottomup on' to
see the mode map selection
)set message bottomup on

Axiom interprets both 't' and '1' as being of type 'POLY INT'
and the function '>' is defined by the lexical ordering of the

This result is counter-intuitive, but once you understand why
Axiom gives this result then you will be in a good position to
understand the rest of Axiom's type system!

It is possible to write the function N0 so that it returns the
desired result. See ExampleSolution1.

forwarded from

reply via email to

[Prev in Thread] Current Thread [Next in Thread]