This shows you the differences between two versions of the page.
| Next revision | Previous revision | ||
|
gibson:teaching:spring-2018:math445:lab7 [2018/03/19 14:48] gibson created |
gibson:teaching:spring-2018:math445:lab7 [2018/03/29 06:55] (current) gibson |
||
|---|---|---|---|
| Line 18: | Line 18: | ||
| 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. | 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. | ||
| - | 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$. | + | 2. Use an ''if'' statement inside the ''for'' loop to test if either $|f(x)| < tol$ or $|\Delta x| < tol$ for some specified tolerance $tol$. |
| - | 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. | + | 3. If either of those conditions is true, use a ''break'' statement to terminate the iteration and return from the function. For our purposes $tol = 10^{-13}$ is a decent choice. |
| ---- | ---- | ||
| Line 54: | 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 //error function//, computed by the built-in Matlab function **erf**. | + | * $\text{erf}$ is the //error function//, computed by the built-in Matlab function **erf**. |
| If $x$ is in meters and $t$ is in seconds, the thermal conductivity of soil is | If $x$ is in meters and $t$ is in seconds, the thermal conductivity of soil is | ||