Dear all, thanks for your answers. They clears a lot.
I actually want to integrate test1 and solve an differential equation with it. E.g. test2 x == rho * test1 x y = operator 'y odeq := D(y x) = test2 x solve(odeq, y, x) Obviously, the solution is "formally" y_sol x == integrate(test2 x,x) Kind regards, Stefan Am Dienstag, den 03.05.2011, 11:21 +0200 schrieb Ralf Hemmecke: > 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 > > On 04/30/2011 08:40 PM, Stefan Karrmann 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 > > [was typo: 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. _______________________________________________ Axiom-math mailing list [email protected] https://lists.nongnu.org/mailman/listinfo/axiom-math
