axiom-mail
[Top][All Lists]
Advanced

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

Re: [Axiom-mail] Defining piece-wise functions and drawing, integrating


From: Martin Rubey
Subject: Re: [Axiom-mail] Defining piece-wise functions and drawing, integrating, ...
Date: 27 May 2007 08:55:38 +0200
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.4

Dear Sumant,

You have sent an excellent example!

"Sumant S.R. Oemrawsingh" <address@hidden> 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





reply via email to

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