-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathNnnCCPxx-2.tex
282 lines (257 loc) · 13.7 KB
/
NnnCCPxx-2.tex
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
% !TEX program = lualatexmk
% !TEX encoding = UTF-8 Unicode
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 80 columns %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% INSTRUCTIONS FOR OVERLEAF USERS:
%
% 1. Create a new, empty Overleaf project. Name it "mandi template" or
% something similar.
% 2a. mandi version 3.22 is included with TeX Live 2024 and is available on
% Overleaf. If you want to use this version, all you need are the files
% NnnCCPxx-1.tex and NnnCCPxx-2.tex. If you have a free Overleaf account,
% choose NnnCCPxx-1.tex. If you have a paid account, choose NnnCCPxx-2.tex.
% The reason is that free accounts are limited to a fixed number of compiler
% passes per document before timing out. A free account should be all a
% typical introductory physics student needs.
% 2b. Overleaf only updates TeX Live once per year and mandi may have changed
% to a version not included in TeX Live. In that case, you will need the
% file(s) from part a) and additionally the files mandi.sty,
% mandistudent.sty, and mandiexp.sty.
% 2c. The file mandi.pdf is the official bundle documentation, but Overleaf
% will not let you view it so you need not upload it. Instead, open it in a
% tab in your browser. Alternatively, you can view the documentation online
% by going to https://texdoc.org/ and searching for mandi and opening the
% resulting PDF file in your browser.
% 2d. Upload the files you need to your new empty project folder on Overleaf.
% 3. From inside the project folder, click the Menu button in the upper
% left corner and set Compiler to LuaLaTeX, TeX Live Version to the
% latest available, and Main document to NnnCCPxx-1.tex (for free
% accounts) or NnnCCPxx-2 (for paid accounts). Other options may be set
% as desired. Dismiss the configuration window by clicking anywhere on its
% exterior.
% 4. Click the NnnCCPxx-1.tex (or NnnCCPxx-2.tex) file so that it is selected.
% Now click Recompile and a newly created PDF document should appear.
% 5. At this point you have a clean, original project to use as a template.
% 6. Make a new copy of your newly created "mandi template" (or whatever you
% named it) project. Name it NnnCCPxx by replacing Nnn with your last name
% (e.g. Heafner, Rodriguez, Nguyen, Jackson, Lee, etc.), replacing CC with a
% two digit chapter number (e.g. 03), leaving P unchanged, and xx is a two
% or three digit problem number (e.g. 25, 025, 101, etc.). With modern
% filesystems practically any names can be accommodated.
% 7. From inside this newly created project, rename the NnnCCPxx-1.tex (or
% NnnCCPxx-2.tex) file using the same convention as in the previous step.
% 8. The file is now ready for editing and writing up a problem solution.
% Your instructor will provide details.
% 9. You can copy the new files to your projects from within your projects if
% you want to. Doing so may necessitate editing your existing documents.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 80 columns %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[10pt]{article}
\usepackage{mandi} % load mandi
\usepackage{mandistudent} % load mandistudent
\usepackage{mandiexp} % load mandiexp
\usepackage{numerica} % for computation
\usepackage{geometry} % for changing page layout
\usepackage{doi} % for DOIs in references
\usepackage{mwe} % for demo images
\usepackage{pgfplots} % for plots
\pgfplotsset{compat=newest} % for plots
\hypersetup{colorlinks} % color hyperlinks
%---------- DO NOT EDIT THESE LINES!
% See https://tex.stackexchange.com/q/156383/218142
\newcommand*{\pkg}[1]{\textsf{#1}} % typeset package names
\newcommand*{\mandi}{\textsf{mandi}} % typeset mandi
\newcommand*{\mandistudent}{\textsf{mandistudent}} % typeset mandistudent
\newcommand*{\mandiexp}{\textsf{mandiexp}} % typeset mandiexp
\newcommand*{\WebVPython}{\texttt{Web VPython}} % typeset WebVPython
\newcommand*{\WebVPythonorg}{\texttt{WebVPython.org}} % typeset WebVPython.org
\newcommand*{\VPython}{\texttt{VPython}} % typeset VPython
\newcommand*{\VPythonorg}{\texttt{VPython.org}} % typeset VPython.org
\newcommand*{\gsurl}{webvpython.org} % WebVPython URL
\newcommand*{\vpurl}{vpython.org} % VPython URL
\newcommand*{\lualatex}{Lua\LaTeX} % typeset LuaLaTeX
%---------- END
%---------- DOCUMENT MARGINS (EDIT TO SUIT)
\geometry{margin=0.5in,top=1.5in,bottom=1.5in}
%---------- END DOCUMENT MARGINS
%---------- STUDENT INFORMATION (EDIT TO SUIT)
\newcommand{\assignment}{ASSIGNMENT TITLE} % Edit this appropriately.
\newcommand{\authorname}{Your Name} % Edit this to use your name.
%---------- END STUDENT INFORMATION
\begin{document}
\title{\assignment}
\author{\authorname}
\maketitle
\thispagestyle{empty}
\centerline{Using \mandi{} version \mandiversion}
\centerline{Using \mandistudent{} version \mandistudentversion}
\centerline{Using \mandiexp{} version \mandiexpversion}
\listofwebvpythonprograms
\listoffigures
\newpage
%---------- YOUR WORK (EDIT TO SUIT)
\begin{physicsproblem}{PROBLEM TITLE HERE}
Every document must have only ONE problem. You can have as many problem parts as you need.
Each part will need a \normalfont{\ttfamily{\small{physicssolution}}} environment \emph{only}
if extended mathematical content is necessary. You can cite a reference\cite{Kap86} if
appropriate. This sample problem is about the Lorentz factor \( \gamma \).
\begin{parts}
\problempart
This is an example of how you would typeset a response that does not require a multistep
mathematical solution. You can include inline mathematics such as
\( \vec{p}=m\gamma\vec{v} \) and you can cite a reference\cite{Cha19}
if appropriate. If you were asked to state whether the Lorentz factor \( \gamma \)
is a scalar or a vector, you would simply state: The Lorentz factor is a scalar.
\problempart
Here is a sample mathematical solution requiring multiple steps. Let's calculate the
Lorentz factor for a speed of \( \velocityc{0.986} \).
% Set up constants for numerica to use
\nmcConstants{v=0.986}
\begin{physicssolution}
\gamma &= \frac{1}{\sqrt{1-\frac{\vec{v}\cdot\vec{v}}{\lightspeed^{2}}}}
\reason{definition of \(\gamma\)} \\
\vec{v}\cdot\vec{v} &= \magnitude{\vec{v}}^{2}
\reason{dot product and magnitude squared} \label{step:2} \\
\vec{v}\cdot\vec{v} &= (\velocityc{0.986})^{2}
\reason{need to use given value} \\
\gamma &= \frac{1}{\sqrt{1-\frac{(\velocityc{0.986})^{2}}{\lightspeed^{2}}}}\label{step:4}
\reason{substitute numerical values} \\
\gamma &= \frac{1}{\sqrt{1-(0.986)^{2}}}
\reason{factors of \( \lightspeed \) divide out} \\
\therefore \gamma &\approx \fpeval{round(1/sqrt(1-0.986^2),3)}\label{step:6}
\reason{final answer using \LaTeX's \texttt{fpeval}} \\
\therefore \gamma &\approx \eval{1/\sqrt{1-v^{2}}}[3]\label{step:7}
\reason{final answer using \pkg{numerica}'s \texttt{eval}}
\end{physicssolution}
We gave some steps labels so we can refer back to them. Step \ref{step:2} should be
familiar to you. Step \ref{step:4} illustrates why setting \( \lightspeed = 1 \) is
handy. Steps \ref{step:6} and \ref{step:7} show how to get \LaTeX{} to do computation
for you two different ways. Remember that great minds\cite{Cha15}\cite{Jac99}
think alike. Blogs\cite{Hea19} are cool too. Other journals\cite{Cro15} can be cited.
\problempart
Now, in this part, you are asked to make a plot showing \( \gamma \) as a function
of speed and to highlight the value of \( \gamma \) for a speed of
\( \velocityc{0.866} \).
Here is the requested plot. Let \LaTeX{} take care of its placement for you!
\begin{figure}[ht!]
\centering
\begin{tikzpicture}
\begin{axis}[%
declare function = {%
gamma(\x) = 1/sqrt(1-\x^2);%
myx = 0.866;% pick a particular value
},%
width=0.7\textwidth,%
title style={font=\sffamily},%
title=Lorentz Factor vs. Speed,%
label style={font=\sffamily},%
xlabel=speed \(\frac{v}{c}\),%
ylabel={Lorentz factor \( \gamma \)},%
tick label style={%
font=\scriptsize,%
/pgf/number format/precision=1,%
/pgf/number format/fixed,%
/pgf/number format/fixed zerofill,%
},%
xtick={0,0.2,...,1},%
ytick={1,2,...,10},%
extra x ticks={myx},%
extra tick style={%
tick label style={%
font=\tiny,%
/pgf/number format/precision=3,%
/pgf/number format/fixed,%
/pgf/number format/fixed zerofill,%
color=red,%
},%
xticklabel shift={8pt},%
yticklabel shift={12pt},%
},%
extra y ticks={gamma(myx)},%
extra y tick style={%
tick label style={rotate=90},%
},%
xmin=0,%
xmax=1.05,%
ymin=0,%
ymax=10,%
]%
%-- main plot
\addplot[blue, very thin, smooth, domain=0:0.999, samples=200] {gamma(x)};
\addplot[blue, mark=*, mark size=0.5pt] ({myx},{gamma(myx)});
%-- vertical asymptote
\draw[red, very thin, densely dashed] (1,0) -- (1,\pgfkeysvalueof{/pgfplots/ymax});
%-- horizontal asymptote
\draw[red, very thin, densely dashed] (0,1) -- (\pgfkeysvalueof{/pgfplots/xmax},1);
%-- particular value
\draw[red, very thin] (0,{gamma(myx)}) -- (myx,{gamma(myx)});
\draw[red, very thin] (myx,0) -- (myx,{gamma(myx)});
\end{axis}
\end{tikzpicture}
\caption{Plot of Lorentz factor as a function of speed.}
\label{plot:1}
\end{figure}
Figure \ref{plot:1} is a great graph. It's captioned \nameref{plot:1} and is on page
\pageref{plot:1}. Notice the asymptotic behavior as speed approaches \(1\)
(light's speed).
Traditional figures can be included with one line of \LaTeX{} code. Again,
let \LaTeX{} handle the placement for you. The placement may not seem logical
to you, but that's okay. You can always refer directly to the figure.
\image[scale=1]{example-image-1x1}{A traditional diagram.}{fig:1}
Figure \ref{fig:1} is nice. It's captioned \nameref{fig:1} and is on
page \pageref{fig:1}.
\problempart
Finally, suppose you are asked to write and include a \WebVPython{} program.
It is simple! Once again, let \LaTeX{} handle the placement for you. The
placement may not seem logical to you, but that's okay. Unlike a traditional
figure, the program's caption will always be at the top of the program.
\textbf{Do not include the \texttt{https://} in the URL because that is
added for you!}
\begin{webvpythonblock}(glowscript.org/#/user/heafnerj/folder/mandidemo/program/placeholder)
{A Placeholder Program}
Web VPython 3.2
# This is just a placeholder.
# It is part of the mandi documentation.
sphere()
\end{webvpythonblock}
\WebVPython{} program \ref{gs:1} is nice. It's called \nameref{gs:1} and is on
page \pageref{gs:1}. Scanning the QR code, clicking the URL, or clicking anywhere
in the gray box (between the two thick horizontal black lines) will take you to
the program's source code.
\end{parts}
\end{physicsproblem}
That's the end of the physics problem itself. If you need to include a bibliography,
and you really should if you consulted extra resources, that is relatively simple too.
Study the code to see how to handle various sources. These examples are taken from
physics literature, specifically the
\href{https://pubs.aip.org/aapt/ajp}{American Journal of Physics}.
\begin{thebibliography}{100} % 100 is a random guess of the total number of references
% Am. J. Phys. one author
\bibitem{Kap86} H. Kaplan, ``The Runge-Lenz vector as an `extra' constant of the motion,''
Am. J. Phys. \textbf{54}, 157-161 (1986); \doi{10.1119/1.14713}
% Am. J. Phys. multiple authors
\bibitem{Cha19} Ruth Chabay, Bruce Sherwood, and Aaron Titus, ``A unified, contemporary
approach to teaching energy in introductory physics,'' Am. J. Phys. \textbf{87}, 504-509 (2019);
\doi{10.1119/1.5109519}
% textbook multiple authors
\bibitem{Cha15} R. Chabay and B. Sherwood, \emph{Matter \& Interactions}, 4th ed.
(John Wiley \& Sons, Hoboken, NJ, 2015).
% textbook one author
\bibitem{Jac99} John D. Jackson, \emph{Classical Electrodynamics}, 3rd ed.
(Wiley, Hoboken, NJ, 1999), pp. 464-468.
% blog post
\bibitem{Hea19} J. Heafner, ``Vector Formalism in Introductory Physics VI: A Unified Solution
for Simple Dot Product and Cross Product Equations.'' (2019)
<\url{https://tensortime.sticksandshadows.net/archives/4924}>.
% Phys. Teach. one author
\bibitem{Cro15} R. Cross, ``Precession of a spinning ball rolling down an inclined plane,''
Phys. Teach. \textbf{53}, 217-219 (2015); \doi{10.1119/1.4914559}
% software portal
\bibitem{Wvp} \WebVPython, <\url{https://www.webvpython.org}>.
% Stack Exchange site
\bibitem{Mse18} ``Mathematica stack exchange,'' <\url{https://mathematica.stackexchange.com/q/105298}>,
accessed on August 18, 2018.
% Wikipedia
\bibitem{Wik01} <\url{https://wikipedia.org/wiki/List_of_refractive_indices}>.
\end{thebibliography}
%---------- END YOUR WORK
\end{document}\