| PREVIOUS: Course Outline | UP: Course Outline | NEXT: Field lines and equipotentials |
nq = 2 q1 = 1.e-6, x1 = -1, y1 = 0 q2 = -1.e-6, x2 = 1, y2 = 0Write your program using arrays to store the charges and their positions, so that the number of charges can be easily modified. Plot phi and Ex as functions of y for -10 < y < 10 in steps of 0.1. [solution]
To draw the field line(s), arrange for your program to print out (on a single line) the values of X and Y obtained after each step in the field-line calculation. Then use plot_data or gpl to display the data: