### Create a StudySoup account

#### Be part of our community, it's free to join!

Already have a StudySoup account? Login here

# Computational Physics PHY 4151C

USF

GPA 3.9

### View Full Document

## 12

## 0

## Popular in Course

## Popular in Physics 2

This 5 page Class Notes was uploaded by Jairo Dooley on Wednesday September 23, 2015. The Class Notes belongs to PHY 4151C at University of South Florida taught by Staff in Fall. Since its upload, it has received 12 views. For similar materials see /class/212686/phy-4151c-university-of-south-florida in Physics 2 at University of South Florida.

## Similar to PHY 4151C at USF

## Popular in Physics 2

## Reviews for Computational Physics

### What is Karma?

#### Karma is the currency of StudySoup.

#### You can buy or earn more Karma at anytime and redeem it for class notes, study guides, flashcards, and more!

Date Created: 09/23/15

Physics PHY 4l5l fall semester 2007 Notes on Matlab and Octave Matlab has two interfaces a regular line interface and a graphical user interface The regular interface still supports nearly all the graphical functions of the package but starts up faster To start Matlab on physics cas usf edu type the command matlabO The dot is part of the sentence not part of the command To start the graphical user interface instead use the command matlab Octave started out as a free re implementation of Matlab There are some differences but most of the core commands and functions are compatible To start Octave type the command octave Octave is available for both UniX and Windows check the Web sites httpwwwoctaveorg httpoctavesf net If you are working from a computer that does not run the X Windowing System the graphical system for UniX also available commercially for MacintoshWindows you will have to use Octave not Matlab to plot graphs Matlab used to have a terminal command that could display graphics on TektroniX emulating windows but it no longer works In Octave give the command gset terminal Vttek in order to use TektroniX emulating graphics Most ofwhat you ll need is in the book by Pratap or in the booklet by Davis and Sigmon For more complete Matlab documentation look in the physics directory usrlocalmatlabhelppdfidocmatlab or on the Web at http wwwmathworks comaceesshelpdeskhelptechdocmatlabiproductipagehtml Octave7s documentation can be read in the le usrsharedococtave 2157refcardrefcard letterdvi or at httpwwwoctaveorgdocshtml Because Matlab and Octave have some signi cant differences it is important when turn ing in homework to indicate which package should be used I have compiled an incomplete list of differences between Matlab and Octave if you plan to use one language exclusively you dont need to pay attention to this 9 The online help commands are different In Octave use help i topic if help topic doesn7t turn anything up In Matlab use lookfor topic analogously to the UniX apro pos or man k command 9 The simplest plots are the same but options and other graphics commands are com pletely different Some options that eXist in both work differently For example axis takes different arguments in the two languages 1 Changes to Octave plots do not take effect until the replot command is issued unless Octave was started with the traditional switch or the variable automaticireplot has been set to 1 The random function does not eXist in Octave use randO The O like assignment operators etc eXist only in Octave not Matlab The logical operators 8585 and I I work in Octave on matrices but in Matlab only on scalars in Matlab use 85 or I and nest all or any for the appropriate number of dimensions Octave does not have bitwise operators bitandO etc Octave accepts single quotes or double quotes quot for strings Matlab only single quotes Backslash can be used to escape a single quote within a string in Octave but not in Matlab Octave not Matlab pads string arrays as in Hi Hello Namaste use char in Matlab not available in Octave The function str2mat does the same thing as char in Matlab and exists in Octave however it may go away in a future version of Matlab Functions may not be entered interactively outside of a m le in Matlab so there is no endfunction command in Matlab Octave structs are not matrices as they are in Matlab Octave has no sparse matrices and also lacks many functions for generating specialized matrix forms such as hadamard and magic 0 There is no print command in Octave To send a plot as Postscript to the le file nameps use gset output filenameps followed by gset term postscript before making the plot To undo these commands use gset term X11 A short list of other functions and commands missing in Octave expm1 fu11m strvcat O and inline Matlab does not have containers or the list and associated functions Matlab does not have typeinfoO or user de ned types Both languages have the cell type There is no stream type in Matlab Matlab can use either a string func or a function handle func to pass a function to a function Octave uses only a string Matlab and Octave use different packages for the solution of ordinary differential equa tions among other things Matlab supports tensors of arbitrary rank Octave has only scalars vectors and matrices Octave provides a more general mechanism similar to that in C than Matlab for argu ment lists of variable length Physics PHY 4l5l fall semester 2004 Notes on Matlab and Octave Matlab has two interfaces a regular line interface and a graphical user interface The regular interface still supports nearly all the graphical functions ofthe package but starts up faster To start Matlab on physics cas usf edu type the command matlabO The dot is part of the sentence not part of the command To start the graphical user interface instead use the command matlab Octave started out as a free re implementation of Matlab There are some differences but most of the core commands and functions are compatible To start Octave type the command octave Octave is available for both Unix and Windows check the Web sites httpwwwoctaveorg httpoctavesf net If you are working from a computer that does not run the X Windowing System the graphical system for UniX also available commercially for MacintoshWindows you will have to use Octave not Matlab to plot graphs Matlab used to have a terminal command that could display graphics on TektroniX emulating windows but it no longer works In Octave give the command gset terminal Vttek in order to use TektroniX emulating graphics Most of what you7ll need is in the book by Pratap For more complete Matlab docu mentation look in the physics directory usrlocalmatlabhelppdfidocmatlab or on the Web at http wwwmathworks comaceesshelpdeskhelptechdocmatlabiproductipagehtml Octave7s documentation can be read in the le usrsharedococtave 21SSinterpreteroctaveps or at httpwwwoctaveorgdocshtml Because Matlab and Octave have some signi cant differences it is important when turn ing in homework to indicate which package should be used I have compiled an incomplete list of differences between Matlab and Octave if you plan to use one language exclusively you dont need to pay attention to this 9 The online help commands are different In Octave use help i topic if help topic doesn7t turn anything up In Matlab use lookfor topic analogously to the UniX apro pos or man k command 9 The simplest plots are the same but options and other graphics commands are com pletely different Some options that eXist in both work differently For example axis takes different arguments in the two languages 1 Changes to Octave plots do not take effect until the replot command is issued unless Octave was started with the traditional switch or the variable automaticireplot has been set to 1 The random function does not eXist in Octave use randO The O like assignment operators etc eXist only in Octave not Matlab The logical operators 8585 and I I work in Octave on matrices but in Matlab only on scalars in Matlab use 85 or I and nest all or any for the appropriate number of dimensions Octave does not have bitwise operators bitandO etc Octave accepts single quotes or double quotes quot for strings Matlab only single quotes Backslash can be used to escape a single quote within a string in Octave but not in Matlab Octave not Matlab pads string arrays as in Hi Hello Namaste use char in Matlab not available in Octave The function str2mat does the same thing as char in Matlab and eXists in Octave however it may go away in a future version of Matlab Functions may not be entered interactively outside of a m le in Matlab so there is no endfunction command in Matlab Octave structs are not matrices as they are in Matlab There is no end indeX in Octave use use size x2 Octave has no sparse matrices and also lacks many functions for generating specialized matrix forms such as hadamard and magic 0 Octave is pickier about spacing around colons 69 a 1 2 10 wont work al though a1210 and a 1 2 10 both will This is certainly a bug There is no print command in Octave To send a plot as Postscript to the le file nameps use gset output filenameps followed by gset term postscript before making the plot To undo these commands use gset term X11 A short list of other functions and commands missing in Octave expm1 expm2 expm3 fuan strvcat and inline Matlab does not have containers or the list and associated functions Matlab does not have typeinfo or user de ned types Both languages have the cell type There is no stream type in Matlab Matlab can use either a string func or a function handle func to pass a function to a function Octave uses only a string Matlab and Octave use different packages for the solution of ordinary differential equa tions among other things Matlab supports tensors of arbitrary rank Octave has only scalars vectors and matrices Octave provides a more general mechanism similar to that in C than Matlab for argu ment lists of variable length Physics PHY 4l5lPHZ 5l56 C fall semester 2008 Notes on the User Environment The server for this course is physicscasusfedu a dual Xeon 3 GHZ Intel computer made by Dell It has 3 GB of RAM and currently runs the Red Hat Enterprise A54 release of Linux a community based implementation of Unix It is also the head of a 21 node Condor cluster Introductory material is available on line with the command help intro or just help The class has access to two laboratories with terminals to physics Note that these computers really do act as terminals everything even graphics is done over the network not on the local machine 1 The teaching lab PHY 102 is available to students by combination lock except while classes are in session check the posted room schedule and the light above the door 2 The computers in the open use laboratory SCA 216 which students may use during the week run Windows There is more information on the reverse of this sheet If the instructor has made his screen available as soon as you log in you will see it on the left half of your screen If you log in before the instructor type vnc2 in a terminal window once the instructor has started his copy The Linux Gnome login screen gives an option under Session to choose an environment from the following list The environment controls the overall appearance of the windowing system what kinds of graphical interfaces appear and which mouse button does what Each environment can be further customized KDE and Gnome provide graphical interfaces for this purpose dwim requires editing les Note that all environments share Xdefaults as a con guration le KDE This is the default for newly created accounts it is a free implementation of the Common Desktop Environment The left mouse button moves windows It is necessary to click on a window before typing in it KDE appears similar to Microsoft Windows but icons need be clicked only once not double clicked In this and all the environments cutting and pasting is much easier than in Windows drag the left mouse button to copy and push the middle mouse button to paste The default con guration brings up a white terminal window with black letters Con guration is stored in kderc kde and Desktop Gnome Use the middle mouse button to move windows the right button on the title bar to raise them As with KDE you need to click on a window before typing all such things can be con gured but it may take forever to gure out how The default terminal has gray letters on a black background Con guration is stored in gnome and Desktop If you nd the colors in vi hard to read in the default terminal windows try launching an xterm from the command line dwim This loads the fastest You can move to a numbered window with ltCTRLgt number There is no attempt to bring up a graphical user interface The con guration les are xllinitrc and dwimrc0 The middle mouse button moves windows Unlike in the other environments you can type in whichever window has the mouse cursor you never need to click I have also remapped some keys in this environment to mimic a standard Unix keyboard accent grave is remapped to escape caps lock to control and shift tab to accent grave To log out type exit in the red window in the upper left corner Quite apart from the graphical environment the con guration le cshrc controls most aspects of the command line If bash is your default shell look instead in bashrc You can change your login shell with chsh s binbash or chsh s bintcsh Defaults for all con guration les are kept in etcskel as a convenience you may type reconfigure to copy these to your directory You might wish to do so if your con guration becomes hopelessly muddled or if your account was created before this year Printing the default printer is the one in room 102 Please do not print hundreds of pages 69 the course notes Logging in remotely see over

### BOOM! Enjoy Your Free Notes!

We've added these Notes to your profile, click here to view them now.

### You're already Subscribed!

Looks like you've already subscribed to StudySoup, you won't need to purchase another subscription to get this material. To access this material simply click 'View Full Document'

## Why people love StudySoup

#### "There's no way I would have passed my Organic Chemistry class this semester without the notes and study guides I got from StudySoup."

#### "I signed up to be an Elite Notetaker with 2 of my sorority sisters this semester. We just posted our notes weekly and were each making over $600 per month. I LOVE StudySoup!"

#### "I was shooting for a perfect 4.0 GPA this semester. Having StudySoup as a study aid was critical to helping me achieve my goal...and I nailed it!"

#### "It's a great way for students to improve their educational experience and it seemed like a product that everybody wants, so all the people participating are winning."

### Refund Policy

#### STUDYSOUP CANCELLATION POLICY

All subscriptions to StudySoup are paid in full at the time of subscribing. To change your credit card information or to cancel your subscription, go to "Edit Settings". All credit card information will be available there. If you should decide to cancel your subscription, it will continue to be valid until the next payment period, as all payments for the current period were made in advance. For special circumstances, please email support@studysoup.com

#### STUDYSOUP REFUND POLICY

StudySoup has more than 1 million course-specific study resources to help students study smarter. If you’re having trouble finding what you’re looking for, our customer support team can help you find what you need! Feel free to contact them here: support@studysoup.com

Recurring Subscriptions: If you have canceled your recurring subscription on the day of renewal and have not downloaded any documents, you may request a refund by submitting an email to support@studysoup.com

Satisfaction Guarantee: If you’re not satisfied with your subscription, you can contact us for further help. Contact must be made within 3 business days of your subscription purchase and your refund request will be subject for review.

Please Note: Refunds can never be provided more than 30 days after the initial purchase date regardless of your activity on the site.