Define the following function: axiom f(x|x<0)==-x**2 Type: Voidaxiom f(x)==x**2 Type: VoidThen, draw the function axiom draw(f(x), Note that the function is compiled with The same holds when you eval the function: axiom eval(f(x), Here, we should expect axiom f(x) result in something similar to axiom )display values f Integration, therefore, also goes wrong, axiom integrate(f(x), which should of course yield I use Version: Axiom 3.9 (September 2005) on gentoo (amd64).
An anonymous author wrote: Axiom is being inconsistent, and this is an interpreter bug! In the Axiom programming language it is possible to avoid the
immediate evaluation of axiom [f(x) for x in -5..5] axiom Compiling function f with type Integer -> Integer
Type: List(Integer)but the Axiom interpreter does not treat as an operator or even a generator. Perhaps this could be considered inconsistent. In this regard the Aldor programming language is certainly more general and more consistent. But to be consistent with other parts of Axiom as it exists now it is possible to write this in an equivalent "functional" style: axiom map(f,
Type: List(Integer)`map(f, ...)` is not exactly the same syntax as `integrate(f(x), ...)` . I think the real reason for the failure of `eval` , `integrate` is these functions are not programmed to handle conditionals in function definitions.
axiom h(x | x<=0) == -x^2 Type: Voidaxiom eval(h(x), If the interpreter is able to find another definition for h that is valid, it would have used it. Instead of compiling the function h, as in the handling of axiom [h(x) for x in -1.0..0.0 by 0.5] Must I manually translate an integer segment to a float segment (a la old Fortran)? axiom [h(-1.0+0.5*i) for i in 0..2] axiom Compiling function h with type Float -> Float
Type: List(Float)I think the real reason for the failure of eval, integrate is these functions are not programmed to handle conditionals in function definitions. No that is not correct. The function definition you have is incomplete.
Your axiom x<=0 That is why it says: "The function h is not defined for the given argument(s)." (Note: click on + axiom on the right to see the output of the compiler.) Anonymous wrote: the interpreter is trying to evaluate exactly, not numerically Yes that is always true in Axiom. Axiom never makes an approximation unless you specifically ask it to. Anonymous wrote: Are there any numerical integration functions in Axiom? Yes. For example search for Anonymous wrote: Must I manually translate an integer segment to a float segment? I do not know exactly what you mean by a "float segment" but yes I think writing: [h(-1.0+0.5*i) for i in 0..2] is sensible if that is the output that you want. What you are calling a "float segment" might be something for like an "interval" but that is a different story. No that is not correct. The function definition you have is incomplete. Your h is only defined for x<=0. So Axiom cannot evaluate >this for the value x since I think Axiom is "stupid" to even think that in the definition of h, the x is symbolic as in POLY INT or EXPR INT. The function definition is complete as shown by the correct execution of h(-1.0+0.5*i) for i in 0..2. A function h is NOT the same as a value h(x) where x is a variable in EXPR INT. We should integrate h, not h(x). Since it is not related to this issue report, the discussion of "float segments" has been moved to SandBoxFloatSegment. Anonymous wrote:Axiom is "stupid" to even think that in the definition of h, the x is symbolic In Axiom x, 1, and 1.0 are all equally symbolic. The distinction between "symbolic" and "numeric" is not relevant. All of these things are members of some domain or other and the Axiom interpreter will make some assumptions unless you specify explicitly which domains (e.g. in this case the assumed domains are Variable(x), PositiveInteger, and Float, respectively). Anonymous wrote: definition [ h(x | x<=0) == -x^2 ]is complete as shown No it is not. This is just a function prototype, not a function. The Axiom intetpreter automatically fills in the missing information based on the context where you use this prototype so what you get is the evaluation of a function that was partly created by assumptions made by the Axiom interpreter. These assumptions do not work when you call h with something of type Variable(x). billpage wrote:Anonymous wrote:: Axiom is "stupid" to even think that in the definition of h, the x is symbolic In Axiom x, 1, and 1.0 are all equally symbolic. The distinction between "symbolic" and "numeric" is not relevant. I think anonymous' view is correct: a function is just a rule that assigns a
value when given a value. The **wyscc**wrote:*if x is interpreted as a FIXED element in POLY INT, h is no longer a function from POLY INT to POLY INT (unless you view h as defining the substitution homomorphism on sending to ; but that is not what we meant when we want to integrate h).*
The definition axiom h(x | x<=0) == -x^2 Type: Voidaxiom h(x | x>0) == x^2 Type: Voiddoes not necessarily have anything to do with integration or polynomials since we know nothing at all about what the domain and co-domain of the function will be. If we had already specified a signature such as: h:Float->Float then we could be sure that integration is at least in principle possible. But as it stands we only have part of the body of a potential function, i.e. a function prototype. In any case But given only the prototype, if in Axiom I write: h(w) where axiom w
Type: Variable(w)But to interpret what is meant by Even when we specify a signature such as: h:Polynomial Integer -> Polynomial Integer The **wyscc**wrote:*As far as calculus goes, we integrate a function, NOT a polynomial ...*
I agree. What we really would like to write is something like: integrate(h) and we would expect the result to be another function. But this can be very difficult for arbitrary piecewise functions. Name:`#358 Variable is apparently always assumed to be positive?` => `#358 EXPR does not handle conditional definitions`
Category: Axiom Mathematics => Axiom Library
The problem, even with axiom draw(f, axiom Compiling function f with type DoubleFloat -> DoubleFloat Graph data being transmitted to the viewport manager... FriCAS2D data being transmitted to the viewport manager...
Type: TwoDimensionalViewport?the result will be fine. However, if you give |

numerical evaluation--anonymous, Sun, 03 Jun 2007 03:39:47 -0500 reply