Drawing a Tangent Line to a Fitted Curve: A Step-by-Step Guide

The equation 4*Cd0*K*s^2 – 4*Cl0*K*s – 1 = 0 enables calculation of two slopes of lines that touch the parabola at a point of tangency. By solving -4*Cd0*K*s^2 + 4*Cl0*K*s + 1 = 0 for ‘s’, we get the two possible slopes. These slopes can be used to draw tangent lines in a deterministic manner, ensuring reproducibility.


The stress-strain data was analyzed using cubic fits, and the corresponding
straight lines
(dashed and same color) were added, as shown in the figure below. However, the straight lines were added based on visual inspection, which could vary if someone else tried to add them. Therefore, I am looking for a deterministic way to add tangent lines to ensure reproducibility.


Let me talk about the general case:

Do you have a curve that is fitted ($hat{g}(x)$) and wish to sketch a tangent line at a particular point, $x^*$?

The value of $b$ at $x^*$ is equivalent to the derivative of the function $hat{g}$ at the same point, which can be represented as $frac{d}{dx}hat{g}(x^*) = hat{g}'(x^*)$.

The function’s output at the value $x^*$ is represented as $y^* = hat{g}(x^*)$.

You desire a line that passes through the coordinates $(x^*,y^*)$ and has a slope of **** $b$.

In other words, if $frac{y-y^*}{****^*}=b$, then we can rearrange the equation to get $y=y^*+b(****^*)$. This can also be written as $(y^*-bx^*)+bx=a+bx$.

Specifically, the equation is characterized by the slope $b=hat{g}'(x^*)$ and the y-intercept $a=(y^*-bx^*)=hat{g}(x^*)-hat{g}'(x^*)x^*$.

The challenge is to determine the specific $x$-value at which to draw the tangent line, rather than actually drawing the tangent line.

The point of inflection of a cubic, where it appears to be “linear”, is when the second derivative equals zero. It can be assumed that this is the desired location for drawing a tangent line.

Determine the zero point of the linear fitted cubic’s second derivative by solving for the value of $x$.

In the case where the cubic equation takes the form of $a + bx + cx^2+dx^3$, the second derivative can be expressed as $2c+6dx$. This derivative equals zero when $x$ is equal to $-frac{c}{3d}$.

Frequently Asked Questions

Posted in Uncategorized