filmov
tv
Python: numpy arrays vs. lists
![preview_player](https://i.ytimg.com/vi/aytwK2kpKIg/maxresdefault.jpg)
Показать описание
If you want to do some awesome stuff with python for your physics course, you might need a solid understanding of lists. Here's the test:
1. Make a list of x values from 0 to 2 with spacing 0.2.
2. Make a list of function values for those same x’s such that f(x) = A*sin(k*x). Pick k such that f(0) = f(2) = 0. Let A = 1.
3. Plot f(x) vs. x. Yes, the function from question 2.
4. Make a new list and call it f2(x). Set the values equal to f(x).
5. Find the integral of f(x)dx from 0 to 2. Set this equal to I
6. Change f2(x) so that it’s integral f2(x)dx is equal to 1.
7. Make a new function f3(x) = x^2-bx. Create an animated graph as b goes from 0 to 4 using a increment in b of 0.1
here is the code