

last edited 4 months ago by test1 
1 2  
Editor: 127.0.0.1
Time: 2007/11/15 20:20:35 GMT8 

Note: transferred from axiomdeveloper 
changed:  Consider the following function, given in recursive manner: \begin{axiom} N0(t(t<0) or (t>1))==0 N0(t(t>=0) and (t<=1))==1 N(t,i,0)==N0(ti) N(t,i,pp>0)==(ti)/p*N(t,i,p1)+(i+1t)/p*N(t,i+1,p1) \end{axiom} This is a way to create (uniform) bsplines. Now try to differentiate $N$ \begin{axiom} D(N(t,0,3),t) \end{axiom} Yack!!! This is obviously wrong! The map $$t\mapsto N(t,0,3)$$ is $C^2$ continuous and **is not constant**, despite what Axiom seems to claim here. \begin{axiom} N(t,0,3) \end{axiom} On the other hand the function is not constant. See this: \begin{axiom} N0(t(t<0) or (t>1))==0; N0(t(t>=0) and (t<=1))==1; N(t,i,0)==N0(ti); N(t,i,pp>0)==(ti)/p*N(t,i,p1)+(i+1t)/p*N(t,i+1,p1); for x in 5..15 repeat output N(x/10,0,3) \end{axiom} 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 \begin{axiom} )set message bottomup on t>1 \end{axiom} Axiom interprets both 't' and '1' as being of type 'POLY INT' and the function '>' is defined by the lexical ordering of the polynomials. This result is counterintuitive, 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.
Consider the following function, given in recursive manner:
N0(t(t<0) or (t>1))==0
N0(t(t>=0) and (t<=1))==1
N(t,i, 0)==N0(ti)
N(t,i, pp>0)==(ti)/p*N(t, i, p1)+(i+1t)/p*N(t, i+1, p1)
This is a way to create (uniform) bsplines. Now try to differentiate
D(N(t,0, 3), t)
There are 3 exposed and 1 unexposed library operations named < having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse,or issue )display op < to learn more about the available operations. Perhaps packagecalling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named < with argument type(s) Polynomial(Integer) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 3 exposed and 1 unexposed library operations named < having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op < to learn more about the available operations. Perhaps packagecalling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named < with argument type(s) Polynomial(Integer) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 3 exposed and 1 unexposed library operations named < having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op < to learn more about the available operations. Perhaps packagecalling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named < with argument type(s) Polynomial(Integer) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need.
Yack!!! This is obviously wrong! The map
N(t,0, 3)
There are 3 exposed and 1 unexposed library operations named < having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse,or issue )display op < to learn more about the available operations. Perhaps packagecalling the operation or using coercions on the arguments will allow you to apply the operation. Cannot find a definition or applicable library operation named < with argument type(s) Polynomial(Integer) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need. FriCAS will attempt to step through and interpret the code. There are 3 exposed and 1 unexposed library operations named < having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op < to learn more about the available operations. Perhaps packagecalling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named < with argument type(s) Polynomial(Integer) NonNegativeInteger
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need.
On the other hand the function is not constant. See this:
N0(t(t<0) or (t>1))==0;
Compiled code for N0 has been cleared. Compiled code for N has been cleared. 1 old definition(s) deleted for function or rule N0
N0(t(t>=0) and (t<=1))==1;
1 old definition(s) deleted for function or rule N0
N(t,i, 0)==N0(ti);
1 old definition(s) deleted for function or rule N
N(t,i, pp>0)==(ti)/p*N(t, i, p1)+(i+1t)/p*N(t, i+1, p1);
1 old definition(s) deleted for function or rule N
for x in 5..15 repeat output N(x/10,0, 3)
Compiling function N0 with type Fraction(Integer) > NonNegativeInteger
Compiling function N with type (Fraction(Integer),Integer, Integer) > Fraction(Integer) 0 0 0 0 0 0 1  6000 1  750 9  2000 4  375 1  48 9  250 343  6000 32  375 243  2000 1  6 133   6000 43   750 217   2000 67   375 13   48
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
t>1
Function Selection for > Arguments: (VARIABLE(t),PI) > no appropriate > found in Variable(t) > no appropriate > found in PositiveInteger > no appropriate > found in Symbol > no appropriate > found in Integer > no appropriate > found in Variable(t) > no appropriate > found in PositiveInteger > no appropriate > found in Symbol > no appropriate > found in Integer
Modemaps from Associated Packages no modemaps
Remaining General Modemaps [1] (D,D) > Boolean from D if D has PORDER > no function > found for arguments (VARIABLE(t), PI)
Function Selection for > Arguments: (VARIABLE(t),NNI) > no appropriate > found in Variable(t) > no appropriate > found in NonNegativeInteger > no appropriate > found in Symbol > no appropriate > found in Integer > no appropriate > found in Variable(t) > no appropriate > found in NonNegativeInteger > no appropriate > found in Symbol > no appropriate > found in Integer
Modemaps from Associated Packages no modemaps
Remaining General Modemaps [1] (D,D) > Boolean from D if D has PORDER > no function > found for arguments (VARIABLE(t), NNI)
Function Selection for > Arguments: (VARIABLE(t),INT) > no appropriate > found in Variable(t) > no appropriate > found in Integer > no appropriate > found in Symbol > no appropriate > found in Variable(t) > no appropriate > found in Integer > no appropriate > found in Symbol
Modemaps from Associated Packages no modemaps
Remaining General Modemaps [1] (D,D) > Boolean from D if D has PORDER > no function > found for arguments (VARIABLE(t), INT)
Function Selection for > Arguments: (VARIABLE(t),SINT) > no appropriate > found in Variable(t) > no appropriate > found in SingleInteger > no appropriate > found in Symbol > no appropriate > found in Variable(t) > no appropriate > found in SingleInteger > no appropriate > found in Symbol
Modemaps from Associated Packages no modemaps
Remaining General Modemaps [1] (D,D) > Boolean from D if D has PORDER > no function > found for arguments (VARIABLE(t), SINT) There are 1 exposed and 2 unexposed library operations named > having 2 argument(s) but none was determined to be applicable. Use HyperDoc Browse, or issue )display op > to learn more about the available operations. Perhaps packagecalling the operation or using coercions on the arguments will allow you to apply the operation.
Cannot find a definition or applicable library operation named > with argument type(s) Variable(t) PositiveInteger
Perhaps you should use "@" to indicate the required return type,or "$" to specify which version of the function you need.
Axiom interprets both t
and 1
as being of type POLY INT
and the function >
is defined by the lexical ordering of the
polynomials.
This result is counterintuitive, 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?.