Mathematics Roots, Differentiation and Integration Prof. Muhammad Saeed.

Slides:



Advertisements
Similar presentations
Differential Equations Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB (Plus Symbolic Mathematics) 1.
Advertisements

Gradient & Mathematical Modeling and Simulation Using MATLAB Prof. Muhammad Saeed.
Prof. Muhammad Saeed 1.Nonlinear Equations 2.System of Linear Equations.
The Derivative in Graphing and Application
Complex Integration.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Clipping Concepts, Algorithms for line clipping 1 of 16 Clipping - 10/16/12.
Lecture 5.
Lecture 5 Fixed point iteration Download fixedpoint.m From math.unm.edu/~plushnik/375.
Chapter 6: Roots: Open Methods
Beginning Programming for Engineers
MATLAB Optimization Greg Reese, Ph.D Research Computing Support Group Miami University.
MATLAB: toolboxes, technical calculations. Numeric integration (1) Evaluating integral: computing a surface below a curve.
Engr 0012 (04-1) LecNotes Engr 0012 (04-1) LecNotes Functional analysis y = f(x) things to do 1. sketch graph 2. find roots (zeros) 3. find.
1 Introduction to Computer Graphics with WebGL Prof. John Gauch CSCE Department Spring 2015 Angel and Shreiner: Interactive Computer Graphics 7E © Addison-Wesley.
Chapter 11: Symbolic Computing for Calculus
Polynomial Approximation PSCI 702 October 05, 2005.
數值方法 2008, Applied Mathematics NDHU 1 Nonlinear systems Newton’s method The steepest descent method.
MATLAB MATLAB is a high-level technical computing language and
MATLAB Functions – Part II Greg Reese, Ph.D Research Computing Support Group Academic Technology Services Miami University September 2013.
Lecture 26: Numerical Integration Trapezoid rule Simpson's rule Simpson's 3/8 rule Boole’s rule Newton-Cotes Formulas.
Lecture 14: Newton’s method for system of two nonlinear equations Function newton2d01 Set initial (x,y) point, maximum number of iterations, and convergence.
Unit 7 Symbolic Processing 中華技術學院電子系 副教授 蔡樸生 副教授 林盈灝.
CSE 123 Symbolic Processing. Declaring Symbolic Variables and Constants To enable symbolic processing, the variables and constants involved must first.
Numerical Differentiation and Quadrature (Integration) 1Daniel Baur / Numerical Methods for Chemical Engineers / Numerical Quadrature Daniel Baur ETH Zurich,
Unconstrained optimization Gradient based algorithms –Steepest descent –Conjugate gradients –Newton and quasi-Newton Population based algorithms –Nelder.
Engineering Analysis ENG 3420 Fall 2009 Dan C. Marinescu Office: HEC 439 B Office hours: Tu-Th 11:00-12:00.
Matlab Integral TRAPZ(x,y) QUAD(FH,A,B)
Mapping between Scene and Screen. Screen (0, W-1) (W-1, H-1) (W-1, 0)(0, 0) Projection Plane (Xmin, Ymin)(Xmax, Ymin) (Xmax, Ymax) (Xmin, Ymax) Screen.
Nonlinear Algebraic Systems 1.Iterative solution methods 2.Fixed-point iteration 3.Newton-Raphson method 4.Secant method 5.Matlab tutorial 6.Matlab exercise.
I. Finding Roots II. Integrating Functions
ACSL, POSTECH1 MATLAB 입문 CHAPTER 8 Numerical calculus and differential equations.
So you don’t know how to use a TI-89… Rita Korsunsky.
Euler’s Method BC Only Copyright © Cengage Learning. All rights reserved Day
Root Finding The solution of nonlinear equations and systems Vageli Coutsias, UNM, Fall ‘02.
Part 2 Chapter 7 Optimization
Visual debugging with SimpleGeo Chris Theis. Overview SimpleGeo’s visual debugger Running a few examples.
Department of Mechanical Engineering, LSU Session IV MATLAB Tutorials Session IV Mathematical Applications using MATLAB Rajeev Madazhy
The Hong Kong Polytechnic University Industrial Centre 1 MatLAB Lesson 4 : Polynomial Edward Cheung Room W311g 2008.
1 M ATLAB Short Course Part (2). 2 Elementary Math Function abs, sign: Absolute value and Signum Function sin, cos, asin, acos…: Triangular functions.
Improper Integrals. Examples of Improper Integrals Integrals where one or both endpoints is infinite or the function goes to infinity at some value within.
Numerical Differentiation and Quadrature (Integration)
Plot (x-values, y-values) >> x = linspace (-3, 3, 20); >> x = linspace (-3, 3, 20); >> y = 2*x – 1; >> y = 2*x – 1; >> plot (x, y) >> plot (x, y)
6.094 Introduction to programming in MATLAB Danilo Šćepanović IAP 2008 Lecture 3 : Solving Equations and Curve Fitting.
Analyzing Functions (4.16) y=f(x) MATLAB. Functional Analysis includes: Plotting and evaluating a function Finding extreme points Finding the roots (zeros.
Newton’s Method, Root Finding with MATLAB and Excel
Numerical Analysis 3D Plots. A numerical method is a technique for computing a numerical approximation of the solution to a mathematical problem.
MATHPOWER TM 12, WESTERN EDITION Chapter 5 Trigonometric Equations.
More Functions in MATLAB. Functions that operate on other functions A function F() can take another function G() as an argument by using a notation:
Introduction to Optimization Methods
Techniques for Numerical Integration
Basis of Mathematical Modeling LECTURE 3 Numerical Analysis with MATLAB Dr. N.K. Sakhnenko, PhD, Professor Associate.
Root Finding UC Berkeley Fall 2004, E77 Copyright 2005, Andy Packard. This work is licensed under the Creative.
Ch : Which Values Are Possible? Domain & Range.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 1 Part 5 Integration and Differentiation.
Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display. A Concise Introduction to MATLAB ® William J. Palm III.
MATLAB (Matrix Algebra laboratory), distributed by The MathWorks, is a technical computing environment for high performance numeric computation and.
Mathematical Applications By Matlab 3 rd Day Dr. Wael Khedr CSI Dept.
Graphical optimization Some problems are cheap to simulate or test. Even if they are not, we may fit a surrogate that is cheap to evaluate. Relying on.
1 M 277 (60 h) Mathematics for Computer Sciences Bibliography  Discrete Mathematics and its applications, Kenneth H. Rosen  Numerical Analysis, Richard.
8-5 Exponential and Logarithmic Equations
So you don’t know how to use a TI-89…
3-4 Linear Programming.
Chapter 7: Optimization
PYTHON Prof. Muhammad Saeed.
Numerical Integration of Functions
Function Handles UC Berkeley Fall 2004, E Copyright 2005, Andy Packard
b) Create a graph of your table.
The Real Zeros of a Polynomial Function
The Real Zeros of a Polynomial Function
Part 2 Chapter 7 Optimization
Presentation transcript:

Mathematics Roots, Differentiation and Integration Prof. Muhammad Saeed

1.r = roots(p) 2.r = fzero(func,x0), 3.r = fzero(func,[x1 x2]) a)r = fzero('3*x^3+2*x^2-5*x+7',5) b)r = c)r = exp(x)*sin(x),x0) d)Hfnc x^2*cos(2*x)*sin(x*x) r = fzero(Hfnc, [x0 x1]) 4.a= 1.5; r = myfun(x,a),0.1) 5.options = optimset('Display','iter','TolFun',1e-8) opts=optimset(options,'TolX',1e-4) r = fzero(fun,x 0,opts) 2Mathematical modeling & Simulations

6.[r,fval] = fzero(...) 7.[r,fval,exitflag] = fzero(...) 8.[r,fval,exitflag,output] = fzero(...) output.algorithm :Algorithm used output.funcCount Number of function evaluations output.intervaliterations:Number of iterations taken to find an interval output.iterations: Number of zero-finding iterations output.message:Exit message ExitFlags 1Function converged to a solution x. -1Algorithm was terminated by the output function. -3NaN or Inf function value was encountered during search for an interval containing a sign change. -4Complex function value was encountered during search for an interval containing a sign change. -5Algorithm might have converged to a singular point. 9.[….. ] =fminbnd(…) 3Mathematical modeling & Simulations

4 [r,p,k] = residue(b,a) [b,a] = residue(r,p,k) 1.Symbolic a.syms x t z alpha; #int(-2*x/(1+x^2)^2) #int(x/(1+z^2),z) #int(x*log(1+x),0,1) #int(2*x, sin(t), 1)

5Mathematical modeling & Simulations 2.Numerical # Z = trapz(Y) #Z = trapz(X,Y) Example: IntegralTrapz.mIntegralTrapz.m #Z = quad(hfun,a,b) #Z = quad(hfun,a,b,tol) #[Z,fcnt] = quad(...) #Z= #[Z, fcnt]=quad(……) # Z=quad(fun,a,b,tol,trace) #Z=quadl(……..) The quad function may be most efficient for low accuracies with nonsmooth integrands. The quadl function may be more efficient than quad at higher accuracies with smooth integrands.

q = quadgk(fun,a,b) [q,errbnd] = quadgk(fun,a,b,tol) [q,errbnd] = quadgk(fun,a,b,param1,val1,param2,val2,...) [q,errbnd] = 'RelTol',1e-8,'AbsTol',1e-12) The quadgk function may be most efficient for high accuracies and oscillatory integrands. It supports infinite intervals and can handle moderate singularities at the endpoints. It also supports contour integration along piecewise linear paths. q = dblquad(fun,xmin,xmax,ymin,ymax) q = dblquad(fun,xmin,xmax,ymin,ymax,tol) q = dblquad(fun,xmin,xmax,ymin,ymax,tol,method) q = -1, 1, -1, 1) triplequad(fun,xmin,xmax,ymin,ymax,zmin,zmax) triplequad(fun,xmin,xmax,ymin,ymax,zmin,zmax,tol) triplequad(fun,xmin,xmax,ymin,ymax,zmin,zmax,tol,method) F Q = triplequad(F,0,pi,0,1,-1,1);

1.Symbolic syms x f = sin(5*x) g = exp(x)*cos(x); diff(g); diff(g,2) syms s t f = sin(s*t) ; diff(f,t) ; diff(f,s); diff(f,t,2); 2.Numerical diff(x) ; diff(y) z=diff(y)./diff(x) z=diff(y,2)./diff(x,2) polyder(p) polyder(a,b) 7Mathematical modeling & Simulations

8

END 9Mathematical modeling & Simulations