Newton Raphson method issues with differentiation I am trying to solve for the roots of the follwing equation using the newton raphson method $$f\left(x\right)\ =-I+I_{ph}-I_s\times\left(e^\frac{q\times(V_c+I\times R_c)}{n\times k\times T}-1\right)$$
The solution that I am trying to find is:
$$I_{n+1}=\ I_n-\frac{I_n-I_{ph}+I_s\times\left(e^\frac{q\times(V_c+I_n\times R_c)}{n\times k\times T}-1\right)}{\frac{{q\times I}_s\times{R_c\times\left(e^\frac{q\times(V_c+I_n\ timesR_c)}{n\times k\times T}-1\right)}_\ }{n\times k\times T}+1}$$
However when i reproduce the method myself I arrive to:
$$I_{n+1}=\ I_n-\frac{I_n-I_{ph}+I_s\times\left(e^\frac{q\times(V_c+I_n\times R_c)}{n\times k\times T}-1\right)}{\frac{{q\times I}_s\times{R_c\times\left(e^\frac{q\times(V_c+I_n\times R_c)}{n\times k\times T}\right)}_\ }{n\times k\times T}+1}$$
I have used matlab to find the derivative and do the calculations, I dont know where the -1 term in the denominator has gone. The Method does not work without it.
 A: $$f_{(V,I)} = 0 = I_{ph} - I_0\left( exp(\frac{V+IR_s}{V_t}) - 1\right) - I$$
You can simplify the problem by evaluating the function around $V_{sh}$ rather than $V$ or $I$. The $V_{sh}$ is defined as $V_{sh} = V+IR_s$. Then rewrite the equation using $V_{sh}$, such that:
$$f_{(V,I)} = 0 = I_{ph} - I_0\left( exp(\frac{V_{sh}}{V_t}) - 1\right) - \frac{V_{sh}-V}{R_s}$$. 
Take partial derivative $\frac{\partial f_{(V_{sh}, V)}}{ \partial V_{sh}}$:
$$\frac{\partial I}{ \partial V} = - \frac{I_0}{V_t} exp(\frac{V_{sh}}{V_t}) - \frac{1}{R_s}$$
Solve iteratively for $I$, given some initial value for $V_{sh}$, remember that $V_{sh}=V$ at $V_{oc}$, which is a good initial guess, since you also know $I=0$ at $V_{oc}$.
$$V_{sh(i+1)} = V_{sh(i)} - \frac{I_{ph} - I_0\left( exp(\frac{V_{sh}}{V_t}) - 1\right) - \frac{V_{sh}-V}{R_s}}{ - \frac{I_0}{V_t} exp(\frac{V_{sh}}{V_t}) - \frac{1}{R_s} }$$
Upon convergence, the current is then:
$$I = \frac{V_{sh}-V}{R_s}$$
You can get the whole I-V characteristic this way, even continue with Bishops reverse-bias model, and/or second diode, $R_{sh}$ resistance, etc.

P.S. The $V_t$ gathers all the terms for temperature, diode factor and the other constants.
A: No idea how the first variant could be correct as Newton method, it could be a copy-paste error. 
That it works is because the fixed-point iteration scheme $$x_+=x-h(x)f(x)$$ always has fixed points at the roots of $f$, and is rather flexible in $h$ if you only want to get convergence, that is, contractivity around a specific root $x_*$ of $f$. Then $$|h(x_*)f'(x_*)-1|<1$$ is a sufficient condition to have the iteration contractive in some neighborhood of $x_*$. In general, the smaller the left side, the larger the region and the faster the convergence.
The extra $-1$ in the first formula could count as such an insignificant perturbation of $h(x)=f'(x)^{-1}$. 

To get quadratic convergence like in the Newton method, you need that $$h(x_*)=f'(x_*)^{-1}$$ at the root $x_*$. The easiest way to guarantee this is to have $h(x)=f'(x)^{-1}$ everywhere. Note however that any modification of $f$ leads to a different Newton iteration, for instance modifying $f$ by a factor $g$ gives
$$
x_+ = x - \frac{f(x)g(x)}{f'(x)g(x)+f(x)g'(x)}=x-\frac{f(x)}{f'(x)+f(x)\frac{g'(x)}{g(x)}}.
$$
An interesting factor is $g(x)=e^{i\epsilon x}$ giving $x_+=x-\frac{f(x)}{f'(x)+iϵf(x)}$ if you want to find complex roots.
