#20330: hyperbolic_geodesic midpoint bugfix
-------------------------------------+-------------------------------------
       Reporter:  jhonrubia6         |        Owner:
           Type:  defect             |       Status:  needs_review
       Priority:  major              |    Milestone:  sage-7.2
      Component:  geometry           |   Resolution:
       Keywords:  hyperbolic         |    Merged in:
  geometry, geodesic                 |    Reviewers:  Vincent Delecroix
        Authors:  Javier Honrubia    |  Work issues:
  González                           |       Commit:
Report Upstream:  N/A                |  8fea9c2fd8182498e593fbd2e03e151ebefdbea0
         Branch:                     |     Stopgaps:
  u/jhonrubia6/hyperbolic_geodesic_midpoint_bugfix|
   Dependencies:                     |
-------------------------------------+-------------------------------------

Comment (by vdelecroix):

 The method `get_B` would be simpler and safer as follows
 {{{
 from sage.structure.element import Element
 from sage.symbolic.expression import Expression

 if isinstance(a, (int,float,complex)):  # Python number
     a = CDF(a)

 if isinstance(a, Expression):           # symbolic
     P = SR
     zero = SR.zero()
     one = SR.one()
     I = SR("I")
 elif isinstance(a, Element):            # Sage number
     P = a.parent()
     zero = P.zero()
     one = P.one()
     I = P.gen()
     if I.is_one() or (I*I).is_one() or not (-I*I).is_one():
         raise ValueError("invalid number")
 else:
     raise ValueError("not a complex number")

 return matrix(P, 2, [one, zero, zero, -I])
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/20330#comment:42>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

-- 
You received this message because you are subscribed to the Google Groups 
"sage-trac" 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 https://groups.google.com/group/sage-trac.
For more options, visit https://groups.google.com/d/optout.

Reply via email to