How does one take derivative of data points

473 Views Asked by At

I have a function defined in terms of data points and I need to take the derivative of this function and use it in the Newton Raphson iteration.

The function $f$ below is obtained through a series of definitions -

$$a = \frac{T_{\text{top}} - T_{\text{bottom}}}{\ln P_{\text{top}} - \ln P_{\text{bottom}}} $$

All values are known i.e. $T_{\text{top}}$, $T_{\text{bottom}}$, $P_{\text{top}}$, $P_{\text{bottom}}$

$$b = T_{\text{top}} - a \cdot \ln P_{\text{top}} $$

$$ p \ln = \ln P_{\text{bottom}} + \frac{\theta - \theta_{\text{bottom}}}{\theta_{\text{top}} - \theta_{\text{bottom}}} * (\ln P_{\text{top}} - \ln P_{\text{bottom}}) $$

pln is the initial guess value for pressure in logarithmic space for the Newton Raphson iteration.

Here $\theta$, $\theta_{\text{top}}$, $\theta_{\text{bottom}}$ are all known

Finally

$$ ekp = e^{pln}$$

$$ t = a * p ln + b $$

$$ f = t * ekp $$

$$ \frac{df}{dp} = ekp (t -a) $$

So I need to derive the final expression for Newton Raphson iteration but I would like to have some idea on how to get df/dp since all I have are data points. All I have are discrete measurements of temperature and pressure. Any clue to get to the final derivative will be appreciated as I have to modify a and b to get a different df/dp. Some of these values are constants(such as theta without a subscript) and those will be zero. But what about the others ?

1

There are 1 best solutions below

0
On BEST ANSWER

If we assume a linear relationship between $\ln p$ and $\theta$ then the two-point formula for the line through $\left(\theta_\text{bottom},\ln P_{\text{bottom}}\right)$ and $\left(\theta_\text{top},\ln P_{\text{top}}\right)$ is $$\frac{\ln p-\ln P_{\text{bottom}}}{\theta-\theta_\text{bottom}}=\frac{\ln P_{\text{top}}-\ln P_{\text{bottom}}}{\theta_\text{top}-\theta_\text{bottom}}$$ Then $$\ln p=\ln P_{\text{bottom}}+\frac{\theta-\theta_\text{bottom}}{\theta_\text{top}-\theta_\text{bottom}}\left(\ln P_{\text{top}}-\ln P_{\text{bottom}}\right)$$ Also we assume a linear relationship between $t$ and $\ln p$ so that $t=a\ln p+b$. Knowing $T_{\text{bottom}}=a\ln P_{\text{bottom}}+b$ and $T_{\text{top}}=a\ln P_{\text{top}}+b$ we can solve for $a$ and $b$ to get $$a=\frac{T_{\text{top}}-T_{\text{bottom}}}{\ln P_{\text{top}}-\ln P_{\text{bottom}}}$$ and $$b=T_{\text{top}}-a\ln P_{\text{top}}$$ Then if we define $$f=te^{\ln p}=tp=\left(a\ln p+b\right)p$$ We have $$\frac{df}{dp}=a+a\ln p+b=t+a$$