Updates:
        Summary: Ellipse.tangent_lines needs to be more robust

Comment #4 on issue 716 by [email protected]: Ellipse.tangent_lines needs to be more robust
http://code.google.com/p/sympy/issues/detail?id=716

The name of the method is now tangent_lines. The intersection detection could perhaps use checksol in solvers.py to do the checking to see if the point satisfies the original equation.

Sometimes a tangent line is found and sometimes not, so it needs to be more robust in that area, too:

e = Ellipse(Point(0,0), 3, 2)
t = e.tangent_lines(e.random_point())
t
[]
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy\geometry\ellipse.py", line 528, in tangent_lines
tangent_points = solve([w.as_numer_denom()[0] for w in [slope - dydx, eq]],
[x, y])
  File "sympy\solvers\solvers.py", line 483, in solve
    solution = _solve(f, *symbols, **flags)
  File "sympy\solvers\solvers.py", line 883, in _solve
    result = solve_poly_system(polys, *symbols)
  File "sympy\solvers\polysys.py", line 40, in solve_poly_system
    return solve_biquadratic(f, g, opt)
  File "sympy\solvers\polysys.py", line 48, in solve_biquadratic
    G = groebner([f, g])
  File "sympy\polys\polytools.py", line 5460, in groebner
    return GroebnerBasis(F, *gens, **args)
  File "sympy\polys\polytools.py", line 5496, in __new__
    raise DomainError("can't compute a Groebner basis over %s" % opt.domain)
sympy.polys.polyerrors.DomainError: can't compute a Groebner basis over RR
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy\geometry\ellipse.py", line 528, in tangent_lines
tangent_points = solve([w.as_numer_denom()[0] for w in [slope - dydx, eq]],
[x, y])
  File "sympy\solvers\solvers.py", line 483, in solve
    solution = _solve(f, *symbols, **flags)
  File "sympy\solvers\solvers.py", line 883, in _solve
    result = solve_poly_system(polys, *symbols)
  File "sympy\solvers\polysys.py", line 40, in solve_poly_system
    return solve_biquadratic(f, g, opt)
  File "sympy\solvers\polysys.py", line 48, in solve_biquadratic
    G = groebner([f, g])
  File "sympy\polys\polytools.py", line 5460, in groebner
    return GroebnerBasis(F, *gens, **args)
  File "sympy\polys\polytools.py", line 5496, in __new__
    raise DomainError("can't compute a Groebner basis over %s" % opt.domain)
sympy.polys.polyerrors.DomainError: can't compute a Groebner basis over RR
e.tangent_lines(e.random_point())
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "sympy\geometry\ellipse.py", line 528, in tangent_lines
tangent_points = solve([w.as_numer_denom()[0] for w in [slope - dydx, eq]],
[x, y])
  File "sympy\solvers\solvers.py", line 483, in solve
    solution = _solve(f, *symbols, **flags)
  File "sympy\solvers\solvers.py", line 883, in _solve
    result = solve_poly_system(polys, *symbols)
  File "sympy\solvers\polysys.py", line 40, in solve_poly_system
    return solve_biquadratic(f, g, opt)
  File "sympy\solvers\polysys.py", line 48, in solve_biquadratic
    G = groebner([f, g])
  File "sympy\polys\polytools.py", line 5460, in groebner
    return GroebnerBasis(F, *gens, **args)
  File "sympy\polys\polytools.py", line 5496, in __new__
    raise DomainError("can't compute a Groebner basis over %s" % opt.domain)
sympy.polys.polyerrors.DomainError: can't compute a Groebner basis over RR
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
[]
e.tangent_lines(e.random_point())
[Line(Point(-1.54497514980999, -1.71439030775370), Point(-16.9744879195933, 4.46
551029148626))]


--
You received this message because you are subscribed to the Google Groups 
"sympy-issues" 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/sympy-issues?hl=en.

Reply via email to