IntroScientificComputing


 * Introduction to Scientific Computing, ** ** Homework **

This course plan may be modified during the semester. Such modifications will be announced in advance during class periods, and the students are responsible for keeping abreast of such changes. The WWW page for the course will also be used to list assignments and other notes, and students are responsible for checking this web page regularly. My plan (which is of course subject to change) is to cover the following topics:
 * Topics to be covered and Homework Assigned ** (exact due dates will be announced in class).

Chapter 1: Chapter 2: Chapter 3: Chapter 4: Chapter 5: Chapter 6: Chapter 7: Chapter 9:
 * Maxima **

1) Plot and solve x^3 - 9x=0. 2) Plot 3D surface z = sin(x)*cos(y) 3) Solve ODE y' +3y = x with initial condition y(0) = 2 y''+3y' - 4y = sin(x) with initial condition y(0) = 2, y'(0) =1 4) Investigate sum and product of n terms of the form 1/k 5) Differentiate, integrate, and find series of x^2*sin(x). In each case use "nouns" 1st to see Math sign for it before execution. 6) Solve numerically exp(x)*sin(x) - x = 0 (hint - plot 1st).
 * Homework**
 * Chapter 1**

1) Evaluate following expressions symbolically and as a floating point: 4+(1/(7+1/(5+1/6))); 7./5.+3./9.+1./7.; sqrt(4+(2/3)^3); |-8.5+1/4.5|; cos(%pi/3+sin(%pi/4)); sqrt(exp(-7)+log(abs(-5+1/2))); ceiling(7.25); floor(7.25); fix(7.25); 3.25-fix(2.25); cosh(2.5); 2) Evaluate symbolic formula for motion of a projectile y = y0 + v0 t + g t^2/2. Assume you throw it up from 6ft high with initial velocity 64feet/sec. Using gravity acceleration 32 feet/sec^2, find the height of the projectile after 4 sec. 3) Define and plot following functions of one and two variables. f(x) = x^3-9/x, h(x,y) = (x^2-2)*cos(y) - y*sin(x). Evaluate this functions at particular numbers and list of numbers of your choosing. 4) Define block function that is x^2 for x<3, x-1 for 3<=x<=5, 2*x else. Evaluate this function on several x-values to check its action. Plot it.
 * Chapter ** ** 2 **

1) Simplify the following rational expressions: x^2*y^2*z+a*x*y^2*z-3*x*y^2*z-3*a*y^2*z-2*x^2*y^2-2*a*x*y^2+6*x*y^2+6*a*y^2; x + y/(x+2) + z/(x^2+4); 3*x*(2*x-1)+(x+1)*(3*x+1); -2*x+3*x^2/(4*x+1)+2*x/(x^2+1); 2) Simplify the following radical expressions: (exp(2*x)-exp(-2*x))/(exp(2*x)+exp(-2*x)); (log(2*x+x^2)-log(x))^n/(log(2+x)^(n/2)); (x^(3/2)+6*x+12*sqrt(x)+8)/(2+sqrt(x)); 3) Factor the following expression: 2*x^7-14*x^6+12*x^5+100*x^4-190*x^3-126*x^2+432*x-216; (2*x^2)/(x^2-2*x-8)+(4*x)/(x^2-2*x-8)-6/(x^2-2*x-8); 6587931486 Also factor both in real and compex numbers x^4+81 4) Expand the following expressions: 3*(x^2+4)*(x-2)*(x+3)^2; (x^2+5*x+6)/(x^2-4*x+4); then use ratsimp to recover original expressions. Extract numerator and denominator from the 2nd expressions. 5) Simplify log expressions: log(y^m/x^k); 4*log(x) - 3*log(x); 6) Simplify factorial expressions: (x+3)!*(x+1)!/(x!)^2; (n+3)!/(n+5)!; (n+2)*(n!)^3; 7) Simplify, reduce, expand etc... trigonometric expressions: cot(x)*cos(x)^2+(1-cos(x)^2)*sin(x)/tan(x)^2; 4*(sin(x)*cos(x))^3; sin(4*x)+cos(2*x); sin(theta)^4+sin(theta)^3+(sin(theta)+1)^3; 8) Use subst and at to evaluate expression y : y0 + v0*t + g*t^2/2 for y0=16, v0=32, g=-32, t = 1,3,5,10 9) Let p: 8*x^3-7*x+3; q: x-1; be given polynomials. Divide p by q and find quotient and remainder 10) Break the following into partial fractions: (2*x^3-17*x^2-10*x-16)/(x^4-3*x^3-12*x-16)
 * Chapter ** ** 3 **

1) Plot the following graph specifying proper y range: 2*exp(-t/10)*cos(3*t-1)/(t-1) 2) For position function y:2*exp(-t/2)*cos(2*t); differentiate to find velocity and acceleration and plot all three of them on the same graph with proper labels. Specify proper labels of time and say "functions" for y-axis. 3) Plot discrete data sets x : [0,1,2,3,4,5,6] $ y : [0.5,2.6,7.4,2.7,6.0,5.5,10.7] $ using line, point, line and point, color, etc styles 4) Create a plot combining discrete data above and 20*exp(-t/10)*sin(t). Create proper legend and some axis labels. 5) Create a parametric plot of x=2*cos(t), y = 3*sin(t). Make sure that it displays correct relative sizes with [gnuplot_preamble,"set size ratio 1"] 6) Use wxdraw2d to draw on the same plot the parametric function above as well as 10*(s-cos(s)) and the discrete set in problem 3 7) Plot x^6*cos(x/1000)) with log log plot 8) Produce 3D surface plot of x^2*cos(y)+y^2*sin(x) as separate window to rotate or as inline wxplot3d plot. Create colormap of this function. Create contourplot of this function. 9) Use draw3d to produce on the same plot the explicit surface above and implicit sphere x^2+y^2+z^2=4
 * Chapter ** ** 4 **

1) Solve algebraically 1st ax^3 + bx^2 + c*x=0. subst values for a=1, b=-5, c=6 and solve it again obtaining numbers. Use wxplot2d to confirm your results. Make sure to assign each root to a separate variables x1, x2, x3. Use float and makelist as necessary.  2) Plot and use algebraic and numerical techniques to solve x^3-6*x^2+4*x+2 = 0. Use float and makelist as necessary. 3) Assume population is modeled by logistic equation given by P = M*P0/(P0+(M-P0)*exp(-k*M*t)); 1st solve this formula generally for time t. Then given that at certain time population P=140 and parameters of the problem are P0=100, M=200,k=0.0001, find out at which time it happens.  4) Redo my baseball example for different values of parameters. 5) Use allroots and realroots to find solutions of 3*x^5+5*x^4-3*x^3+x^2+6*x+2=0 Use wxplot2d and newton solver to find real roots of the above equation.  6) Use linsolve and matrix inversion technique to solve the following system of equations x1-2*x2+3*x3-4*x4=25, -x2+2*x3=5, 2*x1-3*x4=19, 2*x2-2*x3=20 7) Solve under-determined system x+2*y-z=6,x-2*y+2*z=8. Plot resulting solution in 3D graph. Solve over-determined system x+y=3,x+2*y=5,-3*x+y=-1  8) Solve and plot nonlinear algebraic system x^2+y^2=4, x-y=0. Use mnewton to solve this system.
 * Chapter 5 **

1) Integrate sin(%alpha*x)*exp(%beta*x) as indefinite integral 1st using delayed assignment with nouns evaluation and then assigning it to a another variable. Integrate the same function on definite limits 0 to %pi with specific alpha = 2 and beta = 3. 2) Integrate exp(-x^2) as indefinite integral and then on limits 0 to infinity. Make sure to use float to get a number. Compute the integral of the same integrand numerically on 0 to 2 and 0 to infinity using quad_ family of routines as well as romberg. 3) Find all partial derivatives of x^3*cos(y) of 1st and second order. Does proper equality of mixed derivatives hold? 4) Find limits of (4*x^3-3*x^2+4)/(5*x-4*x^3+2) as x goes to positive and negative infinity (confirm graphically). Find limits of abs(x-2)/(2-x) at x approaches 2 from left and right (confirm graphically). 5) Find Taylor series expansions of exp(-x^2) and of exp(-x)*sin(x) around x = 0. 6) Use sum to find finite up to 1st 50 terms and infinite sum of 4/k^2. 7) Solve for implicit derivative of u(x) in equation x^2*u(x)-4*u(x)^3=exp(x); 8) Use my code similar to p 6-23 to investigate min/max and inflection points of function x^3-6*x^2+4*x+2 9) Set up double integral of function 2*x^3-4*y for y running from -x to x and x on 0 to 3. Use nouns to set up and evaluate the integrals.
 * Chapter ** ** 6 **

1) Generate a 3 by 4 matrix using function f(i,j) = i^2+2*j. Extract individual elements at location 1,4 and 3,2. Reassign these elements to 1 and check the result in matrix. 2) Define matrix A with rows [-1,4,-2], [-3,4,0], [-3,1,3]. Find its inverse, rank, determinant, transpose, characteristic polynomial, eigenvalues, eigenvectors (make sure to extract them into individual vectors. 3) Apply map with functions exp and cos to the matrix in #2. 4) Create column vector with entries 1,2,3, diagonal matrix consisting of two matrices of your choice, diagonal matrix with all entries equal to 2, 3 by 4 matrix with single nonzero entry equal to 5, 4 by 4 identity matrix, 4 by 3 matrix with all zeros. Extract sub-matrix from 4 by 5 matrix of your choice, extract rows and columns from this matrix, add rows and columns to this matrix. Use matrix_size to confirm the size of your matrix. 5) Create two matrices A and B of size 3 by 2 of your choice and perform addition, subtraction, linear combination 2*A - 3*B, term by term multiplication. Create matrices A and B both of size 2 by 2 and perform matrix multiplication AB and BA ( compare the results), term by term exponents, matrix exponents. 6) Solve the system of equations 2*x-y+3*z=4; 3*x-y+5*z=7; x+y+z=3; by linsolve and by extracting augmented coefficient matrix and using (click on this link and copy this file to the same directory where your other Maxima files are). 7) Upload nchrpl package and find trace of the matrix A in #2, find its cholsky factorization and LU factorization. 8) Use cmatrix and randmatrix defined in my file to create 4 by 5 matrix with all entries equal to (-6) and a random 4 by 5 matrix with floating point numbers and with integers.
 * Chapter **** 7 **

1) Solve and plot initial value problem 2*dy/dx + 3y=x^2 y(0)=2 2) Solve and plot initial value problem d^2y/dx^2+4*dy/dx+3*y=2*x-1; x=0,y=-2 diff(y,x)=1 3) Solve and plot boundary value problem d^2y/dx^2+2*dy/dx+4*y=0; x=0,y=2 x=1,y=-1 4) Solve and plot initial value problem dy/dx= y^2+1; x=0,y=0 Make sure to invert the implicit solution. 5) Solve and plot (including phase plane) system of odes df/dt=3*t*cos(t)-2*g(t); dg/dt=-f(t)+2*t*sin(t); f(0)= 2, g(0= -1 6) Solve and plot (including phase plane) system of odes 'diff(f(x),t,2) = -75*f(t)+25*g(t); 'diff(g(t), t, 2) = 50*f(t)-50*g(t)+50*cos(2*t); f(0)=2, f'(0)=-2; g(0)=3, g(0)=-4; 7) Transfer this ode into a system of 1st order odes, solve and plot. y'+y-y'-y=0 y(0) = 1, y'(0)=2, y''(0)=2 8) Solve and plot initial value problem dx/dt = cos(t) -x^3 x(0)=1 using numerical Runge-Kutta approach. 9) Use numerical methods to solve and plot solution time dependence and phase plane for Lokta-Volterra equation dx/dt = 2*x*(2-3*y), dy/dt = -y*(4-2x)
 * Chapter ** ** 9 FYI **

http://sourceforge.net/projects/octave/files/Octave%20Windows%20binaries/Octave%203.6.1%20for%20Windows%20Microsoft%20Visual%20Studio/octave-3.6.1-vs2010-setup-1.exe/download Then install Octave GUI. Initially, it is going to start in Spanish, but then go to the installation directory, then "bin" directory and remove the "languages" directory there. The next time you open the program, it will be in English. http://forja.rediris.es/frs/?group_id=1143
 * W. J. Palm, Introduction to Matlab **
 * To install Octave, 1st download and install command based Octave:**

The main site of Octave UPM is @http://mat.caminos.upm.es/octave Octave UPM developer: Israel Herraiz 

- An Overview of Matlab - introduces the Matlab environment and all of the main constructs (which are studied in greater detail in Ch 4 - Programming in Matlab). HW: 2, 4, 7, 8, 14, 18, 21, 28, 35, 36, 37, 40 - Numeric Cell and Structure arrays - introduces arrays - the most important data structure in Matlab. HW: 1, 6, 7, 9, 13, 18, 21, 25, 37, 42, 51-53 - Functions and Files - introduces a large class of Matlab standard built-in functions, user defined functions, as well as how to upload data files. HW: 2, 6, 9, 10, 13, 17, 20, 22 - Programming in Matlab - a more detailed study of basic programming structures such as relational operators, conditional statements, and loops. HW: 6, 9, 11, 17, 23, 28, 32 part c can be plotted using the following commands: contour([0:0.2:2],[0:0.2:2],T),xlabel(x'),ylabel('y') surface([0:0.2:2],[0:0.2:2],T),xlabel('x'),ylabel("y'),zlabel('Temp (deg F)') mesh([0:0.2:2],[0:0.2:2],T),xlabel('x'),ylabel('y'), zlabel('Temp (deg F)'),  33, For extra credit you can do: 40, 41  - Advanced Plotting and Model Building - 2D plots, subplots and overlays, interactive plotting,  regression, 3D plots  HW: 3, 6, 15, 18, 22, 24, 29, 38, 45, 49, 51 also for Interpolation Ch 7: 23, 24, 26

Matlab Exam: Chapter 1: 4 7 8 14 21 36 37 40 Chapter 2: 1, 6, 7, 18, 21, 37 Chapter 3: 6, 10, 17, 22 Chapter 4: 9, 17b, 23, 28, 32, 33 Chapter 5: 6, 15, 18, 24, 38, 45, 49, 51 Interpolation Ch 7: 23, 24, 26

** TOURO **** COLLEGE **** COURSE SYLLABUS ** ** LANDER **** COLLEGE **


 * DEPARTMENT: ** Mathematics
 * COURSE TITLE: ** Introduction to Scientific Computing
 * COURSE NUMBER: ** MAT 405
 * PREREQUISITES: ** MAT 121 (Calculus I)
 * CREDIT HOURS: ** 3
 * DEVELOPER: ** Dr. Kaganovskiy
 * LAST UPDATE: 11/13/2011 **


 * __ COURSE DESCRIPTION __**

This course introduces students to a widely applicable contemporary field of Scientific Computing, which uses computer simulations to solve problems in Mathematics, Engineering, Finance, Economics, Physics, Biology, and many other fields. The course should be followed by a senior level Numerical Methods course, which studies Mathematical techniques in depth, while this course provides students with tools to apply in all of their Science and Mathematics courses. We focus on how to use computer algebra systems and scientific programming packages to solve real world problems. We will use free clones: Maxima and Octave in computer lab. The course is at the introductory level, with basic Calculus as the only prerequisite. We start with introduction to Maxima and study expressions, functions, visualization, solving equations, differentiation, integration, matrices and vectors. We continue with scientific programming using Introduction to Matlab/Octave by W. J. Palm. We will cover algorithms, sequences, selections, loops, functions, numeric and string types, arrays, vectors, simulations, visualization in 2D and 3D.


 * __ COURSE/DEPARTMENTAL OBJECTIVES __**

The student will:


 * Learn about Octave and Maxima programming in relation to solving real-world problems.
 * Learn about applications of Mathematics to problems from Physics, Economics, and Biology.
 * Learn about Mathematical Modeling techniques.


 * __ COURSE/INSTITUTIONAL OBJECTIVES __**

This course is intended to teach students the basic concepts of scientific computing and programming. This should further professional and pre-professional career interests for students in the fields of science and business. Goals include the fostering of analytical and quantitative thinking, and the ability to solve problems and interpret data.


 * __ HARDWARE/SOFTWARE/MATERIALS REQUIREMENTS: __**

Freely available Maxima and Octave computational packages.


 * __ COURSE REQUIREMENTS __**

Homework Assignments Individual and group projects.


 * __ GRADING GUIDELINES __**

Students must turn in regular homework as well as longer and more complex programming projects. Grades are to be based on the weighted average of the grades for projects, homework, and two exams.

**__ METHODOLOGY __** Classroom lectures and assigned homework problems.


 * __ COURSE TEXT __**


 * G. Urroz free pdf textbook for Maxima (available on instructor website). **
 * W. J. Palm, Introduction to Matlab 7 for Engineers, 2nd edition, McGraw-Hill Professional **