Partial differentiation of a series of functions

42 Views Asked by At

(sorry for my poor terminology)

This is a question about partial differentiation of a complex function which is divided into a stepwise sequence of equations. To illustrate: a function $F(c, k) = XY_{FP}$ to tracing skewed rays in a optical system is always divided into a sequence of 15-20 equations,

$$H = -c*(K*K)+L*L+M*M*(1+k))\tag{1}$$ $$G = c*(X*X+Y*Y+Z*Z*(1+k)-2*Z\tag{2}$$ $$F = M-c*(X*K+Y*L+Z*M*(1+k))\tag{3}$$ $$A = \frac{G}{F+\sqrt {F*F-H*G}}\tag{4}$$ $$X1 = A*K+X; \,\,\,Y1 = A*L+Y; \,\,\,Z1 = A*M+Z\tag{5abc}$$ $$Dx = - c *X1; \,\,\,Dy = - c *Y1; \,\,\,Dz = 1- c *Z1*(1+ k)\tag{6abc}$$ $$\bullet\tag{7}$$ $$XY_{FP} = \,\, ...\tag{n}$$ Shown equations are intermediate equations (not all) inside $F(c, k) = XY_{FP}$, where K,L,M,X,Y,Z are constants and c and k are the input parameters. The output value, $XY_{FP}$, is a 2D-point in the focal plane.
How to find the partial derivates with respect to c and k (i.e $\frac{\delta{F}}{\delta{c}}$ and $\frac{\delta{F}}{\delta{k}}$)?
I understand that all equations/statements can be put together into one giant function and then I can derivate that. I tried that but it became far too complicated (for me). Therefore, I wonder: can a function subdivided into smaller functions (as illustrated above) be differentiated step-by-step? The goal is to get derivates that can be used when optimizing the optical system (there are other ways to optimize but that is not the question here).

Tommy / Sweden

1

There are 1 best solutions below

0
On

Have you tried the multivariate form of the chain rule yet? Let me standardize the notation a bit: $XY_{FP}$ is a function dependend on other functions, let us call them $f_i$, $i=1,\ldots,n$. These function then depend on $c$ and $k$, i.e. $$F(c,k) = XY_{FP}(f_1(c,k),\ldots,f_n(c,k)).$$ I also assume $f_i:\mathbb{R}^2\rightarrow\mathbb{R}$. Then you can calculate the derivatives of $F$ by the derivatives of $XY_{FP}$, i.e. $\partial_{f_i} XY_{FP}$. This is chain rule and in more detail looks like $$\partial_c F = \sum_{i=1}^n\partial_c f_i\cdot \partial_{f_i} XY_{FP}$$ rsp. $$\partial_k F = \sum_{i=1}^n\partial_k f_i\cdot \partial_{f_i} XY_{FP}$$ Here is also a wiki link to this chain rule: https://en.wikipedia.org/wiki/Chain_rule#Multivariable_case

Now you can calculate derivates of your intermediate equations and put everything back together afterwards. Is this what you are looking for?