Re: Defining piece-wise functions and drawing, integrating, ...
"Sumant S.R. Oemrawsingh" <[email protected]>
| Newsgroups | gmane.comp.mathematics.axiom.user |
|---|---|
| Message-ID | <[email protected]> |
Hi, Thanks for the reply. Too bad integration over such functions can't be done symbolically. I also don't quite understand why for the draw function, the function si compiled with type Variable x -> Polynomial Integer, when x=-1..1 is a range in R. I was hoping I could write down all my stuff in Axiom (symbolically), so that I would, say, never have to go through stacks of paper, manually calculating overlap integrals of two different, piece-wise functions, or stuff like that. It would appear that I still have to do all this manually, if I would like a symbolic answer :( But I've got loads of other stuff to throw at Axiom, I'll see what happens there! :) Thanks again, S. On Sun, May 27, 2007 at 08:55:38AM +0200, Martin Rubey wrote: > Dear Sumant, > > You have sent an excellent example! > > "Sumant S.R. Oemrawsingh" <[email protected]> writes: > > > Say, I wish to define a piece-wise function, > > > > (1) -> f(x|x<0)==-x**2 > > Type: Void > > (2) -> f(x)==x**2 > > Type: Void > > (3) -> draw(f(x),x=-1..1) > > Compiling function f with type Variable x -> Polynomial Integer > > Reading this line, you might find out what happened: axiom interprets your > function f as being from Variable x to Polynomial Integer. Try - in a fresh > session - > > )set message bottom on > > (or shorter, )se me bo on) and > > x<0 > > You will see, x is interpreted as a polynomial integer! Thus, the inequality > x<0 in your function definition will never hold! > > There is a way out though: tell axiom to draw a function from DoubleFloat to > DoubleFloat: > > draw(f, -1..1) > > Look carefully at the messages, and look up "draw" in HyperDoc or with > > )display operations draw > > (shorter: )di op draw) > > > > If I now continue to integrate, > > > > (4) -> integrate(f(x),x=-1..1) > > Here, I think, you are out of luck. axiom's Expression Domain does not yet > provide piecewise functions. You can only do it numerically: > > (19) -> romberg(f, -1,1,0.1,0.1,10,20) > > (19) [value= 0.0,error= 0.0,totalpts= 2049,success= true] > Type: Record(value: Float,error: Float,totalpts: Integer,success: Boolean) > > hope that helps, > > Martin > -- Sumant S. R. Oemrawsingh [email protected]