This shows you the differences between two versions of the page.
Both sides previous revision Previous revision | Last revisionBoth sides next revision |
184_notes:b_sup_comp [2020/08/23 21:42] – dmcpadden | 184_notes:b_sup_comp [2021/06/16 19:09] – [How can we use a computer for this?] bartonmo |
---|
- Repeat steps 5-7 for another chunk; and continue repeating until you've done this for all chunks of the wire | - Repeat steps 5-7 for another chunk; and continue repeating until you've done this for all chunks of the wire |
| |
These somewhat monotonous steps will give us an approximate value for the magnetic field at the point of interest. The smaller the chunks, the better the approximation. You can probably see why setting up a computer to do this makes a lot of sense. Computers are really good at doing the same calculation over and over again! | These somewhat monotonous steps will give us an approximate value for the magnetic field at the point of interest. **The smaller the chunks, the better the approximation.** You can probably see why setting up a computer to do this makes a lot of sense. Computers are really good at doing the same calculation over and over again! |
| |
So if we want to compute the magnetic field at a given location due to any length/shape of wire, the algorithm is just splitting the wire into chunks, computing the magnetic field of each chunk, and adding all the contributions together. This is a form of [[https://en.wikipedia.org/wiki/Numerical_integration|numerical integration]], which is a powerful technique in computational science. As a tool for thinking through these computational algorithms, we will sometimes write out the steps we want the computer to take in plain words rather than code - this is called **pseudocode**. The pseudocode for the magnetic field algorithm above is the following: | So if we want to compute the magnetic field at a given location due to any length/shape of wire, the algorithm is just splitting the wire into chunks, computing the magnetic field of each chunk, and adding all the contributions together. This is a form of [[https://en.wikipedia.org/wiki/Numerical_integration|numerical integration]], which is a powerful technique in computational science. As a tool for thinking through these computational algorithms, we will sometimes write out the steps we want the computer to take in plain words rather than code - this is called **pseudocode**. The pseudocode for the magnetic field algorithm above is the following: |