Guest User

Untitled

a guest
Nov 22nd, 2016
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. f[x_, y_] := (x - 2)^2 + x ( y - 2)^2
  2.  
  3. FindRoot[{D[f[xs, y], xs] == 0 /. xs -> x,
  4. D[f[x, ys], ys] == 0 /. ys -> y}, {{x, 1}, {y, 3}}]
  5. (* {x -> 2., y -> 2.} *)
  6.  
  7. FindRoot[{D[f[xs, y], xs] == 0 /. xs -> x,
  8. D[f[x, ys], ys] == 0 /. ys -> y}, {{x, 3}, {y, 20}}]
  9. (* {x -> -4.73317*10^-30, y -> 4.} *)
  10.  
  11. fy[x_] := FindRoot[{D[f[x, ys], ys] == 0 /. ys -> y}, {{y, 20}}]
  12.  
  13. FindRoot[{D[f[xs, y], xs] == 0 /. xs -> x /. fy[x]}, {{x, 2}}]
  14.  
  15. FindRoot::nlnum: The function value {36. x} is not a list of numbers with dimensions {1} at {y} = {20.}.
  16.  
  17. FindRoot[{D[f[xs, fy[xs]], xs] == 0 /. xs -> x /. fy[x]}, {{x, 2}}]
  18. FindRoot[{D[f[xs, fy[x]], xs] == 0 /. xs -> x /. fy[x]}, {{x, 2}}]
Advertisement
Add Comment
Please, Sign In to add comment