atms514-hw2-mathemat..

In[14]:=
T0 = - 15
Out[14]=
In[15]:=
In[16]:=
In[17]:=
Out[17]=
In[18]:=
Out[18]=
- 15
T@t_D := T0 - 10 * Sin@2 * Pi * tD
MyDepth@t_D := 2 * [email protected] * T@tD  H243.5 + T@tDLD - Max@0, 6 + 1.2 * T@tDD
MyDepth@4D
0.627
N@Integrate@MyDepth@tD, 8t, 0, 1<DD
0.724229
Definition of PlotTraceFunction so that we can trace Mathematica coordinates
In[24]:=
In[45]:=
PlotTrace@expr_, 8var_, xmin_, xmax_<, opts___D :=
Column@8Dynamic@Block@8xval = a * Hxmax - xminL + xmin,
yval = ReleaseHold@Hold@exprD . var ® xvalD<, Column@
8Show@Plot@expr, 8var, xmin, xmax<, optsD, Graphics@Point@8xval, yval<DDD,
8xval, yval<<DD, aD, Slider@Dynamic@aDD<D;
SetAttributes@PlotTrace, HoldAllD;
Precip@t_D := If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD
Plot of SnowDepth Over Time (under simplifying assumption that accumulated snowpack *can* go
negative, which is an understandable assumption for a homework set, but has some flaws)
2
atms514-hw2.nb
In[40]:=
Animate@
Column@8"T0 = " <> ToString@T0D, PlotTrace@Integrate@If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD, 8tPrime, 0, t<D, 8t, 0, 1<,
PlotLabel ® "Snow Depth Under Assumption", AxesLabel ® 8"Time", "Snow Depth"<D<D,
8T0, - 15, - 2.5<, AnimationRunning ® FalseD
T0
T0 = -12.535
Snow Depth Under Assumption
Snow Depth
1.0
0.5
Out[40]=
0.2
-0.5
-1.0
80.476, 0.322987<
Plot of Accumulation over time
0.4
0.6
0.8
1.0
Time
atms514-hw2.nb
3
Animate@Column@8"T0 = " <> ToString@T0D, PlotTrace@If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD, 8t, 0, 1<, PlotLabel ®
"Accumulation Under Assumption", AxesLabel ® 8"Time", " Accumulation"<D<D,
8T0, - 15, - 2.5<, AnimationRunning ® FalseD
T0
T0 = -15
Accumulation Under Assumption
Out[48]=
Net Accumulation
1.4
1.2
1.0
0.8
0.6
0.4
0.0
0.2
0.4
0.6
80.476, 0.553538<
0.8
1.0
Time
Problem I’m going to have to fix sometime (regarding the ugliness of my inputs in Mathematica’s Animate functions)
4
atms514-hw2.nb
Animate@Column@8"T0 = " <> ToString@T0D,
PlotTrace@Precip@tD, 8t, 0, 1<, PlotLabel ® " Accumulation Under Assumption",
AxesLabel ® 8"Time", " Accumulation"<D<D,
8T0, - 15, - 2.5<, AnimationRunning ® FalseD
T0
T0 = -15.
Net Accumulation Under Assumption
Out[46]=
Net Accumulation
1.4
1.2
1.0
0.8
0.6
0.4
0.0
0.2
0.4
0.6
0.8
80.476, 0.553538<
1.0
Time
Plot of Accumulation Over Time (under assumption that accumulated snowpack does *not* have to go
negative!)
In[44]:=
SnowDepthWithAssumption@t_D := Integrate@If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD, 8t, 0, 1<D
atms514-hw2.nb
In[50]:=
Animate@
Column@8"T0 = " <> ToString@T0D, PlotTrace@If@If@T0 - 10 * Sin@2 * Pi * tD < 0, 2 * Exp@
17.67 * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD < 0, 0, If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLDD, 8t, 0, 1<,
PlotLabel ® " Accumulation WITHOUT Assumption",
AxesLabel ® 8"Time", " Accumulation"<D<D,
8T0, - 15, - 2.5<, AnimationRunning ® FalseD
T0
T0 = -10.035
Accumulation WITHOUT Assumption
Accumulation
1.4
1.2
1.0
0.8
Out[50]=
0.6
0.4
0.2
0.2
80.476, 0.83051<
In[52]:=
0.4
0.6
0.8
1.0
Time
Animate@
Column@8"T0 = " <> ToString@T0D, PlotTrace@Integrate@If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD, 8tPrime, 0, t<D, 8t, 0, 1<,
PlotLabel ® "Snow Depth Under Assumption", AxesLabel ® 8"Time", "Snow Depth"<D<D,
8T0, - 15, - 2.5<, AnimationRunning ® FalseD
T0
5
6
atms514-hw2.nb
T0 = -10.035
Snow Depth Under Assumption
Snow Depth
1
0.2
Out[52]=
-1
-2
-3
80.476, 0.395323<
0.4
0.6
atms514-hw2.nb
In[56]:=
Manipulate@
Column@8"T0 = " <> ToString@T0D, PlotTrace@Integrate@If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD, 8tPrime, 0, t<D,
8t, 0, 1<, PlotLabel ® "Snow Depth Under Assumption",
AxesLabel ® 8"Time", "Snow Depth"<D<D, 8T0, - 15, - 2.5<D
7
8
atms514-hw2.nb
T0
-2.5
T0 = -2.5
Snow Depth Under Assumption
Snow Depth
0.2
-2
-4
Out[56]=
-6
-8
-10
80.476, 0.138681<
Snow Depth WITHOUT Assumption - slightly botched though
0.4
atms514-hw2.nb
In[57]:=
9
Manipulate@
Column@8"T0 = " <> ToString@T0D, PlotTrace@Integrate@If@If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD < 0, 0, If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLDD, 8tPrime, 0, t<D,
8t, 0, 1<, PlotLabel ® " Snow Depth WITHOUT Assumption",
AxesLabel ® 8"Time", " Accumulation"<D<D, 8T0, - 15, - 2.5<D
10
atms514-hw2.nb
T0
-12.5
T0 = -12.5
Snow Depth WITHOUT Assumption
Accumulation
1.2
1.0
0.8
Out[57]=
0.6
0.4
0.2
80.476, 0.323912<
0.2
0.4
atms514-hw2.nb
In[55]:=
11
Show@Animate@Column@
8"T0 = " <> ToString@T0D, PlotTrace@Integrate@If@If@T0 - 10 * Sin@2 * Pi * tD < 0, 2 *
[email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD < 0, 0, If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLDD, 8tPrime, 0, t<D,
8t, 0, 1<, PlotLabel ® " Snow Depth WITHOUT Assumption",
AxesLabel ® 8"Time", " Accumulation"<D<D,
8T0, - 15, - 2.5<, AnimationRunning ® FalseD, Animate@
Column@
8"T0 = " <> ToString@T0D,
PlotTrace@Integrate@If@T0 - 10 * Sin@2 * Pi * tD < 0,
2 * [email protected] * HT0 - 10 * Sin@2 * Pi * tDL  H243.5 + HT0 - 10 * Sin@2 * Pi * tDLLD, 0D Max@0, 6 + 1.2 * HT0 - 10 * Sin@2 * Pi * tDLD, 8tPrime, 0, t<D, 8t, 0, 1<,
PlotLabel ® "Snow Depth Under Assumption", AxesLabel ® 8"Time", "Snow Depth"<D<D,
8T0, - 15, - 2.5<, AnimationRunning ® FalseDD