Mathematical Applications · BE5B15MAA · Topic 13 of 13
Examples of advanced use of Mathematica
Week 13. Real tasks combine fitting, optimization, data import and a handful of solvers.
Key ideas
Fitting and optimization
Fit[data,{1,x,x^2},x] finds the least-squares combination of the given basis functions. Minimize[f,x] works symbolically and NMinimize numerically; for a model fit, build the squared-error sum and minimise it over the parameters. Define such an objective with Module-local symbols so that earlier definitions cannot disturb it.
Importing and selecting data
SetDirectory[NotebookDirectory[]] points to the notebook folder, then Import["data.csv"] reads a file and Export writes one. data[[;;,3]] takes a column, Cases and Select with a pure-function test pick rows, and Mean, Total and StandardDeviation summarise them.
Typical test tasks
The past tests ask for the same toolbox again and again: a styled ListPlot, a Fit, an Interpolation of order 2, Manipulate with a PolarPlot, FindRoot for two equations, Solve for unknown circuit parameters, NDSolve with ParametricPlot, and a function that returns a message when no solution exists.
In one line: A typical task is three steps: get the data, fit or solve, and show it with a plot and a Print line.
Formulas
- Fitting and optimization
Sources
Written by Ucenly. Based on the BE5B15MAA course materials:
- Course card BE5B15MAA (Bílá kniha), p. 1
- Introduction to Wolfram Mathematica (Intro_Wm.nb inside Intro_WM.rar), text extract, p. 1
- Exam tasks of 6 Jun 2017 (exam06062017.nb), text extract, p. 1
- Exam tasks of 4 Jun 2019 (test04062019-nosol.nb inside exam04062019.zip), text extract, p. 1
- Test of 25 Apr 2017 (test25042017Final.nb), text extract, p. 1
- Seminar notebook, state of 28 Mar 2019 (seminar2832019.nb), text extract, p. 1