Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
184_notes:comp_super [2017/06/21 09:41] – [How can we use a computer for this?] caballero | 184_notes:comp_super [2021/02/09 19:08] (current) – [How can we use a computer for this?] bartonmo | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | Section 15.9 in Matter and Interactions (4th edition) | ||
+ | |||
+ | / | ||
+ | |||
+ | [[184_notes: | ||
+ | |||
===== Superposition and the Computer ===== | ===== Superposition and the Computer ===== | ||
- | The principle of superposition is an overarching and powerful tool in much of physics. It is useful well beyond the electric field as you will see with the magnetic field (and as you might see in future physics courses in quantum mechanics). The fact that the electric field obeys the principle of superposition | + | The principle of [[184_notes: |
==== The Superposition Principle ==== | ==== The Superposition Principle ==== | ||
- | As a reminder, the principle of superposition states that the electric field at any given location in space is determined by vector sum of the electric field due to each charge that contributes. | + | The principle of superposition states that the electric field at any given location in space is determined by vector sum of the electric field due to each charge that contributes. |
→Enet=∑→Ei=→E1+→E2+→E3+… | →Enet=∑→Ei=→E1+→E2+→E3+… | ||
- | You have seen how this principle can be used to find the electric field due to point charges and how it has been used for " | + | where →E1 would be the electric field from one point charge, $\vec{E}_2$ would be the electric field from a second point charge, and so on. During |
- | + | ||
- | →Enet=∫d→E | + | |
- | + | ||
- | //There are more details to this calculation in the notes on computing field due to a line charge.// | + | |
==== How can we use a computer for this? ==== | ==== How can we use a computer for this? ==== | ||
Line 21: | Line 23: | ||
Let's think through the process for computing the electric field due to a distribution of charges: | Let's think through the process for computing the electric field due to a distribution of charges: | ||
- | - Cut the distribution up into small chunks | + | - Identify |
- | - Pick a chunk to treat as a point charge | + | |
- Compute the electric field due to that chunk at the specified location | - Compute the electric field due to that chunk at the specified location | ||
- Write down or otherwise keep track of that value | - Write down or otherwise keep track of that value | ||
Line 30: | Line 31: | ||
- Repeat steps 5-7 for another chunk; and continue repeating until you've done this for all chunks | - Repeat steps 5-7 for another chunk; and continue repeating until you've done this for all chunks | ||
- | These somewhat monotonous steps will give us an approximate value for the electric 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 | + | These somewhat monotonous steps will give us an approximate value for the electric 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 electric field at a given location due to a distribution of charges, the algorithm is just cutting the distribution into chunks, computing the electric field of each chunk as a point charge, and adding all the contributions together. This is a form of "numerical integration", which is a powerful technique in computational science. The pseudocode for this algorithm is the following: | + | So if we want to compute the electric field at a given location due to a distribution of charges, the algorithm is just cutting the distribution into chunks, computing the electric field of each chunk as a point charge, and adding all the contributions together. This is a form of [[https:// |
< | < | ||
Line 49: | Line 50: | ||
</ | </ | ||
+ | //You can also use pseudocode (and may have already) to help you plan and understand the code you are writing.// |