3
$\begingroup$

Consider the curve $C$ defined by the equation $y\, \sin(x)+x\, \sin(y)+x+y=0$.

  1. Find all points of the form $(8,y)$ that lie on $C$.

  2. For each point found in part 1, evaluate the derivative $dy/dx$ at that point.

  3. Plot the curve and the tangent lines at each of the points found in part 1.

My code is:

c = Plot[y*Sin[8] + 8*Sin[y] + 8 + y == 0, {y, -2 Pi, 2 Pi}];
cc = ContourPlot[y*Sin[x] + x*Sin[y] + x + y == 0, {x, -20, 20}, {y, -20, 20}];
Show[c, cc]

I am not sure if I am doing what question asked. My professor mentioned of doing something like this

implicit = D[y[x]*x*Sin[x] + x*Sin[y[x]] + x + y[x] == 0, x]
$\endgroup$
  • 1
    $\begingroup$ I don't understand how implicit differentiation relates to solving your equation. You can solve your equation with NSolve[y*Sin[8] + 8*Sin[y] + 8 + y == 0 && -10 < y < 10, y] $\endgroup$ – Carl Woll Feb 23 '18 at 6:03
2
$\begingroup$

Set up the differential system of equations; include forms for the particular values x == 8 and an arbitrary nonzero choice for dx, say dx = 1:

F = y*Sin[x] + x*Sin[y] + x + y;
dF = Dt[F] /. {Dt[x] -> dx, Dt[y] -> dy};

sols = Solve[{x - 8, dx - 1, F, dF} == 0 && -20 < y < 20]   (* or NSolve *)

Use solutions to get whatever info you want, such as the points and the tangent line equations:

pts = {x, y} /. sols;
tl = Y - y == dy/dx (X - x) /. sols  /. {X -> x, Y -> y};  (* variable hocus-pocus *)

Plot them:

ContourPlot[{ff == 0, tl} // Flatten // Evaluate,
 {x, -5, 15}, {y, -15, 5},
 Epilog -> {Point@pts}]

Mathematica graphics

Alternative setup of the differential:

jac = D[F, {{x, y}}];
dF = jac.{dx, dy};
$\endgroup$
5
$\begingroup$

First find the y values like Carl Woll proposed.

nsol = NSolve[y*Sin[8] + 8*Sin[y] + 8 + y == 0 && -20 < y < 20, y]

(*    {{y -> -5.8196}, {y -> -2.84462}, {y -> -0.891837}}    *)

Define the points

pts = Thread[List[8, y /. nsol]]

(*    {{8, -5.8196}, {8, -2.84462}, {8, -0.891837}}    *)

Solve for the gradient

solys = Solve[D[y[x]*Sin[x] + x*Sin[y[x]] + x + y[x] == 0, x], y'[x]]

(*   {{Derivative[1][y][x] -> (-1 - Sin[y[x]] - Cos[x] y[x])/(
       1 + x Cos[y[x]] + Sin[x])}}   *)

yt[x_] = y'[x] /. First@solys

Calculate the gradient at the found points

grad = (yt[8] /. y[8] -> #[[2]]) & /@ pts

(*   {-0.250838, 0.198087, -0.0501247}   *)

Plot it in the ContourPlot

ContourPlot[{y*Sin[x] + x*Sin[y] + x + y == 0, 
  Thread[y == Plus[y /. nsol, grad (x - 8)]]} // Flatten // 
  Evaluate, {x, -20, 20}, {y, -20, 20}, MaxRecursion -> 4, 
  Epilog -> Point@pts]

enter image description here

$\endgroup$
0
$\begingroup$
f[x_, y_] := x Sin[y] + x
g[x_, y_] := f[x, y] + f[y, x]
p = {8, y} /. Solve[g[8, y] == 0 && -2 Pi < y < 2 Pi, y];
cp = ContourPlot[g[x, y] == 0, {x, -10, 10}, {y, -10, 10}, 
   Epilog -> {PointSize[0.02], Red, Point[p]}];
dydx = Dt[y, x] /. First@Solve[Dt[g[x, y], x] == 0, Dt[y, x]];
tg[pt_, u_] := 
  dydx (u - pt[[1]]) + pt[[2]] /. {x -> pt[[1]], y -> pt[[2]]};
Show[cp, Plot[tg[#, s] & /@ p, {s, -10, 10}, PlotStyle -> Dashed]]

enter image description here

$\endgroup$
0
$\begingroup$
f[x_, y_] := y*Sin[x] + x*Sin[y] + x + y
yprimes =  y - # - (x - 8) #2 ==  0 & @@@ ({y, -Divide @@ Grad[f[x, y], {x, y}]} /.
  Solve[f[8, y] == 0 && -20 < y < 20, y] /. x -> 8);

ContourPlot[Evaluate@Flatten@{f[x, y] == 0, yprimes}, {x, -10, 10}, {y, -10, 10},
  MeshFunctions -> {# &}, Mesh -> {{8}}, MeshStyle -> Directive[Red, PointSize[Large]],
  PlotPoints -> 80]

enter image description here

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.