Question: (a) Complete the function definition in the code cell below for a function called efield_rod which has the linear charge density, the location where the

(a) Complete the function definition in the code cell below for a function called efield_rod which has the linear charge density, the location where the electric field is calculated, the length of the rod and the number of line segments as input variables. Output is the electric field of a rod. [6 marks) (b) Check that you get the same result from your function as you got above. [2 marks] [ ] def efield_rod(charge_density, r, L, n): # INPUT: charge density # # location of electric field r length of rod L n is number of line segments # # COMPLETE THE CODE HERE return Erod (a) Complete the function definition in the code cell below for a function called efield_rod which has the linear charge density, the location where the electric field is calculated, the length of the rod and the number of line segments as input variables. Output is the electric field of a rod. [6 marks) (b) Check that you get the same result from your function as you got above. [2 marks] [ ] def efield_rod(charge_density, r, L, n): # INPUT: charge density # # location of electric field r length of rod L n is number of line segments # # COMPLETE THE CODE HERE return Erod
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
