Re: How to solve 2D geometry problem in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg9627] Re: How to solve 2D geometry problem in Mathematica
- From: Daniel Lichtblau <danl>
- Date: Fri, 14 Nov 1997 21:40:06 -0500
- Organization: Wolfram Research, Inc.
- Sender: owner-wri-mathgroup at wolfram.com
Maggie Eusebio Schock wrote: > > I am considering purchasing Mathematica, but would like to know how easy > it would be in Mathematica (e.g., what is learning curve) to solve > simple problems like: > > 1. Find a tangent line to one or more curves (curves could be circle, > ellipse, circular arc, elliptical arc, rectangle, and if possible, > spline) > > 2. Find the intersection points between two curves > > (accuracy is important) > > Thanks in advance. You can find a line tangent to a pair of quadratics as below. If you want only one such line it is typically faster to use FindRoot instead of Solve or NSolve. f1 and f2 define the quadratics, {x1,y1} gives coordinates of the point on the tangent at f1, {x2,y2} likewise is the point on the line tangent to f2. f1[x_,y_] := 3*x^2 + 2*x*y + 5*y^2 - 6*x + 2*y - 11; f2[x_,y_] := x^2 - 4*x*y + 2*y^2 + 4*x + y - 8; tanpairs = Solve[{f1[x1,y1]==0, f2[x2,y2]==0, D[f1[x1,y1],x1]==D[f2[x2,y2],x2], D[f1[x1,y1],y1]==D[f2[x2,y2],y2]}, {x1,y1,x2,y2}] (takes about a second on a Pentium Pro running under Linux). Intersection points are perhaps even easier. intersec = Solve[{f1[x,y]==0, f2[x,y]==0}, {x,y}] Daniel Lichtblau Wolfram Research danl at wolfram.com