axiom-math
[Top][All Lists]
Advanced

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

Re: [Axiom-math] if-expression and variables


From: William Sit
Subject: Re: [Axiom-math] if-expression and variables
Date: Mon, 02 May 2011 21:07:39 -0400

Dear Stefan:

When you input "x < 10" into a symbolic computation program, the meaning is at first ambiguous. In the context of a function such as test1, a meaning can be obtained by assuming x is of the same type as 10 (or at least numeric) and the usual ordering of numbers is used for the "<" operation. However, if the input x is not numeric, such as the symbol y you use, then it does not make sense to compare a symbol y with a number, except in the context of polynomials (y and 10 both treated as polynomials in y). There, the usual ordering is an extension of a term-ordering and y > 10, as polynomials, and that is why you get 5y^2. (BTW, you have a typo in your definition of test1.)

To implement what you expect for "test1 y" would require a whole new setup, treating "y < 10" as an unevaluated expression (hold the evaluation until more information is known about y). But even if that is the setup, "test1 y" could only return "test1 y", unless there is an instruction from the user to "expand" the definition of test1.

So the answer to your question "How is it possible ..." is, "It is not possible, in the context of piecewise functions." because no matter what the system does, you gain no new information other than what you inputted, until you let the system know what y is, numerically.

At a higher level of symbolic computation, it is possible to simplify a boolean expression of inequalities (in Axiom, as far as I know, there is no such domain yet; Mathematica has a function called "Reduce" that does simplifications involving inequalities and equations). However, that would not be in the simple context of a piecewise function.

Tim Daly has done some experiments with a proviso domain in Axiom. He may be able to tell you more.

William


On Sat, 30 Apr 2011 20:40:28 +0200
 Stefan Karrmann <address@hidden> wrote:
Dear all,

I'm new to axiom and have a problem with piecewise functions.

test1 (x | x < 10) == 2*x
test1 (x | x < 10) == 5*x^2
test1
-> test1 (x | x < 10) == 2x
  test1 (x | ^ x < 10) == 5x
Type: FunctionCalled
test1 y
->
    2
  5y

I expected something like (if y < 10 then 2*y else 5*y**2).

How is it possible to pass a Variable to a piecewise function respecting
the pieces?

PS: Using a block and => or explicit if-then-else does not help.

--
Kind regards,
Stefan


_______________________________________________
Axiom-math mailing list
address@hidden
https://lists.nongnu.org/mailman/listinfo/axiom-math

William Sit, Professor Emeritus
Mathematics, City College of New York
Office: R6/291D Tel: 212-650-5179
Home Page: http://scisun.sci.ccny.cuny.edu/~wyscc/



reply via email to

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