#!/usr/bin/env python # coding: utf-8 # # INVESTIGATION OF THE FORCE ON A CURRENT IN A MAGNETIC FIELD # # ## Theory: # The force on a current carrying wire in a magnetic field is described by the relationship: $F=BIl \sin{\theta}$. In this practical arrangement, the value of 𝜃=90 so the equation can be simplified to $F=BIl$. # # The value of $F$ is determined by the weight of the magnet placed on a balance. In effect $𝐹= \Delta mg $ where $\Delta m$ is the apparent change in mass as F varies due to the magnitude of the current. # # The current can be varied and a graph of $F against $I can be plotted which should be linear. The length of the wire can be measured and the magnetic flux density of the magnet can be determined from the gradient of the graph and the value of length of wire within the pole pieces of the magnet. # # ## Apparatus: # * Electronic scales with resolution ± 0.001 g # * Ammeter # * Rheostat – value can be chosen so that the current can be varied in the range 0 to 3.00A or 5.00A # * 20 SWG copper wire # * Ammeter or mutlimeter set to A range - ± 0.01A # * Variable d.c. power supply # * U shaped soft iron section with ceramic pole pieces # * Stand and clamp # * Metre rule # # ## Method: # # Set up the apparatus as shown in the diagram. Measure the length, l of the wire which is between the poles of the magnet. Use the rheostat to increase the current in steps from zero. For each chosen current value, record Δm, the apparent change in mass of the magnet (this can be an increase or decrease, depending upon the orientation of the current and the magnetic field). The force, F on the wire is calculated from F = Δmg for each value of current I. A graph of F (y-axis) against I (x-axis) should be a straight line through the origin. The magnetic flux density, B of the magnet can be determined from: B= gradient # length of wire # # ![image.png](attachment:image.png) # In[12]: # Importing the necessary libraries from matplotlib import pyplot as plt import numpy as np #from prettytable import PrettyTable # Preparing the data to be computed and plotted dt = np.array([ [1.0, 0.15], [2.0, 0.29], [3.0, 0.38], [4.0, 0.50], [5.0, 0.60], [6.0, 0.81], [7.0, 0.90], [8.0, 1.13] ]) # Preparing X and y data from the given data x = dt[:, 0].reshape(dt.shape[0], 1) X = np.append(x, np.ones((dt.shape[0], 1)), axis=1) y = dt[:, 1].reshape(dt.shape[0], 1) # Calculating the parameters using the least square method theta = np.linalg.inv(X.T.dot(X)).dot(X.T).dot(y) print(f'The parameters of the line: {theta}') # Now, calculating the y-axis values against x-values according to # the parameters theta0 and theta1 y_line = X.dot(theta) # Plotting the data points and the best fit line plt.scatter(x, y) plt.plot(x, y_line, 'r') plt.title('Best fit line using regression method') plt.xlabel('Length in cm') plt.ylabel('Resistance') plt.show() #def makePrettyTable(table_col1, table_col2): # table = PrettyTable() # table.add_column("Column-1", x) # table.add_column("Column-2", Y) #return table # ## Conclusion # In comparison, our calculated resistivity is 0.13 Ohm/m vs a databook value of 0.105 Ohm/m This is well within the expected variance of an A-level practical. # # In[ ]: