# How to calculate the tangent of a curved line in LibreOffice Calc

I already plotted my graph as shown below

How do calculate the Tangent at each point, e.g at (0.75,0.4)

Like how can I draw that straight line that touches the curve at only that point without crossing the curve

How should anybody know without any idea of the functional relation of (x,y) values.

@Opaque you can calculate local slope and shift the tangent line using local value - see my answer. That'll work as long as the function is not doing anything crazy.

And this is putting an assumption into

functional relation of (x,y) valuesand exactly what is meant by my comment (as far as I understand your solution, youlinearizebetween 2 data points)You can try to fit a quadratic curve ax²+bx+c passing through 3 points (x

_{i-1}, y_{i-1}), (x_{i}, y_{i}) and (x_{i+1}, y_{i+1}) where you are interested in the tangent at (x_{i}, y_{i}). Solve for a and b and draw the line passing by (x_{i}, y_{i}).You may also attempt to approximate the slope between point i-1 and i+1 and apply this to a line passing by i, assuming that the "continuous" curve is sufficiently "regular" (no noise nor sudden "jump").

You may want to check function

`LINEST()`

for a polynomial regression (e.g of degree`2`

) and which would provide all parameters required for your orig questioncalculate the Tangent at(i.e. getting a function which allows calculation of the tangent at each point from 3 values (in case of degreeeachpoint`2`

polynomial). However: This also puts an assumption/regression type/approximation into the data.See the following sample file: C:\fakepath\LINEST-Degree2-Polynomial-Tangent.ods