A4 Python for engineers · Practice
Arrays with NumPy
Problems dealt one at a time, with new numbers every time. The kinds you miss come back more often, and you can keep going as long as you like.
Check
Make t, 2001 evenly spaced times from 0 to 0.05 s, and v, the voltage at each of them. Then set vmax to the largest value in v.
A = 4 and f = 50 are already defined.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
The samples in v cover exactly 4 cycles of a sine of amplitude 8. Compute their RMS value as rms.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
The array E12 holds the E12 values in one decade. Set nearest to the E12 resistor, in ohms, nearest to target = 5300 Ω. (Look in the decade that contains the target.)
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
The starter samples V every 0.1 µs for one period. Use np.diff to set slope to the rate of change between successive samples (in volts per second), and slew to its largest size. Then set rel to how far slew is from the exact peak rate , as a fraction.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
For 4000 samples of over exactly 4 cycles, set frac to the fraction of samples above 0.7 × 4.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
Set s to the sum of the squares of the whole numbers from 1 to 21, using np.arange.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
Check
I holds 500 current samples. Set P_avg to the average power they deliver to a 52 Ω resistor.
Python 3.14 with numpy and matplotlib, running in your browser. Tab indents; press Esc and then Tab to move on.
A kind of problem counts as solid once you've got it right on the first try twice in a row. Back to the lesson · Practice every topic in A4