← All tutorials · Proofline

Tutorial 6 of 6

Numerical methods: fit curves, find roots, solve ODEs and FFT spectra

Intermediate 12 min

Use the five numeric cells — Curve fit, Numeric solver, Integral, Differential equations and Spectrum (FFT) — and the “Fit a curve…” helper for datasets.

Five cell types compute in your browser with Proofline's numerical engine: Curve fit, Numeric solver, Integral, Differential equations and Spectrum (FFT). They work offline and are not rate limited, and four of them are also usefulweb.site tools with the same engine, so a cell and its tool page give identical numbers.

1. Open the lab

Choose Notebook → Templates… and open Numerical methods lab, then press Run all. The notebook holds a dataset Cooling tea (temperatures of a cooling cup every 4 minutes) and one cell of each numeric type. All five finish within a second.

2. Fit a model to the data

The cell Cooling law fitted to the data is a Curve fit with Model set to Custom model (your formula):

  • Data table is linked to all columns of “Cooling tea”, so the fit follows the data.
  • x column 1 and y column 2 pick the columns by number.
  • Model y = Ta + (T0 - Ta)*exp(-k*x) with Parameters with start values Ta = 20, T0 = 90, k = 0.05.

The summary reads Ta = 21.2087, T0 = 90.1289, k = 0.0453922, R² = 0.99981111. Open All result details for the parameter table with standard errors, t and p values and 95 % confidence intervals. The Residuals figure should look like random scatter around zero; a curve in it means the model misses something.

Other models need no formula: straight line, polynomial, exponential, power law, logarithmic, multiple linear regression, natural cubic spline and linear interpolation. Fill Evaluate at x = (optional) to get predictions with confidence intervals.

3. The quick way: “Fit a curve…”

In the Data view, select a dataset and press Fit a curve… under Analyse the whole dataset. Choose the x column, the y column and a Model (with Polynomial degree for polynomials) and press Fit. Proofline adds a linked Curve fit cell and runs it. For the tea data, a polynomial of degree 2 gives R² = 0.99360434, clearly worse than the cooling law. That is a good reason to prefer the physical model.

4. Roots, systems and extrema

When is the tea at 60 °C? is a Numeric solver with Problem set to Equation f(x) = 0 and Method set to Brent: every root in the interval. It finds x = 12.6787746326 minutes between 0 and 60. Other methods:

  • Bisection with iteration table and Newton’s method from a start value list every step, which is handy for coursework.
  • System of nonlinear equations takes one equation per line, for example x^2 + y^2 = 4 and x*y = 1, with Unknowns (comma-separated) x, y.
  • Minimum of a function and Maximum of a function list every local extremum in the interval.

5. Differential equations and integrals

The same law as a differential equation solves T' = -k*(T - Ta) with Initial values T = 90 and Parameters (optional) k = 0.045, Ta = 21. RK45 is the default Method; choose Classical RK4 (fixed step) to compare. The result has a plot, a table, a CSV download and, for two variables, a phase portrait.

Temperature integrated over the first hour is an Integral from 0 to 60: 2690.28488047 degree-minutes, so the average temperature is about 44.8 °C. Limits can be inf, -inf or constants such as pi/2; the Methods compared table shows Gauss–Kronrod and adaptive Simpson side by side.

6. Spectra and chaining

Spectrum of a vibration analyses 128 samples at 64 Hz and finds the strongest component at 6 Hz with amplitude 0.799995. Under Continue with, an ODE cell offers Spectrum (FFT) of T (one entry per variable). It opens a spectrum cell with the solution and the right sample rate. A curve fit offers Save the residuals as a dataset, and a numeric solver offers Plot the function.

Pin key figures such as R² or Strongest frequency to see them on the Report with every other finding.

Ready to try it?

Launch Proofline →