Group Abstract Group Abstract

Message Boards Message Boards

0
|
1.8K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Determining whether a line is tangent to a curve

Posted 10 months ago

The equations of the line and the curve are as follows:

line = 2 x - 1
eq = Sin[x + 2 y] == 2 x - y;

I solved the problem using the following Mathematica code—does anyone have a better (or simply different) approach?

F[x_, y_] := Sin[x + 2 y] - 2 x + y;
dydx[x_, y_] = -D[F[x, y], x]/D[F[x, y], y] // Simplify
eqs = {F[x, y] == 0, dydx[x, y] == 2  };
sol = NSolve[eqs, {x, y}, Reals]
POSTED BY: Wen Dao
2 Replies
POSTED BY: Michael Rogers

I assume that your line has equation y == 2 x - 1. You have forgotten to include the equation of the line into your eqs, which brings spurious points:

ContourPlot[{Sin[x + 2 y] - 2 x + y == 0, y == 2 x - 1},
 {x, -2, 10}, {y, -2, 10},
 Epilog -> {PointSize[Large],
   Point[NSolveValues[Append[eqs, 0 < x < Pi], {x, y}, Reals]]}]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard