====== Differences ====== This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
gibson:teaching:spring-2016:math445:lab7 [2016/03/07 10:14] gibson |
gibson:teaching:spring-2016:math445:lab7 [2016/03/12 06:39] (current) gibson |
||
---|---|---|---|
Line 5: | Line 5: | ||
* learn the most widely-used algorithm for solving nonlinear equations | * learn the most widely-used algorithm for solving nonlinear equations | ||
* solve a practical, real-world problem involving a nonlinear equation | * solve a practical, real-world problem involving a nonlinear equation | ||
+ | * learn about anonymous functions | ||
* gain more experience in programming with ''for'' loops and ''if'' statements | * gain more experience in programming with ''for'' loops and ''if'' statements | ||
Line 13: | Line 14: | ||
''xguess'' using the Newton search algorithm. | ''xguess'' using the Newton search algorithm. | ||
- | You Newton search algorithm should | + | Your Newton search algorithm should |
- | - Use a ''for'' loop to perform the Newton-search iteration $x_{n+1} = x_n + \Delta x$. Take up to ten Newton steps. | + | 1. Use a ''for'' loop to perform the Newton-search iteration $x_{n+1} = x_n + \Delta x$. Take up to ten Newton-search iterations. |
- | - Use an ''if'' statement inside the ''for'' loop to test if either $|f(x)| < \epsilon$ or $|\Delta x| < \epsilon$ for some specified tolerance $\epsilon$. | + | 2. Use an ''if'' statement inside the ''for'' loop to test if either $|f(x)| < \epsilon$ or $|\Delta x| < \epsilon$ for some specified tolerance $\epsilon$. |
- | - If either of those conditions is true, use a ''break'' statement to terminate the iteration and return from the function. For our purposes $\epsilon = 10^{-7}$ is a decent choice. | + | 3. If either of those conditions is true, use a ''break'' statement to terminate the iteration and return from the function. For our purposes $\epsilon = 10^{-7}$ is a decent choice. |
---- | ---- | ||
Line 53: | Line 54: | ||
* $T_i$ is the initial soil temperature before the cold spell started, | * $T_i$ is the initial soil temperature before the cold spell started, | ||
* $\alpha$ is the thermal conductivity of the soil, and | * $\alpha$ is the thermal conductivity of the soil, and | ||
- | * $\erf$ is the {\it error function}, computed by the built-in Matlab function ''erf''. | + | * $\erf$ is the //error function//, computed by the built-in Matlab function **erf**. |
- | If $x$ is in meters and $t$ is in seconds, the $\alpha = 0.138 \times 10^{-6} \; m^2/s$. | + | If $x$ is in meters and $t$ is in seconds, the thermal conductivity of soil is |
- | Let $T_i= 20\,C$ and $T_S = -15\,C$, and recall that water freezes at $T = 0\,C$. | + | $\alpha = 0.138 \times 10^{-6} \; m^2/s$. |
+ | Let $T_i= 20\,C$ and $T_S = -15\,C$, and recall that water freezes at $T(x,t) = 0\,C$. | ||
Use your Newton-search algorithm to determine how deep a water main must be | Use your Newton-search algorithm to determine how deep a water main must be | ||
buried so that it will not freeze until at least 60 days' exposure to these | buried so that it will not freeze until at least 60 days' exposure to these | ||
conditions. | conditions. | ||
+ | |||