File tree 1 file changed +7
-6
lines changed 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -94,17 +94,18 @@ \subsection{Native SymPy Support}
94
94
95
95
\pagebreak
96
96
97
- \subsection {Block of code }
97
+ \subsection {Code block with a plot }
98
98
99
- ... with a plot:
99
+ The session is \verb |pycode | to be distinct from the \verb |default | session.
100
+ This allows \pytex \ to speed up the execution by running the sympy code and the plot below in parallel.
100
101
101
- \begin {pycode }
102
+ \begin {pycode }[pycode]
102
103
from pylab import *
103
104
# Define f(t), the desired function to plot
104
105
def f(t):
105
- return cos(2 * pi * t ) * exp(-t)
106
+ return cos(2 * pi * exp(t) ) * exp(-t)
106
107
# Generate the points (t_i, y_i) to plot
107
- t = linspace(0, 5, 500 )
108
+ t = linspace(0, 4, 1000 )
108
109
y = f(t)
109
110
# Begin with an empty plot, 5 x 3 inches
110
111
clf()
@@ -114,7 +115,7 @@ \subsection{Block of code}
114
115
# Generate the plot with annotations
115
116
plot(t, y)
116
117
title("Damped exponential decay")
117
- text(3 , 0.15 , r"$ y = \cos (2 \pi t ) e^{-t}$ ")
118
+ text(2.5 , 0.4 , r"$ y = \cos (2 \pi \exp (t) ) e^{-t}$ ")
118
119
xlabel("time (s)")
119
120
ylabel("voltage (mV)")
120
121
# Save the plot as a PDF file
You can’t perform that action at this time.
0 commit comments