MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: RealValued functions and their derivatives

  • To: mathgroup at
  • Subject: [mg51477] Re: [mg51461] RealValued functions and their derivatives
  • From: "David Park" <djmp at>
  • Date: Tue, 19 Oct 2004 02:55:51 -0400 (EDT)
  • Sender: owner-wri-mathgroup at


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

From: D.J. Wischik [mailto:djw1005 at]
To: mathgroup at

I would be grateful for some help with Alebra`ReIm`. I can declare a
function to be real-valued (for real-valued arguments) by


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


(* 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.


  • Prev by Date: RE: table format question
  • Next by Date: Re: LegendreP (Symbolic) is different in Mathematica5 than previous versions (M4, M3 ..)
  • Previous by thread: RealValued functions and their derivatives
  • Next by thread: Pretty print