Teaching Physics With Python - Institute Of Physics

Transcription

Teaching Physics with PythonTeaching Physics with PythonLouise Dashlouise.dash@ucl.ac.uk@louisedashDepartment of Physics and Astronomy, UCL2 June 2015Louise Dash (UCL)2 June 2015

Teaching Physics with PythonOutline1ContextLouise Dash (UCL)2 June 2015

Teaching Physics with PythonOutline1Context2Why Python?Louise Dash (UCL)2 June 2015

Teaching Physics with PythonOutline1Context2Why Python?3ChallengesLouise Dash (UCL)2 June 2015

Teaching Physics with PythonOutline1Context2Why Python?3Challenges4The coursesLouise Dash (UCL)2 June 2015

Teaching Physics with PythonOutline1Context2Why Python?3Challenges4The courses5More challenges (and successes)Louise Dash (UCL)2 June 2015

Teaching Physics with PythonOutline1Context2Why Python?3Challenges4The courses5More challenges (and successes)6The futureLouise Dash (UCL)2 June 2015

Teaching Physics with PythonOutline1Context2Why Python?3Challenges4The courses5More challenges (and successes)6The future7ConclusionsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonContextOutline1Context2Why Python?3Challenges4The courses5More challenges (and successes)6The future7ConclusionsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonContextContextNearing the end of a total reorganization of our core computingcoursesLouise Dash (UCL)2 June 2015

Teaching Physics with PythonContextContextNearing the end of a total reorganization of our core computingcoursesPrevious courses were an “evolved over time” mishmash of Matlab,Excel, Mathematica, IDLLouise Dash (UCL)2 June 2015

Teaching Physics with PythonContextContextNearing the end of a total reorganization of our core computingcoursesPrevious courses were an “evolved over time” mishmash of Matlab,Excel, Mathematica, IDL2013-2014: Introduction of brand new Python course for first year“Practical physics 1A” moduleLouise Dash (UCL)2 June 2015

Teaching Physics with PythonContextContextNearing the end of a total reorganization of our core computingcoursesPrevious courses were an “evolved over time” mishmash of Matlab,Excel, Mathematica, IDL2013-2014: Introduction of brand new Python course for first year“Practical physics 1A” module2014-2015: Introduction of follow-on Python course for second year“Practical physics 2B” moduleLouise Dash (UCL)2 June 2015

Teaching Physics with PythonContextContextNearing the end of a total reorganization of our core computingcoursesPrevious courses were an “evolved over time” mishmash of Matlab,Excel, Mathematica, IDL2013-2014: Introduction of brand new Python course for first year“Practical physics 1A” module2014-2015: Introduction of follow-on Python course for second year“Practical physics 2B” moduleNow integrating computing into other parts of the curriculumLouise Dash (UCL)2 June 2015

Teaching Physics with PythonContextMotivationHistorically, computation has been a “poor relation” in the physicscurriculumLouise Dash (UCL)2 June 2015

Teaching Physics with PythonContextMotivationHistorically, computation has been a “poor relation” in the physicscurriculumNot seen as particularly accessible to undergraduate studentsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonContextMotivationHistorically, computation has been a “poor relation” in the physicscurriculumNot seen as particularly accessible to undergraduate studentsHence of limited usefulness to students!Louise Dash (UCL)2 June 2015

Teaching Physics with PythonContextMotivationHistorically, computation has been a “poor relation” in the physicscurriculumNot seen as particularly accessible to undergraduate studentsHence of limited usefulness to students!However.Modern languages like Python make computation much more accessible tothe non-specialist.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?Outline1Context2Why Python?3Challenges4The courses5More challenges (and successes)6The future7ConclusionsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?Why Python?It’s free, and open sourceLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?Why Python?It’s free, and open source“Easy” to learn, user-friendly, gateway languageLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?Why Python?It’s free, and open source“Easy” to learn, user-friendly, gateway languageEasy to installLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?Why Python?It’s free, and open source“Easy” to learn, user-friendly, gateway languageEasy to installMarketable, transferable skill beyond physicsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?Why Python?It’s free, and open source“Easy” to learn, user-friendly, gateway languageEasy to installMarketable, transferable skill beyond physicsSee Louise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?Why Python?It’s free, and open source“Easy” to learn, user-friendly, gateway languageEasy to installMarketable, transferable skill beyond physicsSee Easy to create 3d animations and models with “visual” VpythonmoduleLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?VpythonLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?VpythonLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?VpythonLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?Why Python?It’s free, and open source“Easy” to learn, user-friendly, gateway languageEasy to installMarketable, transferable skill beyond physicsSee Easy to create 3d animations and models with “visual” VpythonmoduleIPython NotebookLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?Why Python?It’s free, and open source“Easy” to learn, user-friendly, gateway languageEasy to installMarketable, transferable skill beyond physicsSee Easy to create 3d animations and models with “visual” VpythonmoduleIPython NotebookLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?The IPython NotebookLouise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?The IPython NotebookText commentary encouragesstudents to think clearly aboutwhat they are doing and why.from a coding and from aphysics point of view.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?The IPython NotebookText commentary encouragesstudents to think clearly aboutwhat they are doing and why.from a coding and from aphysics point of view.Also ideal for use as aninteractive session script.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonWhy Python?The IPython NotebookText commentary encouragesstudents to think clearly aboutwhat they are doing and why.from a coding and from aphysics point of view.Also ideal for use as aninteractive session script.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesOutline1Context2Why Python?3Challenges4The courses5More challenges (and successes)6The future7ConclusionsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesChallengesNo prerequisite for computing!Louise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesChallengesNo prerequisite for computing!Wide range of abilities, backgrounds and experiencesLouise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesChallengesNo prerequisite for computing!Wide range of abilities, backgrounds and experiences70% have no prior programming experienceLouise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesChallengesNo prerequisite for computing!Wide range of abilities, backgrounds and experiences70% have no prior programming experienceSimilarly, wide range of confidence with computersLouise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesChallengesNo prerequisite for computing!Wide range of abilities, backgrounds and experiences70% have no prior programming experienceSimilarly, wide range of confidence with computers65% say they are confident or very confident with computingLouise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesChallengesNo prerequisite for computing!Wide range of abilities, backgrounds and experiences70% have no prior programming experienceSimilarly, wide range of confidence with computers65% say they are confident or very confident with computingNo obvious correlation between achievement and confidenceLouise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesChallengesNo prerequisite for computing!Wide range of abilities, backgrounds and experiences70% have no prior programming experienceSimilarly, wide range of confidence with computers65% say they are confident or very confident with computingNo obvious correlation between achievement and confidenceLarge gender effect in confidence (no gap in outcomes)Louise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesChallengesNo prerequisite for computing!Wide range of abilities, backgrounds and experiences70% have no prior programming experienceSimilarly, wide range of confidence with computers65% say they are confident or very confident with computingNo obvious correlation between achievement and confidenceLarge gender effect in confidence (no gap in outcomes)At the beginning they don’t know much physics or maths either.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonChallengesChallengesNo prerequisite for computing!Wide range of abilities, backgrounds and experiences70% have no prior programming experienceSimilarly, wide range of confidence with computers65% say they are confident or very confident with computingNo obvious correlation between achievement and confidenceLarge gender effect in confidence (no gap in outcomes)At the beginning they don’t know much physics or maths either.Computing notoriously hard to teach, and to assess (see work of MarkGuzdial, https://computinged.wordpress.com/Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesOutline1Context2Why Python?3Challenges4The courses5More challenges (and successes)6The future7ConclusionsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: First year courseRuns in first term of the first yearLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: First year courseRuns in first term of the first yearEmphasis on basic skill requirements:Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: First year courseRuns in first term of the first yearEmphasis on basic skill requirements:Present and analyse lab data:Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: First year courseRuns in first term of the first yearEmphasis on basic skill requirements:Present and analyse lab data:Plotting, straight line fit from first principlesLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: First year courseRuns in first term of the first yearEmphasis on basic skill requirements:Present and analyse lab data:Plotting, straight line fit from first principlesComputational models using Vpython.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: First year courseRuns in first term of the first yearEmphasis on basic skill requirements:Present and analyse lab data:Plotting, straight line fit from first principlesComputational models using Vpython.mostly based on classical mechanicsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.More advanced data analysisLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.More advanced data analysisNon-linear fitting, χ2 analysis, analysis of residualsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.More advanced data analysisNon-linear fitting, χ2 analysis, analysis of residualsComputational physicsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.More advanced data analysisNon-linear fitting, χ2 analysis, analysis of residualsComputational physicsMatrix calculations (but not quantum mechanics.)Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.More advanced data analysisNon-linear fitting, χ2 analysis, analysis of residualsComputational physicsMatrix calculations (but not quantum mechanics.)Runge Kutta methodsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.More advanced data analysisNon-linear fitting, χ2 analysis, analysis of residualsComputational physicsMatrix calculations (but not quantum mechanics.)Runge Kutta methodsFast Fourier transformsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.More advanced data analysisNon-linear fitting, χ2 analysis, analysis of residualsComputational physicsMatrix calculations (but not quantum mechanics.)Runge Kutta methodsFast Fourier transformsMake use of both inbuilt libraries as black boxes and coding fromscratch.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.More advanced data analysisNon-linear fitting, χ2 analysis, analysis of residualsComputational physicsMatrix calculations (but not quantum mechanics.)Runge Kutta methodsFast Fourier transformsMake use of both inbuilt libraries as black boxes and coding fromscratch.Eg Fourier transforms: start with hand-coded discrete Fouriertransform.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe coursesWhat we did: Second year courseRuns in second term of the second yearThey’ve forgotten most of what they did in the first year.More advanced data analysisNon-linear fitting, χ2 analysis, analysis of residualsComputational physicsMatrix calculations (but not quantum mechanics.)Runge Kutta methodsFast Fourier transformsMake use of both inbuilt libraries as black boxes and coding fromscratch.Eg Fourier transforms: start with hand-coded discrete Fouriertransform.Compare and contrast with inbuilt (numpy) FFT librariesLouise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)Outline1Context2Why Python?3Challenges4The courses5More challenges (and successes)6The future7ConclusionsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)More challenges!Computing really hard to assess objectively and consistently,Louise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)More challenges!Computing really hard to assess objectively and consistently,especially with a team of markers.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)More challenges!Computing really hard to assess objectively and consistently,especially with a team of markers.Moodle / Turnitin rubrics very useful but not perfectLouise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)More challenges!Computing really hard to assess objectively and consistently,especially with a team of markers.Moodle / Turnitin rubrics very useful but not perfectFirst year course in particular challengingLouise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)More challenges!Computing really hard to assess objectively and consistently,especially with a team of markers.Moodle / Turnitin rubrics very useful but not perfectFirst year course in particular challengingHow to stretch experienced students without freaking out the lessconfident?Louise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)More challenges!Computing really hard to assess objectively and consistently,especially with a team of markers.Moodle / Turnitin rubrics very useful but not perfectFirst year course in particular challengingHow to stretch experienced students without freaking out the lessconfident?Wide availability of “self-teach” material a double-edged swordLouise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)More challenges!Computing really hard to assess objectively and consistently,especially with a team of markers.Moodle / Turnitin rubrics very useful but not perfectFirst year course in particular challengingHow to stretch experienced students without freaking out the lessconfident?Wide availability of “self-teach” material a double-edged swordStudents considerably more anxious about marks than understandingthe conceptsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)More challenges!Computing really hard to assess objectively and consistently,especially with a team of markers.Moodle / Turnitin rubrics very useful but not perfectFirst year course in particular challengingHow to stretch experienced students without freaking out the lessconfident?Wide availability of “self-teach” material a double-edged swordStudents considerably more anxious about marks than understandingthe conceptsIPython Notebooks and Vpython don’t work well together,frustratingly!Louise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)SuccessesReal progress seen by end of2nd yearLouise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)SuccessesReal progress seen by end of2nd yearStudents demonstrateenhanced understanding ofphysics via computingLouise Dash (UCL)2 June 2015

Teaching Physics with PythonMore challenges (and successes)SuccessesReal progress seen by end of2nd yearStudents demonstrateenhanced understanding ofphysics via computingLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe futureOutline1Context2Why Python?3Challenges4The courses5More challenges (and successes)6The future7ConclusionsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe futureIntegrating computing within the curriculumAlready using IPython notebooks within lecture courses as interactivelecture notes (David Bowler)Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe futureIntegrating computing within the curriculumAlready using IPython notebooks within lecture courses as interactivelecture notes (David Bowler)1st year, term 2: Waves and optics (mostly plots)Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe futureIntegrating computing within the curriculumAlready using IPython notebooks within lecture courses as interactivelecture notes (David Bowler)1st year, term 2: Waves and optics (mostly plots)3rd year: Quantum mechanics - making use of matrix mechanicsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe futureIntegrating computing within the curriculumAlready using IPython notebooks within lecture courses as interactivelecture notes (David Bowler)1st year, term 2: Waves and optics (mostly plots)3rd year: Quantum mechanics - making use of matrix mechanicsSome more challenges here:Louise Dash (UCL)2 June 2015

Teaching Physics with PythonThe futureIntegrating computing within the curriculumAlready using IPython notebooks within lecture courses as interactivelecture notes (David Bowler)1st year, term 2: Waves and optics (mostly plots)3rd year: Quantum mechanics - making use of matrix mechanicsSome more challenges here:Students on Natural Sciences program (and students from otherdepartments) haven’t done these computing coursesLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe futureIntegrating computing within the curriculumAlready using IPython notebooks within lecture courses as interactivelecture notes (David Bowler)1st year, term 2: Waves and optics (mostly plots)3rd year: Quantum mechanics - making use of matrix mechanicsSome more challenges here:Students on Natural Sciences program (and students from otherdepartments) haven’t done these computing coursesPartial solution: run “catch-up” conversion workshop from Matlab toPythonLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe futureThe FuturePlan to extend the use of IPython Notebooks within lecture coursesLouise Dash (UCL)2 June 2015

Teaching Physics with PythonThe futureThe FuturePlan to extend the use of IPython Notebooks within lecture coursesEarly stages of planning new lecture course where the physics will beentirely assessed by IPython Notebook computation rather thanwritten exam.Louise Dash (UCL)2 June 2015

Teaching Physics with PythonConclusionsOutline1Context2Why Python?3Challenges4The courses5More challenges (and successes)6The future7ConclusionsLouise Dash (UCL)2 June 2015

Teaching Physics with PythonConclusionsConclusionsHave rewritten core computing courses in years 1 and 2Acknowledgments:Demonstrator teams on PHAS1240 and PHAS2441Dr David Bowler (lecturing with IPython Notebooks)Louise Dash (UCL)2 June 2015

Teaching Physics with PythonConclusionsConclusionsHave rewritten core computing courses in years 1 and 2Extensive use of IPython notebooks enable enhanced understandingof physicsAcknowledgments:Demonstrator teams on PHAS1240 and PHAS2441Dr David Bowler (lecturing with IPython Notebooks)Louise Dash (UCL)2 June 2015

Teaching Physics with PythonConclusionsConclusionsHave rewritten core computing courses in years 1 and 2Extensive use of IPython notebooks enable enhanced understandingof physicsExtending this to fully embed computational physics within thecurriculumAcknowledgments:Demonstrator teams on PHAS1240 and PHAS2441Dr David Bowler (lecturing with IPython Notebooks)Louise Dash (UCL)2 June 2015

2014-2015: Introduction of follow-on Python course for second year \Practical physics 2B" module Now integrating computing into other parts of the curriculum Louise Dash (UCL) 2 June 2015. Teaching Physics with Python Context Motivation Historically, computation has been a \poor relation" in the physics