On Tue, 22 Nov 2011 11:56:51 +0100
Florent Hivert <florent.hiv...@lri.fr> wrote:

> 
> > > method. Thanks to Cython, this is very easy. However, Maxima and
> > > Ginac have a different semantic for those two functions:
> > > 
> > >  - Maxima: Does not change the expression; if the expression is
> > > not a quotient, then this will return the expression itself.
> > >  - Ginac: try to normalize the expression to put it in the form
> > > N/D and then return N;
> > > 
> > > For example, with an expression such as "x + y/(x + 2)",
> > > 
> > >  - Maxima: numer = x + y/(x + 2), denom = 1
> > >  - Ginac: numer = (x^2 + 2x + y), denom = x + 2
> > > 
> > > I can more or less emulate Maxima's behavior with Ginac, but I'm
> > > not sure what's best to do. I see several options:
> > > 
> > >  1 - Forget about Maxima and follows Ginac semantic;
> > >  2 - Follows Maxima semantic as close as possible using Ginac;
> > >  3 - Have a parameter 'algorithm' to select the needed one.
> > > Depending one the algorithm the semantic differ;
> > >  4 - Have a parameter 'normal' to select if we normalize or nor
> > > the result before computing the numerator, always use Ginac
> > > however. 5 - 3 and 4, have two parameters, one for selecting
> > > Maxima or Ginac, one for performing a normalization before.
> > >  6 - other options ???
> > > 
> > > In case 3, 4, 5, we also should decide what is the default.
> > > 
> > > What do you think ?
> > 
> > I like 4 best, though I suggest calling the parameter 'normalize.'
> > 
> > How do you plan to handle normalize=False? I suggest 
> > 
> > if the expression is not a mul:
> >     return self
> > else:
> >     separate the positive and negative exponents
> 
> This is indeed what I had in mind.

I don't recall a pynac function which separates negative and positive
exponents in a mul. There is some code for this in
mul::do_print_rat_func() (in Pynac). Maybe we should move that to a new
function.

How do you do this ATM? AFAIK, you can't access the expairseq stored in
a mul from Cython.

> Any idea for the default for normalize ?

IHMO, True. The response you get when it's false is nonsense in most
cases. If you want that behavior, you should state that you know what
you are doing by passing normalize=False.


Cheers,
Burcin

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

Reply via email to