Advertisement
Guest User

Untitled

a guest
Jul 29th, 2015
211
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. Manipulate[Module[{x, y},
  2. ContourPlot[Exp[-x^2 - y^2] + x y, {x, -1, 1}, {y, -1, 1},
  3. Contours -> 20,
  4. Epilog ->
  5. Dynamic[{Arrow[{pt,
  6. pt + {y - 2 E^(-x^2 - y^2) x, x - 2 E^(-x^2 - y^2) y} /. {x ->
  7. pt[[1]], y -> pt[[2]]}}]}]
  8. ]],
  9. {{pt, {.5, .5}}, Locator,
  10. Appearance -> Graphics[{Red, Disk[]}, ImageSize -> 5]}]
  11.  
  12. Clear[x, y, f];
  13. f = E^(-x^2 - y^2) + x y;
  14. Grad[f, {x, y}];
  15.  
  16. Manipulate[Module[{x, y},
  17. ContourPlot[f, {x, -1, 1}, {y, -1, 1},
  18. Contours -> 20,
  19. Epilog ->
  20. Dynamic[{Arrow[{pt,
  21. pt + Grad[f, {x, y}] /. {x -> pt[[1]], y -> pt[[2]]}}]}]
  22. ]],
  23. {{pt, {.5, .5}}, Locator,
  24. Appearance -> Graphics[{Red, Disk[]}, ImageSize -> 5]}]
  25.  
  26. Manipulate[
  27. ContourPlot[f, {x, -1, 1}, {y, -1, 1},
  28. Contours -> 20,
  29. Epilog ->
  30. Dynamic[{Arrow[{pt,
  31. pt + Grad[f, {x, y}] /. {x -> pt[[1]], y -> pt[[2]]}}]}]
  32. ],
  33. {{pt, {.5, .5}}, Locator,
  34. Appearance -> Graphics[{Red, Disk[]}, ImageSize -> 5]}]
  35.  
  36. x=12
  37.  
  38. Clear[x, y, f];
  39. f = E^(-x^2 - y^2) + x y;
  40. Grad[f, {x, y}];
  41.  
  42. DynamicModule[{x, y},
  43. Manipulate[
  44. ContourPlot[f, {x, -1, 1}, {y, -1, 1},
  45. Contours -> 20,
  46. Epilog ->
  47. Dynamic[{Arrow[{pt,
  48. pt + Grad[f, {x, y}] /. {x -> pt[[1]], y -> pt[[2]]}}]}]
  49. ],
  50. {{pt, {.5, .5}}, Locator,
  51. Appearance -> Graphics[{Red, Disk[]}, ImageSize -> 5]}]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement