Re: if-expression and variables

"William Sit" <[email protected]> Mon, 02 May 2011 21:43:54 -0400
Newsgroups gmane.comp.mathematics.axiom.general
Message-ID <[email protected]>
PS: I just like to add that if a system provides 
automatically an expansion of the definition of test1 in 
"evaluating" "test1 y", then it is easy to see the system 
can easily get "clogged" with unintelligible output, for 
example, even in as simple an expression as "test1 test1 
y" and no system can handle expansion of things like 
"test1^n y" (iterating test1 n times, where n is also a 
variable).

(Mathematica provides a "notation" to hold the expression, 
for example, Nest[test1,y,n]), in effect, creating a new 
function through composition.)

The problem in Axiom is, however, still due to the dual 
(and automatically selected) meanings of "y < 10". If we 
qualify the "<" operation by "<($Integer)", then Axiom 
will refuse to evaluate "y <($Integer) 10" because y is 
not known to be of type Integer. Axiom announces an error, 
while Mathematica returns the input.

William

On Sat, 30 Apr 2011 20:40:28 +0200
  Stefan Karrmann <[email protected]> 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
> [email protected]
> 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/