#4735: Make e^X try calling X.exp() before trying to coerce X to the symbolic 
ring
-------------------------+--------------------------------------------------
 Reporter:  jason        |        Owner:  burcin    
     Type:  enhancement  |       Status:  new       
 Priority:  major        |    Milestone:  sage-3.2.2
Component:  calculus     |   Resolution:            
 Keywords:               |  
-------------------------+--------------------------------------------------
Old description:

> From sage-devel:
> {{{
> > I'd like to add an exponential function to RDF/CDF matrices (and
> > > enhance
> > > the existing exp function for SR matrices) so that:
> > >
> > > sage: A = matrix(SR, [[1,2],[3,4]])
> > > sage: e^A
> > >
> > > gives the same as
> > >
> > > sage: A.exp()
> > >
> > > (I'd also like this to work for other matrices, like over RDF or CDF,
> > > where the returned matrix would be another RDF/CDF matrix---scipy has
> > > functions that do this).
> > >
> > > However, currently for constants (in sage/functions/constants.py),
> the
> > > __pow__ function automatically converts the exponent to an SR object,
> > > which fails for a matrix.
> > >
> > > I have not worked with the constants code before.  Would there be a
> > > problem with, for the E constant, overriding __pow__ so that if the
> > > object had an "_exp" method, that was called instead of the default
> > > conversion to SR objects?
>
> +1, this was my first though when I started reading your email. I
> don't think it makes sense for other constants, but for E it
> certainly does. Also, I'd just call exp (not _exp), making sure that
> it doesn't introduce a recursive call...
>
> > > Would that be the proper way to get the above functionality?  The
> goal
> > > is also to get exp(A) to work as well; would I get that for free?
>
> Yes. When you do exp(A) it attempts to return A.exp() before doing
> anything symbolic.
> }}}

New description:

 From sage-devel at http://groups.google.com/group/sage-
 devel/t/ff6cdb898792d5b3 :
 {{{
 > I'd like to add an exponential function to RDF/CDF matrices (and
 > > enhance
 > > the existing exp function for SR matrices) so that:
 > >
 > > sage: A = matrix(SR, [[1,2],[3,4]])
 > > sage: e^A
 > >
 > > gives the same as
 > >
 > > sage: A.exp()
 > >
 > > (I'd also like this to work for other matrices, like over RDF or CDF,
 > > where the returned matrix would be another RDF/CDF matrix---scipy has
 > > functions that do this).
 > >
 > > However, currently for constants (in sage/functions/constants.py), the
 > > __pow__ function automatically converts the exponent to an SR object,
 > > which fails for a matrix.
 > >
 > > I have not worked with the constants code before.  Would there be a
 > > problem with, for the E constant, overriding __pow__ so that if the
 > > object had an "_exp" method, that was called instead of the default
 > > conversion to SR objects?

 +1, this was my first though when I started reading your email. I
 don't think it makes sense for other constants, but for E it
 certainly does. Also, I'd just call exp (not _exp), making sure that
 it doesn't introduce a recursive call...

 > > Would that be the proper way to get the above functionality?  The goal
 > > is also to get exp(A) to work as well; would I get that for free?

 Yes. When you do exp(A) it attempts to return A.exp() before doing
 anything symbolic.
 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/4735#comment:2>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to