## ← 06ps-01 Conduction

• 1 Follower
• 53 Lines

### Get Embed Code x Embed video Use the following code to embed this video. See our usage guide for more details on embedding. Paste this in your document somewhere (closest to the closing body tag is preferable): ```<script type="text/javascript" src='https://amara.org/embedder-iframe'></script> ``` Paste this inside your HTML body, where you want to include the widget: ```<div class="amara-embed" data-url="http://www.youtube.com/watch?v=LZyrf3Y0uCQ" data-team="udacity"></div> ``` 1 Language

• English [en]

Showing Revision 1 created 10/24/2012 by Amara Bot.

1. In this problem, we're going to deal with heat conduction along the wire.
2. Just like you saw in the unit, we're going to split the wire that we had into discrete chunks.
3. In fact, we're going to split it into 100 different chunks and went from 0 to 99.
4. We can then measure the temperature of each chunk and labeled that with a proper number.
5. So for example the temperature in the last chunk is going to be labeled to 99.
6. As you already heard from Jörn, the temperature in any given segment--let's take the 8th segment
7. that's simple--depends on the temperature in the surrounding two segments.
8. In those segments that are touching one another are going to feed energy into each other.
9. So this segment and that segment can both be energy into the 8th.
10. In the same way, the 8th segment is going to feed energy into both the 7th and the 9th segments.
11. To express the temperature of the 8th segment after time step done,
12. we can use the finite difference scheme to come up with this equation right here.
13. This equation tells us that the temperature after the time step, right here, is equal to the temperature
14. before the time step plus this term, which we can see depends on
15. the initial temperatures of the 7th, 9th and 8th segments.
16. This is obviously an explicit method for calculating T₈(h), but just for a change of pace
17. since this is a pretty unstable solution, we're going to try an implicit method instead.
18. Remember that implicit means that you're going to have this term over on this side as well.
19. So we're just going to switch all these 0s to h's.
20. We're going to use this implicit method, of course, converting it to code in this problem.
21. One problem that we have to deal with is how to end with segments in other end of our wire.
22. Both of these have an adjacent segment to one direction but not to the other.
23. Since the segments start at 0 and count to 99, our problem was explicitly
24. is that we don't have a segment numbered -1 nor a segment number 100.
25. To deal with this, we're just going to set the value of T₋₁ to equal T₀
26. and similarly for T₁₀₀ set in out to T₉₉.
27. This is going to be true for all times t.
28. Your main job in this problem is going to be to define the coefficient
29. for every equation in the set of equations right here.
30. Each equation involves an expression, which is just the sum of all the different temperatures
31. of every segment along with some coefficients stuck in front of certain one,
32. and all these equals the initial temperature at that certain segment.
33. There seem to be the set of a 100 different equations.
34. If we're going to consider this system of equations as a whole,
35. we can actually think of it more conveniently as dealing with matrices.
36. This website right here numpy.matalg.solve deals with equations involving matrices.
37. We have a matrix as the coefficients which are all these pink question marks
38. multiplied by a single column factor, which contains all the temperatures after time step each.
39. These multiplied together equals this vector, which contains all the initial values of the temperatures.
40. As we already know the temperatures at times 0 and you have created a matrix of coefficients,
41. we can use this method numpy.matalg.solve and input the main information
42. and solve the vector that we want--the one containing the temperatures after time step h.
43. Taking a look at our supplied code, we can see that we've created an initial temperature distribution for you.
44. We've also created a parameter for you called c, which I think if you look back at the
45. finite difference formula, you'll see if's going to be very useful for you.
46. As I told you earlier, your first task is going to fill in the array named
47. coefficients with the appropriate values.
48. Remember, a lot of the coefficients will be 0.
49. Another hint that I want to give you is that using for loops could be a great way
50. to fill in your coefficients to all the different slots in the matrix.
51. Once coefficients are filled in, come back up to the step size and set it to 0.5 and then submit.
52. In the end, you should have a curve that looks nice and smooth like this
53. despite the pretty large step size that we're going to be using.