Re: RealValued functions and their derivatives
- To: mathgroup at smc.vnet.net
- Subject: [mg51477] Re: [mg51461] RealValued functions and their derivatives
- From: "David Park" <djmp at earthlink.net>
- Date: Tue, 19 Oct 2004 02:55:51 -0400 (EDT)
- Sender: owner-wri-mathgroup at wolfram.com
Damon, When working with complex expressions, your real friend will be ComplexExpand. One has to almost always use it. Re[f[t] Exp[I w]] // ComplexExpand Cos[w] f[t] Re[ f'[t] Exp[I w] ] // ComplexExpand Cos[w] f'[t] Check the Help page for ComplexExpand. Quite often you may have to use the TargetFunctions option. David Park djmp at earthlink.net http://home.earthlink.net/~djmp/ From: D.J. Wischik [mailto:djw1005 at cus.cam.ac.uk] To: mathgroup at smc.vnet.net 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.