diff options
author | Puneeth Chaganti | 2009-11-04 09:33:37 +0530 |
---|---|---|
committer | Puneeth Chaganti | 2009-11-04 09:33:37 +0530 |
commit | 3e13b7024c7bc4a754fc2abe7267e9f0fe31fc59 (patch) | |
tree | e571f06ef39160ec33c3f5c12162f4da9107e235 /day1/session6.tex | |
parent | 9d7f28f8c6a27468827cd205c11bcfb86db95d3b (diff) | |
download | workshops-3e13b7024c7bc4a754fc2abe7267e9f0fe31fc59.tar.gz workshops-3e13b7024c7bc4a754fc2abe7267e9f0fe31fc59.tar.bz2 workshops-3e13b7024c7bc4a754fc2abe7267e9f0fe31fc59.zip |
Changes to session1, 5 and 6 at Goa.
Diffstat (limited to 'day1/session6.tex')
-rwxr-xr-x[-rw-r--r--] | day1/session6.tex | 35 |
1 files changed, 15 insertions, 20 deletions
diff --git a/day1/session6.tex b/day1/session6.tex index 0b5f681..06e2eb0 100644..100755 --- a/day1/session6.tex +++ b/day1/session6.tex @@ -138,7 +138,7 @@ We shall use the simple ODE of a simple pendulum. \dot{\theta} &= \omega \\ \dot{\omega} &= -\frac{g}{L}sin(\theta) \\ \text{At}\ t &= 0 : \nonumber \\ - \theta = \theta_0\quad & \&\quad \omega = 0 \nonumber + \theta = \theta_0(10^o)\quad & \&\quad \omega = 0\ (Initial\ values)\nonumber \end{align} \end{frame} @@ -149,9 +149,9 @@ We shall use the simple ODE of a simple pendulum. \item Define a function as below \end{itemize} \begin{lstlisting} -In []: def pend_int(unknown, t, p): - .... theta, omega = unknown - .... g, L = p +In []: def pend_int(initial, t): + .... theta, omega = initial + .... g, L = -9.81, 0.2 .... f=[omega, -(g/L)*sin(theta)] .... return f .... @@ -162,25 +162,22 @@ In []: def pend_int(unknown, t, p): \frametitle{Solving ODEs using SciPy \ldots} \begin{itemize} \item \typ{t} is the time variable \\ -\item \typ{p} has the constants \\ \item \typ{initial} has the initial values \end{itemize} \begin{lstlisting} In []: t = linspace(0, 10, 101) -In []: p=(-9.81, 0.2) In []: initial = [10*2*pi/360, 0] -\end{lstlisting} +\end{lstlisting} \end{frame} \begin{frame}[fragile] \frametitle{Solving ODEs using SciPy \ldots} -\begin{small} - \typ{In []: from scipy.integrate import odeint} -\end{small} +%%\begin{small} +\typ{In []: from scipy.integrate import odeint} +%%\end{small} \begin{lstlisting} In []: pend_sol = odeint(pend_int, - initial,t, - args=(p,)) + initial,t) \end{lstlisting} \end{frame} @@ -308,14 +305,13 @@ In []: pend_sol = odeint(pend_int, \begin{frame}[fragile] \frametitle{Initial Estimates \ldots} \begin{lstlisting} - In []: def our_f(x): - ....: return cos(x)-x**2 - ....: - In []: x = linspace(-pi/2, pi/2, 11) +In []: def our_f(x): + ....: return cos(x) - x*x + ....: +In []: x = linspace(-pi/2, pi/2, 11) +In []: y = our_f(x) \end{lstlisting} -\begin{itemize} -\item Get the intervals of x, where sign changes occur -\end{itemize} +Get the intervals of x, where sign changes occur \end{frame} \begin{frame}[fragile] @@ -335,7 +331,6 @@ Now use Newton-Raphson? \frametitle{Scipy Methods - \typ{roots}} \begin{itemize} \item Calculates the roots of polynomials -\item Array of coefficients is the only parameter \end{itemize} \begin{lstlisting} In []: coeffs = [1, 6, 13] |