#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: |
-------------------------------------+-------------------------------------
Changes (by jhonrubia6):
* status: needs_review => needs_work
Comment:
Replying to [comment:10 vdelecroix]:
> Hello,
>
> Why in all this code the type of number is not preserved
> {{{
> sage: g = HyperbolicPlane().UHP().get_geodesic(CC(0,2),CC(1,2))
> sage: type(g.endpoints()[0].coordinates())
> <type 'sage.rings.complex_number.ComplexNumber'>
> sage: type(g.midpoint().coordinates())
> <type 'sage.symbolic.expression.Expression'>
> }}}
> If I am using floating point number it is likely that I want to do
floating point computations.
Since I was trying to fix a bug, I did not question the way the module was
implemented in the beginning (I assumed it was discussed, and reached a
consensus).
Taking a closer look, the effect you mention is caused by
{{{_crossratio_matrix()}}} as in
{{{
sage: (p1, p2, p3) = [UHP.random_point().coordinates() for k in range(3)]
sage: A = HyperbolicGeodesicUHP._crossratio_matrix(p1, p2, p3)
sage: type(A)
<type 'sage.matrix.matrix_symbolic_dense.Matrix_symbolic_dense'>
}}}
even
{{{
sage: B = HyperbolicGeodesicUHP._crossratio_matrix(CC(1,1), CC(3,2),
CC(2,2))
sage: type(B)
<type 'sage.matrix.matrix_generic_dense.Matrix_generic_dense'>
}}}
One think we can try is to check the type of p1,p2,p3 and construct the
matrix in CDF if we have {{{isinstance(p1,numbers.Complex)}}} using
{{{
return matrix(CDF,[[p1 - p2, (p1 - p2)*(-p0)],[p1 - p0, (p1 - p0)*(-p2)]])
}}}
What do you think of this approach? Any pitfalls ahead I am not aware of?
--
Ticket URL: <http://trac.sagemath.org/ticket/20330#comment:12>
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.