On Tue, 27 Aug 2013 11:11:35 -0700 (PDT)
Emmanuel Charpentier <[email protected]> wrote:

> Dear Burcin, dear list
> 
> Le mardi 27 août 2013 11:16:18 UTC+2, Burcin Erocal a écrit :
> >
> > On Sat, 24 Aug 2013 14:16:01 -0700 (PDT) 
> > Emmanuel Charpentier <[email protected] <javascript:>> wrote: 
> >
> > > Dear list,
> 
>  
> [ Snip.. ]
>  
> 
> > > h=g(x,m1,m2,s1,s2) # to get a symbolic expression 
> > > print h.denominator() 
> > > 
> > > This prints 
> > > 
> > > sqrt(pi*s1^2)*sqrt(pi*s2^2) 
> > > 
> > > which is simple, but obviously *FALSE*. And, by the way, 
> > > 
> > > maxima.denom(h).sage() 
> > > 
> > > gives the much more reasonable : 
> > > 
> > > sqrt(2)*sqrt(pi*s1^2)*sqrt(pi*s2^2)*sqrt((s1^2 +
> > > s2^2)/(s1^2*s2^2)) 
> >
> > You can get a similar response from Sage (or the underlying library 
> > GiNaC/pynac) by setting normalize=False: 
> >
> > sage: var("x,t,mu,sigma")                                           
> > (x, t, mu, sigma) 
> > sage: assume(x,"real",t,"real",mu,"real",sigma,"real",sigma>0) 
> > sage: var("m1,m2,s1,s2") 
> > (m1, m2, s1, s2) 
> > sage:
> > phi(x,mu,sigma)=e^-(((x-mu)^2)/(2*sigma^2))/sqrt(2*pi*sigma^2)
> > sage: ex = integrate(phi(t,m1,s1)*phi(x-t,m2,s2),t,-oo,oo) sage:
> > ex.denominator(normalize=False)
> > sqrt(pi*s1^2)*sqrt(pi*s2^2)*sqrt((s1^2 + s2^2)/(s1^2*s2^2)) 
> >
> > Our .denominator() method returns the denominator of the
> > "normalized" expression by default: 
> >
> 
> Thank you. I was under the (false) impression that Sage used Maxima's
> CRE as a canonical representation. Hence two questions :
> 
> 1) Shouldn't this "normalized form" be used when one asks for h ?

Symbolic operations try to be lazy as much as possible. Normalization
is expensive. We don't want to do this until asked.

> 2) Where is this "normalized" form discussed (possibly against CRE) ?

See 5.8.1 here:

http://www.ginac.de/tutorial/Rational-expressions.html

> I suppose that, since Sage uses Maxima for a lot of the symbolics,
> changing its internal representation to one different from Maxima's
> (or, s case might be, deciding to stay with a previous choice)  has
> been deemed worth of it, and I'd like to understand  the rationale
> for this decision. 

The symbolics subsystem in Sage is supposed to allow development of
native functionality in Sage. We are not aiming to maintain a thin
layer around Maxima.

Unfortunately, there are some rough edges where the backward compatible
interface inherited from the maxima based symbolics clashes with the
(IMHO much cleaner) GiNaC interface. I hope this will be resolved in
time.

The interface described in the link above is a nice way to go from
symbolics expressions to algebraic objects, which can then be used in
various algorithms (e.g. Risch, Karr). The denominator() method is
designed to be compatible with this interface.



Cheers,
Burcin

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to