[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Axiom-developer] RE: Defining piece-wise functions and drawing, integra
From: |
Bill Page |
Subject: |
[Axiom-developer] RE: Defining piece-wise functions and drawing, integrating, ... |
Date: |
Sun, 3 Jun 2007 13:44:46 -0400 |
Note: Continued from discussion on axiom-mail.
On June 3, 2007 6:16 AM Ralf Hemmecke wrote:
> ...
> Bill Page wrote:
> > The result of evaluating this expression depends on the value
> > assigned to x. This is a "piece-wise" expression in the sense
> > we have been discussing *BUT* this is a part of the Axiom
> > programming language - it is not part of any mathematical
> > object currently implemented in the Axiom library. The Axiom
> > library includes things like polynomials and even the domain
> > 'Expression' containing expressions like 'x+1' or 'sin(1)'
> > but there is currently no domain in which we can find an
> > expression like 'if x>0 then 1 else 0'.
>
> Agreed, but what about telling Axiom the following:
>
> (1) -> g(x)==if x>0 then x else -x
> Type: Void
>
I think this is equivalent to writing:
g(x|x>0) == x
g(x|x<=0) == -x
As far as I know the difference is only a matter of style.
> ...
> So let us in particular look at wat happens with g(y).
> ...
> But what about the type of > and the type of 0.
> ...
> I guess it can easily be restricted to something of the form
>
> >: (Polynomial Integer, Polynomial Integer) -> Boolean
>
> ...
> OK, now everything is clear and the compilation can start.
>
Actually I would much prefer that there be no fuction named
'<' with the signature you give above. That leads to a lot
of unnecessary confusion and will also ultimately make a
proper treatment of predicates like 'x<0' more difficult.
> ...
> As I see it, we are a bit in a dilemma here. We need the
> function expression here and at the same time > should be
> considered as something like (Float, Float) -> Boolean.
>
I think we really need a class of fuctions > with signatures
like:
> : (Expression Integer, Expression Integer) ->
Union(Expression Integer, Boolean)
Then 'x<0' can be treated as an expression of type Expression
Integer just like 'sin(x)'. Or more generally we need a domain
of predicate expressions which can interact with other domains
like Expression. I would kind of like to write:
Expression Boolean
but the current implementation of Expression does not produce
the desired result. But see for example my related experiments
at:
http://wiki.axiom-developer.org/SandboxBooleanRing
I think this is a step in the right direction.
> Yes, Bill is right, currently, Axiom's Expression(...) domain
> does not allow to contain an expression of the form
> "if a then b else c".
>
If we had a domain for predicate expressions then it would not
be difficult to introduce an expression in Expression of the
form:
piecewise(Cond:Expression Boolean,
Then:Expression Integer,
Else:Expression Integer):Expression Integer
Regards,
Bill Page.
- [Axiom-developer] RE: Defining piece-wise functions and drawing, integrating, ...,
Bill Page <=
- [Axiom-developer] Re: Defining piece-wise functions and drawing, integrating, ..., Ralf Hemmecke, 2007/06/03
- RE: [Axiom-developer] Re: Defining piece-wise functions and drawing, integrating, ..., Bill Page, 2007/06/03
- Re: [Axiom-developer] Re: Defining piece-wise functions and drawing, integrating, ..., Ralf Hemmecke, 2007/06/04
- RE: [Axiom-developer] Re: Defining piece-wise functions and drawing, integrating, ..., Bill Page, 2007/06/04
- Re: [Axiom-developer] Re: Defining piece-wise functions and drawing, integrating, ..., Ralf Hemmecke, 2007/06/04
- [Axiom-developer] The Axiom Library and Category Theory (was: Defining piece-wise functions and drawing, integrating, ...), Bill Page, 2007/06/05
- [Axiom-developer] Re: The Axiom Library and Category Theory, Ralf Hemmecke, 2007/06/05
- Re: [Axiom-developer] The Axiom Library and Category Theory, C Y, 2007/06/05
- Re: [Axiom-developer] The Axiom Library and Category Theory, Gabriel Dos Reis, 2007/06/05