Introduction to Python for Physicists issueshttps://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues2021-03-22T21:22:30+01:00https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/36numpy lecture: introduce transpose too2021-03-22T21:22:30+01:00Gary Steelenumpy lecture: introduce transpose toohttps://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/35but in numpy array2021-03-22T09:59:09+01:00Gary Steelebut in numpy arrayDear Pragya,
thank you for your question, and yes, you are absolutely right. I somehow missed it before, and I will correct it. (but it will not be visible to you until you reset the assignment).
Indeed if you have a 2D array, compone...Dear Pragya,
thank you for your question, and yes, you are absolutely right. I somehow missed it before, and I will correct it. (but it will not be visible to you until you reset the assignment).
Indeed if you have a 2D array, components m[i,j] will give the element from row i, column j. The correct answer should be :
m1 = np.zeros([3,3])
m1[0,:] = [1,1,0]
m1[1,:] = [0,2,1]
m1[2,:] = [1,0,1]
m2 = np.zeros([3,3])
m2[0,:] = [1,3,0]
m2[1,:] = [3,1,1]
m2[2,:] = [1,1,1]
Which will return:
[[1. 1. 0.]
[0. 2. 1.]
[1. 0. 1.]]
[[1. 3. 0.]
[3. 1. 1.]
[1. 1. 1.]]
best regards,https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/34Incorrect statement in Notebook 32020-09-10T16:49:18+02:00EDIncorrect statement in Notebook 3Just before exercise 3.8 in Notebook 3 is an example of a for loop using a random integer function that generates 100 numbers between 0 and 30. The printed statement should therefore start with "The sum of 100 random numbers..."
`print(...Just before exercise 3.8 in Notebook 3 is an example of a for loop using a random integer function that generates 100 numbers between 0 and 30. The printed statement should therefore start with "The sum of 100 random numbers..."
`print("The sum of 30 random numbers between 0 and 30 excluding those that are divisible by 5 is:", s)`https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/33Typo in notebook 32020-09-10T16:43:16+02:00EDTypo in notebook 3The following line in the markdown cell titled 'The Elif and Else statements' in Notebook 3 contains a double 'are' at the end.
`else is a command that allows you to execute some code if all of the if and all the elifs are are False.`The following line in the markdown cell titled 'The Elif and Else statements' in Notebook 3 contains a double 'are' at the end.
`else is a command that allows you to execute some code if all of the if and all the elifs are are False.`https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/30in 2a(computing):2020-08-14T23:20:10+02:00Gary Steelein 2a(computing):* Functions for creating numpy arrays: I would also create a 2d array, or is that handled later?
* for exercise 6: add making plt.hist to verify
* why not mA=np.array([[1,1,0],[0,2,1],[1,0,1]])
* exercise 8 is asking for the square root,...* Functions for creating numpy arrays: I would also create a 2d array, or is that handled later?
* for exercise 6: add making plt.hist to verify
* why not mA=np.array([[1,1,0],[0,2,1],[1,0,1]])
* exercise 8 is asking for the square root, but you need to implement the square!
and, again, for the TN2513 version of notebooks...https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/29in 1c (flow control):2020-08-14T23:19:31+02:00Gary Steelein 1c (flow control):* conditional statement where already done before with if g:
* if not 5 > 6: I would go for brackets here, if you don't know the order it could be not(5>6) or (not 5)>6. Found the brackets use just below
* with the logical operations an...* conditional statement where already done before with if g:
* if not 5 > 6: I would go for brackets here, if you don't know the order it could be not(5>6) or (not 5)>6. Found the brackets use just below
* with the logical operations and brackets, some questions are not clear.
I would rephrade in: "Compare 'not False and True' to '(not False) and True' and to 'not (False and True)' to discover the importance of brackets. BTW this can also be done with the exercise a+b/c+d, (a+b)/(c+d), a+(b/c)+d,
* exercise 6 has unfinished text. The above loop does not have a sine of a square sum, a bit unclear. Repeat the sum calculation: we just did a factorial. Range is explained after exercise 6, I really don't get what you want with the exercise6
* using modules from numpy, I would go for np.randint
Again, for TN2513 version of these notebooks...https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/28in 1b (functions):2020-08-14T23:18:33+02:00Gary Steelein 1b (functions):* just below exercise 1: you can check answers via check answers .... where is check answers? they described for students (1a scientific computing exercise 3 has answers in the code)
* exercise 2: unclear what you want changed to fiecon...* just below exercise 1: you can check answers via check answers .... where is check answers? they described for students (1a scientific computing exercise 3 has answers in the code)
* exercise 2: unclear what you want changed to fieconvert, make the multiplication factor an input variable?
* exercise 3: missed chance on using variable name=variable, for example fieconvert(var=var, fact=fact, plus=plus). Then the order does not matter.
* importing a whole module: dir(time.sleep) ## dir(sleep) gives an error
* overall: I can change the text, shouldn't that be read-only?
* after submission: grading takes > 100 s, while Udo said it should be 20 secs. Is it chacking all submissions, and not just the altered one?
1b: functions: global scope: optional for NB students?https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/26more feedback margreet2020-06-03T11:21:01+02:00Gary Steelemore feedback margreetI have a bit more feedback:
I'm used to numpy, and try to use it instead of math. I noticed -1**0.5 works, while np.sqrt(-1) gives an error (assignment 1)
for the terminal velocity function (assignment 2), I would place the constant in ...I have a bit more feedback:
I'm used to numpy, and try to use it instead of math. I noticed -1**0.5 works, while np.sqrt(-1) gives an error (assignment 1)
for the terminal velocity function (assignment 2), I would place the constant in the function instead of outside. what do you recommend the students?
with the x,y to r,phi (assignment 2): you could also input x,y in one line. Do you want your students to do that?
x,y=-1,1
x,y= input('give x,y coordinates (separated by a comma): ' ).split(',')
assignment 3, first part: I would advertise using brackets around (not True) for better overview
In notebook 4 you say row and array vectors are the same. But with for example numpy.zeros(A,B) you can get a row or column vector which are differently addressed. I noticed when making the Fibonacci sequence. Do you want to address, or skip this for now?
```
fi=np.zeros((1,22))
fi[0,0:2]=[1,1]
for ii in range(20):
fi[0,ii+2]=fi[0,ii]+fi[0,ii+1]
print(fi[0,-1])
fi=np.zeros((22,1))
fi[0]=1;
fi[1]=1;
fi[0:2]=[[1],[1]]
for ii in range(20):
fi[ii+2]=fi[ii]+fi[ii+1]
print(fi[-1])
```
In notebook exercise 4.3 I'm not sure whether I would call the students nerds (maybe it is ok for physics students). I would call them additional (not mandatory) challenges 😊
In notebook 4, 1.4 you show an impressive speed difference between build in functions. BTW using np.sum(a)/len(a) is even a few ms faster(?!). Just below you show vectorization, but unless you click the link and find out vectorization means use arrays to speed up, you miss the point of showing the intermediate steps.
In notebook5,exercise 5.3: previously you loaded v_vs_time.dat and exercise_data.dat, now you ask to compare to example.dat (which I don't have). I think you mean v_vs_time intead of example.dat.
In notebook 5, section 1.3.3 you could ask to fit the t2,v2 curve again with different initial estimators (to reinforce the importance of a good initial estimator).https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/19feedback from TAs on python part of course2019-11-11T15:55:44+01:00Gary Steelefeedback from TAs on python part of courseFYI, some feedback from TA discussion Inleidend practicum (via Jeroen):
* aansluiting Python en IE1 een stuk beter dan vorig jaar
* inlezen van Excel bestand met data behandelen (als dat volgend jaar nog noodzakelijk is met het gebruik ...FYI, some feedback from TA discussion Inleidend practicum (via Jeroen):
* aansluiting Python en IE1 een stuk beter dan vorig jaar
* inlezen van Excel bestand met data behandelen (als dat volgend jaar nog noodzakelijk is met het gebruik van digitale labjournals)
* studenten moeten leren hoe je Python moet leren (zoeken, kijken of er standaard functies zijn)
voor volgend jaar incorporeren van Python in IE1 als eindopdrachthttps://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/16idea from TAs: how to make readable code2019-09-16T17:01:50+02:00Gary Steeleidea from TAs: how to make readable codean extra notebook about good coding practices
or sections in current notebooks
Notebook 1: coding style variable names
Notebook 2: importing functions at top?an extra notebook about good coding practices
or sections in current notebooks
Notebook 1: coding style variable names
Notebook 2: importing functions at top?https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/15problem with tudelft desktops2019-09-16T16:11:31+02:00Gary Steeleproblem with tudelft desktops(1) Anaconda prompt starts in c:\
students just skip instructions and use anaconda navigator
Anaconda navigator starts up jupyter server with no command window and so it is impossible to see where it is running
* 3D Objects
*...(1) Anaconda prompt starts in c:\
students just skip instructions and use anaconda navigator
Anaconda navigator starts up jupyter server with no command window and so it is impossible to see where it is running
* 3D Objects
* Contacts
* Links
* One Drive
* Saved Games
* Searches
are only avaialble.
Student saved in One Drive on computer on day 1
Day 2: logged in on a different computer and then files not there
One drive: saves in `C:\netid\`, but does not sync because probably not configured
Feedback for next year: 100% Vocareum! No local install.https://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/14suggestion next year2019-09-13T14:18:37+02:00Gary Steelesuggestion next yearadd round(x,n) for nice printingadd round(x,n) for nice printinghttps://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/11zipfile problems2019-09-11T09:50:46+02:00Gary Steelezipfile problemsAdd more explicit instructions about downloading the zip file, moving it to "Documents", extracting it, and then navigating to the notebooks
OR: hopefully, run everything online via VocareumAdd more explicit instructions about downloading the zip file, moving it to "Documents", extracting it, and then navigating to the notebooks
OR: hopefully, run everything online via Vocareumhttps://gitlab.tudelft.nl/python-for-applied-physics/practicum-lecture-notes/-/issues/10windows sleep cannot be interrupted2019-09-11T09:37:38+02:00Gary Steelewindows sleep cannot be interruptedchange for next year, as they need to d o a restart, not stop on windows (not on mac)change for next year, as they need to d o a restart, not stop on windows (not on mac)