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

Comment (by vdelecroix):

 Replying to [comment:15 jhonrubia6]:
 > I correct myself the crossratio matrix is
 > {{{<type 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>}}}
 > it gets converted to symbolic when multiplied by
 > {{{B = matrix([[1, 0], [0,I]])}}}
 > so if we change it to
 > {{{matrix([[1r,0r],[0r,CC(0,1)]])}}}
 > we mantain the type to
 > {{{<type 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>}}}
 > It is what you are requesting or it you require to get a
 > {{{<type
 'sage.matrix.matrix_complex_double_dense.Matrix_complex_double_dense'>}}}
 >
 > In that case, will we have to construct
 > {{{
 > return matrix(CDF,[[p1 - p2, (p1 - p2)*(-p0)],[p1 - p0, (p1 -
 p0)*(-p2)]])
 > }}}
 > as mentioned before when the points p1,p2,p3 are instances of
 ComplexNumber and leaving as it is in the rest of cases?

 It would be bad to use `CC(0,1)` by default for the complex imaginary
 unit. The only viable solution is to use the base ring of the coordinates
 {{{
 def get_I(a):
     from sage.structure.element import Element
     if isinstance(a, complex):
         return complex("j")
     elif isinstance(a, Expression):
         return SR("I")
     elif isinstance(a, Element):
         return a.parent().gen()
     else:
         raise ValueError("not a complex number")
 }}}
 It seems to work in most cases
 {{{
 sage: get_I(SR(1))
 I
 sage: parent(_)
 Symbolic Ring

 sage: get_I(QQbar(1+I))
 I
 sage: parent(_)
 Algebraic Field

 sage: get_I(CDF.an_element())
 1.0*I
 sage: parent(_)
 Complex Double Field

 sage: get_I(ComplexField(256).an_element())
 1.000000000000000000000000000000000000000000000000000000000000000000000000000*I
 sage: parent(_)
 Complex Field with 256 bits of precision
 }}}

--
Ticket URL: <http://trac.sagemath.org/ticket/20330#comment:17>
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