Changes
http://wiki.axiom-developer.org/358VariableIsApparentlyAlwaysAssumedToBePositive/diff
--
Define the following function:
(1) -> f(x|x<0)==-x**2
Type: Void
(2) -> f(x)==x**2
Type: Void
Then, draw the function
(3) -> draw(f(x),x=-1..1)
Compiling function f with type Variable x -> Polynomial Integer
Compiling /tmp/gazonk0.lsp.
End of Pass 1.
End of Pass 2.
OPTIMIZE levels: Safety=0 (No runtime error checking), Space=0, Speed=3
Finished compiling /tmp/gazonk0.lsp.
Compiling function %F with type DoubleFloat -> DoubleFloat
Graph data being transmitted to the viewport manager...
AXIOM2D data being transmitted to the viewport manager...
(3) TwoDimensionalViewport: "x*x"
Type: TwoDimensionalViewport
Note that the function is compiled with Variable x -> Polynomial Integer, and
the viewport shows the function x*x, even for x<0, where it should show -x*x.
The same holds when you eval the function:
(4) -> )clear all
All user variables and function definitions have been cleared.
(1) -> f(x|x<0)==-x**2
Type: Void
(2) -> f(x)==x**2
Type: Void
(3) -> eval(f(x),x=-5)
Compiling function f with type Variable x -> Polynomial Integer
(3) 25
Type: Polynomial Integer
Here, we should expect -25. And shouldn't this:
(4) -> f(x)
(4) ->
2
(4) x
Type: Polynomial Integer
result in something similar to
(5) -> )display values f
Definition:
2
f (x | x < 0) == - x
2
f x == x
?
Integration, therefore, also goes wrong,
(5) -> integrate(f(x),x=-5..5)
(5) ->
250
(5) ---
3
Type: Union(f1: OrderedCompletion Expression Integer,...)
which should of course yield 0. It would appear that in certain operations,
when performing a function on f (like draw, eval, integrate), or when x is not
specified, it is assumed to be positive. After that, the actual value is filled
in and this can therefore yield an erroneous result.
I use Version: Axiom 3.9 (September 2005) on gentoo (amd64).
--
forwarded from http://wiki.axiom-developer.org/[EMAIL PROTECTED]