On 05/03/2011 04:21 AM, Ralf Hemmecke wrote:
Dear Stefan,
as others already have pointed out, for Axiom, your question is not
really well posed.
In Axiom
if x<10 then 2*x else 5*x^2
is *not* an expression (as you might know it from other untyped CAS
like Mathematica or Maple), but rather a programming language
construct. In other words, if Axiom sees this, it is evaluated. So the
result is either 2*x or 5*x^2 depending on the (boolean) outcome of
the evaluation of x<10.
I think, Bill suggested to use something like InputForm. There it
would be possible to represent an if-expression unevaluated.
But you should rather say what you actually want (it's not the same
what you expect).
In order for us to suggest you a proper way to handle your use case,
you should tell us why you want a piecewise function and (more
important) what you later want to do with that function.
Until we have that information, everything would be just digging in
the dark.
Ralf
Ralf
But the question is not intrinsically a "programing construct". With
some (bulky) symbolic logic constructs one can express it in a
mathematical sense.
That is: set membership and "exclusive or". I wouldn't have the
slightest idea how to implement it in Axiom; nonetheless questions like
this have non programmatic expressions. For instance Prolog has an
explicit resolution syntax that is reasonably obvious and supports
embedding logic conditions on and on. As I recall you can even extend
it to second order logic.
_______________________________________________
Axiom-math mailing list
[email protected]
https://lists.nongnu.org/mailman/listinfo/axiom-math