RealValued functions and their derivatives

*To*: mathgroup at smc.vnet.net*Subject*: [mg51461] RealValued functions and their derivatives*From*: djw1005 at cus.cam.ac.uk (D.J. Wischik)*Date*: Sun, 17 Oct 2004 21:49:57 -0400 (EDT)*Organization*: University of Cambridge, England*Sender*: owner-wri-mathgroup at wolfram.com

I would be grateful for some help with Alebra`ReIm`. I can declare a function to be real-valued (for real-valued arguments) by <<Algebra`ReIm` RealValued[f]; Then I can ask Mathematica to reason about real and imaginary parts of expressions involving f -- for example Im[t] ^= 0; Im[w] ^= 0; Re[f[t] Exp[I w]] (* correctly returns Cos[w] f[t] *) In my application, I then want to differentiate f. If I naively ask for Re[ f'[t] Exp[I w] ] (* I get Cos[w] Re[f'[t]] - Im[f'[t]] Sin[w] *) Of course, if f is real-valued then f' is real-valued, so I only want the Cos[w] part. If I try to declare f' to be real-valued by RealValued[f'] (* I get an error message: $RecursionLimit::reclim : Recursion depth of 256 exceeded. *) I obviously haven't worked out the right way to tell Mathematica that f' is real-valued. Any suggestions? I'm using Mathematica 4.0. My hack at the moment is to substitute a pure symbol g for f', and to declare that g is RealValued. However, since my function has four arguments and I need derivatives up to order 3, this is very cumbersome. Damon.