real valued function from complex
- To: mathgroup at smc.vnet.net
- Subject: [mg37354] real valued function from complex
- From: strgh at mimosa.csv.warwick.ac.uk ()
- Date: Fri, 25 Oct 2002 02:46:35 -0400 (EDT)
- Organization: University of Warwick, UK
- Sender: owner-wri-mathgroup at wolfram.com
I want to define a real-valued function f[t_] from the
values of a complex-valued function on a line parametrised
by t, and then be able to handle f like any other real
function (differentiate it etc.)
A cute example is:
Clear[rz, drz];
rz[t_] := Re[Zeta[1/2 + I*t]];
drz[t_] := D[rz[t], t] (* the sort of thing I want to do *)
so that
Plot[{drz[t], Im[Zeta[1/2 + I*t]]}, {t, 0, 40},
PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 0, 1]}]
will work (it doesn't).
I can get a quick & dirty numerical approximation in this case
(including, as a reality check, the original function I'm
differentiating) using something like
Clear[rz, iz, rztable, plotzeta];
rz[t_] := Re[Zeta[1/2 + I*t]];
iz[t_] := Im[Zeta[1/2 + I*t]];
rztable[tmin_, tmax_] :=
Table[{t, rz[t]}, {t, tmin, tmax, (tmax - tmin)/50}];
plotzeta[tmin_, tmax_] := Module[{rzapprox},
rzapprox = Interpolation[rztable[tmin, tmax]];
Plot[{rzapprox'[t], rz[t], iz[t]}, {t, 0, 40},
PlotStyle -> {RGBColor[1, 0, 0], RGBColor[0, 1, 0],
RGBColor[0, 0, 1]}]
]
plotzeta[0, 40]
However I'd prefer to leave the numerical approximations
till the last minute (i.e. plotting), and the interpolation
table would need tweaking on a case-by-case basis.
Any other suggestions? (sorry if there is an "obvious" answer).
-- Ewart Shaw
--
J.E.H.Shaw [Ewart Shaw] strgh at uk.ac.warwick TEL: +44 2476 523069
Department of Statistics, University of Warwick, Coventry CV4 7AL, U.K.
http://www.warwick.ac.uk/statsdept/Staff/JEHS/
3 ((4&({*.(=+/))++/=3:)@([:,/0&,^:(i.3)@|:"2^:2))&.>@]^:(i.@[) <#:3 6 2
- Follow-Ups:
- Re: real valued function from complex
- From: Daniel Lichtblau <danl@wolfram.com>
- Re: real valued function from complex