Introduction to Scientific Programming
Introduction to Scientific Programming COMP 116
Popular in Course
Popular in ComputerScienence
This 2 page Class Notes was uploaded by Dorothea Pollich on Sunday October 25, 2015. The Class Notes belongs to COMP 116 at University of North Carolina - Chapel Hill taught by Joh Calandrino in Fall. Since its upload, it has received 13 views. For similar materials see /class/228775/comp-116-university-of-north-carolina-chapel-hill in ComputerScienence at University of North Carolina - Chapel Hill.
Reviews for Introduction to Scientific Programming
Report this Material
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: 10/25/15
COMP 116 3 Dec 2006 MATLAB vs C C or Java MATLAB is interpreted C and Java are compiled MATLAB has vectors arrays matrices strings and complex numbers as rstclass types and has a huge set of functions that operate on them C and Java has only doubles integers characters and arrays All variables must be declared before using so that the compiler can make space for them Certain symbols are different in CCJava called bang for not l l and ampamp for logical OR and AND The l and amp operators are used for bitvvise OR and AND so should be avoided in C Syntax of statements differs in C and MATLAB Some examples 0 for i l i lt 10 i instead of foril10 end 0 Two whiles while condition or do while condition 0 Semicolons are needed after every statement except those that precede a 0 Comments are indicated by and CJava C programs start with main and usually have several functions in one le JavaC have one class per le which is a data structure plus all the associated functions some of which are declared to be accessible from outside the le and others are private MATLAB uses le names to name functions Actually you can have helper functions inside a single le too MATLAB and C are procedural languages emphasizing the function subroutine C and Java are object oriented which emphasize the abstract data type and encourage code reuse through inheritance and library building MATLAB and Java check types while the program is running C and C check types at compilation time which means that the program is faster C and C rely on pointers which indicate variables by their location in memory and leave it to the programmer to interpret what type of value is there Java uses references which always know the type of what they are pointing to o MATLAB shows its Fortran roots in columnmajor storage order use of global variables lack of pointers or references etc o In C and C you must manage the use of memory Java amp MATLAB do garbage collection to clean up unused memory for you 0 The CCJava languages and some libraries are standardized by international committees Thus many companies produce different development environments with different libraries compilers debuggers and editors for CCJava MATLAB comes only from Mathworks although R and Opal are knockoffs httpwww 39 39 39 html httpjavasuncomdocsbookstutorial httpwwwphysicsdrexeleducoursesComp PhysGeneralC basicsc tutorialhtml
Are you sure you want to buy this material for
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'