We can easily calculate the square of all these values with `x**2`. Cropping the
right part is a bit more tricky. First we create an index array of `1`'s and
right part is a bit more tricky. First, we create an index array of `1`'s and
`0`'s, which
indicate whether $`x \geq 2`$. This index array has the same length as our
$`x`$-grid. The first elements of the index array are `0`'s, since the
...
...
@@ -225,7 +225,7 @@ The index array can be used to select a subset of
$`y`$-values, namely all $`y`$-values, for which $`x\geq 2`$. Finally, we can
assign the value $`4`$ to this subset, and therefore
effectively crop the parabola. The implementation in python of the algorithm outlined
above is rather short.
above is rather short.
<!-- append func_plot.py -->
```python
# Calculate the regular parabola.
...
...
@@ -237,7 +237,7 @@ idx = (x >= 2)
# Set all y-values to 4, for which x >= 2.
y[idx]=4
# One can get rid of the intermetdiate index array and combine both lines into
# One can get rid of the intermediate index array and combine both lines into
# the statement y[x >= 2] = 4
```
...
...
@@ -253,7 +253,7 @@ plt.plot(x, y)
plt.xlabel("$x$")
plt.ylabel("Cropped Parabola")
# Save the figure. Various different output formats are available.
# Save the figure. Different output formats are available.
plt.savefig("cropped_parabola.eps")
```
<!-- append func_plot.py
...
...
@@ -288,7 +288,7 @@ follow $`f(x)`$.
This example is based on the code from the previous example. Copy the file from
the previous example to `data_plot.py`, such that we can append the following
code snippets to `data_plot.py`. Keep
the plotting code from the previous example as it is.
the plotting code from the last example as it is.
<!-- console
```bash
$ cp func_plot.py data_plot.py
...
...
@@ -367,7 +367,7 @@ After running `data_plot.py`, you should have a plot similar to this.

# Reading, Plotting and Fitting Experimental Data
We are given with experimental data from a radioactive decay in this example.
We are given with experimental data from radioactive decay in this example.
The experimental setup consisted of a radioactive probe, a detector, and a