5 Numerical Evaluations of Equations

5.1 Introduction

In this chapter, we shall introduce several Mathematica functions that have a wide range of uses in obtaining numerical solutions to engineering applications. These functions are:

  • Integration—NIntegrate[]
  • Solutions of ordinary and partial differential equations—NDSolveValue[] and    ParametricNDSolveValue[]
  • Solutions of equations and polynomials—NSolve[]
  • Numerical roots of transcendental equations—FindRoot[]
  • Optimization: Find maximum or minimum of a function—FindMaximum[] and    FindMinimum[]
  • Fit data to a specified function—FindFit[]
  • Piece-wise fit to data—Interpolation[]
  • Discrete Fourier transform and correlation—Fourier[], InverseFourier, and    ListCorrelate[]

Since the outputs of many of the functions to be introduced in this chapter are plotted, we shall be using the basic forms of Plot and ParametricPlot as given in Table 6.1. In addition, two options will be used: PlotRange->All, which ensures that all points are plotted; and PlotStyle->{styl1,styl2,…}, where each stylN corresponds to the line style of each curve being plotted. The line styles that we shall use are solid and dashed.

5.2 Numerical Integration: NIntegrate[]

Numerical integration of a function f(x) over the region x1xx2 is performed with


 NIntegrate[f,{x,x1,x2},opts]

and the numerical integration of a function g(x,y) over the region x1xx2 and y1yy2 is performed with


 NIntegrate[g,{x,x1,x2},{y,y1,y2},opts]

where the first ...

Get An Engineer's Guide to Mathematica now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.