Numerical Methods In Materials Science And Engineering

Transcription

NumericalMethods inMaterials Scienceand EngineeringNumerical Methods in Materials Science andEngineeringFirst DayMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityPython OverviewWhy Python?HomeworkMatthew Goodmanmgoodman@email.arizona.eduMaterials Science and EngineeringUniversity of ArizonaAugust 24, 2009Bibliography

Welcome to MSE 350NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arII am not Dr. Erdmann! He is out for the week.MSE 350 - PythonIWatch the NASA launch dt/)Python OverviewILaptop use in class is encouraged! (for programmingrelated . . . )BibliographyIThere is no assumption of previous programmingexperience . . .IPrereqs: Vector and Diff-Eq.Acedemic IntegrityWhy Python?Homework

TodayNumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arIIIThis presentation:http://u.arizona.edu/ mgoodman/Class site:http://www.u.arizona.edu/ erdmann/mse350/Plagiarism Videohttp://deanofstudents.arizona.edu/IClass overviewIHW for WednesdayMSE 350 - PythonAcedemic IntegrityPython OverviewWhy Python?HomeworkBibliography

Academic Integrity “video”Just don’t do it!NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityPython OverviewWhy Python?HomeworkBibliography

What is Python?NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityPython is a general-purpose high-level programminglanguage. Its design philosophy emphasizes code readability.Python claims to “[combine] remarkable power with veryclear syntax”, and its standard library is large andcomprehensive. Its use of indentation as block delimiters isunusual among popular programming languages.[wik, ]Python OverviewWhy Python?HomeworkBibliography

Why Python?NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic iveICross PlatformPython OverviewWhy Python?HomeworkBibliography

Why Python? – ModernNumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonIFirst Release in 1991!IUnder heavy active developmentAcedemic IntegrityPython OverviewWhy Python?HomeworkIUsed by a number of giants:IYouTube, Google, BitTorrentIYahoo!, CERN, NASA, OLPCIMost Linux/UnixBibliography

Why Python? – ModernFrom xkcd.com[xkc, ]NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityPython OverviewWhy Python?HomeworkBibliography

Why Python? – ModernWow Development!NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityPython OverviewWhy Python?HomeworkBibliography

Why Python? – ModularNumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arSome standard modules:Ios – Dealing with the operating system and filesMSE 350 - PythonAcedemic IntegrityPython OverviewIwave – Working with sound filesIgzip, tarfile, zipfile – Working with compressed filesIurllib, webbrowser – Retrieving web pages andinteracting with the local web browserIsqllite, tables, csv – Specialized database and data fileformats.Iemail, pidgin – Interface to email and chat clients.Why Python?HomeworkBibliography

Why Python? – ModularUnique problems in programming are RARE.NumericalMethods inMaterials Scienceand ting the wheel bad!MSE 350 - PythonIPython modules offer engineered solutions to commontasks.This class will focus on several modules well suited toengineering and science related endeavors:Python OverviewIIIIINumpy – Powerful array operationsScipy – Scientific librariesMatPlotLib – Plotting vi – 3d visualization (demo) lleryAcedemic IntegrityWhy Python?HomeworkBibliography

Why Python? – ModularNumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonModularity extends even to OTHER PROGRAMMINGLANGUAGESISWIG – Generates python interfaces to many languages(Java, C, C , FORTRAN, Perl . . .)ICython – Creates C code out of PythonIPyCUDA – Interface to the NVIDIA CUDA GPUcomputing platformAcedemic IntegrityPython OverviewWhy Python?HomeworkBibliography

Why Python? – ConciseNumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityIPython was designed with readability in mind.Python OverviewICode is broken up with white-spaceHomeworkIMore on this all later!BibliographyWhy Python?print “hello world”lunch options “spam, eggs, and spam”if “spam” in lunch options: print “Yay spam!”

Why Python? – PowerfulAll of the following things could be comfortablyaccomplished in less than 10 lines of code thanks to thewealth of modules available:IMonitor an industrial process and send an email in caseof disruption.NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityPython OverviewIConnect to a remote database and perform a complexquery and display/save the results.ITake the symbolic integral of a complex function.IVisualize a 2d or 3d data set with interactive displayIDownload a large number of files from a website on aautomatic schedule.ILoad an image, perform several filters and save it as adifferent format.IWrite an alarm clock with user specified wait time andmusic ramping.IMake a chat-robot that harasses your friends.Why Python?HomeworkBibliography

Why Python? – InteractiveNumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityDemo time!IInteractive helpIInteractive programmingIInteractive HPCPython OverviewWhy Python?HomeworkBibliography

Why Python? – Cross PlatformNumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityISupports all major operating systemsIIIILinuxWindows (95, XP, Vista, 7?)Mac OSXPortable code!Python OverviewWhy Python?HomeworkBibliography

HW1: Get PythonNumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityDownloading and Installing the following is your homeworkfor the next class:Ipython – the Python interpreterIipython – the interactive Python interpreterIA text editor – 100 options here . . .Python OverviewWhy Python?HomeworkBibliography

HW1: Continued . . .NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAlso, we will need the following mic IntegrityPython OverviewWhy Python?HomeworkBibliography

HW1: Made EasyNumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arYou could track down all these individual installs and files,but it is much easier to download a bulk distribution thatincludes all of these tools:IThe Enthought Python Distribution (EPD) found athttp://www.enthought.com/. (all platforms)Ipython(x,y) the “full” distribution found athttp://www.pythonxy.com/. (ia-64 not supported?)IFrom the Linux apt repositories (ask me for a packagelist) (Debian/Ubuntu)MSE 350 - PythonAcedemic IntegrityPython OverviewWhy Python?HomeworkBibliography

Completing HW1NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arThe final three steps:MSE 350 - Python1. Download the python script found here(http://www.u.arizona.edu/ mgoodman/)2. Run it3. Send a screen shot of everything working well to me atmgoodman@email.arizona.edu4. Please include your full name, and a“secret-name/moniker” under which grades will beposted (if you don’t choose one, I will and you probablywont like it)Acedemic IntegrityPython OverviewWhy Python?HomeworkBibliography

Working ConfigurationThis is good:NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityPython OverviewWhy Python?HomeworkBibliography

Lastly . . .NumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityIIf you have any trouble . . .Python OverviewIPlease also begin reading the first three sections of thepython tutorial found at:HomeworkIhttp://docs.python.org/tutorial/IWe will have covered all of that material by the end ofWednesday if all goes well.Why Python?Bibliography

Bibliography INumericalMethods inMaterials Scienceand EngineeringMatthewGoodmanmgoodman@email.arMSE 350 - PythonAcedemic IntegrityWikipedia, the free encyclopedia.http://www.wikipedia.org.Xkcd, a webcomic of romance, sarcasm, math, andlanguage.http://www.xkcd.com.Python OverviewWhy Python?HomeworkBibliography

Numerical Methods in Materials Science and Engineering Matthew Goodman mgoodman@email.arizona.edu MSE 350 - Python Acedemic Integrity Python Overview Why Python? Homework Bibliography Why Python? { Concise I Python was designed with readability in mind. I Code is broken up with white-space I More on this all later! print \hello world"