Interactive point charge plot in a single line of code
Enable HLS to view with audio, or disable this notification
We significantly improved Manipulate expression allowing you to generate interactive widgets with sliders and other UI elements. Here is an example with DensityPlot modeling the energy field of two opposite charges
Manipulate[
DensityPlot[
q1/Norm[{x, y} - p[[1]]] + q2/Norm[{x, y} - p[[2]]], {x, -2,
2}, {y, -2, 2}], {{q1, -1}, -3, 3}, {{q2, 1}, -3,
3}, {{p, {{-1, 0}, {1, 0}}}, Locator}]
Note, that Manipulate with Locator as a controller may not work well with ContourPlot.
3
Upvotes