Re: derivative of a well-behaved function

*To*: mathgroup at smc.vnet.net*Subject*: [mg99529] Re: [mg99466] derivative of a well-behaved function*From*: Daniel Lichtblau <danl at wolfram.com>*Date*: Thu, 7 May 2009 06:36:13 -0400 (EDT)*References*: <200905060924.FAA01756@smc.vnet.net>

Ricardo Samad wrote: > Dear all, > > the following ZS function is an analytical description of the transmittance > of a laser beam through an Iris after propagating inside a nonlinear sample > (Z-Scan curve): > > \[Gamma][z_, z0_] := 1/2 (I/z0 (z + (z^2 + z0^2)/(DD - z)) + 1); > > ZS[z_, z0_, \[Phi]_] := > Abs[\[Gamma][z, z0] Gamma[\[Gamma][z, z0], 0, > I \[Phi]/(1 + (z/z0)^2)] /(I \[Phi]/(1 + (z/z0)^2))^\[Gamma][z, > z0]]^2; > > Altough the function has imaginary arguments and is defined in terms of the > incomplete Gamma function, it is well-behaved and Mathematica calculates an= > d > plots it without problems: > > DD = 300; > Plot[ZS[z, 1, 0.5], {z, -4, 4}] > > The problem is that when I calculate its derivative in z, the result is > given in terms of infinite quantities and DirectInfinity functions, and it > is not possible to get numerical values of it neither plot its graph: > > dZS = D[ZS[z, 1, 0.5], z]; > dZS /. z -> 1 > N[%] > Plot[dZS[z, 1, 0.5], {z, -4, 4}] > > Since the ZS function is well-behaved and has no discontinuities, its > derivative should be easily evaluated to numerical values and also plotted. > Does anybody has any idea on how to obtain the values? (I could easily writ= > e > a function to numerically calculate the derivative, but that=B4s not really > what I want). > > Thank you, > > Ricardo > > -- > ____________________________________ > Ricardo Elgul Samad > [...] Derivative (and D) really require analytic finctions in complex variables to do their work. In your example I think D gets thwarted by presence of Abs. One way around this would be to take explicit numeric differences, as below. eps = 10^(-6); dZS[z_Real] := Re[(ZS[z + eps, 1, 1/2] - ZS[z - eps, 1, 1/2])/(2*eps)] Plot[dZS[z], {z, -4., 4.}] Alternatively, you could load the numerical calc package: Needs["NumericalCalculus`"] and then use ND. Daniel Lichtblau Wolfram Research

**References**:**derivative of a well-behaved function***From:*Ricardo Samad <resamad@gmail.com>