Take the 2-minute tour ×  I am setting up a large system of ODEs
and in order to use the IDA method (which is sig. faster for my
system and thus attractive), I must split my equations into real
and imaginary parts.  I am experiencing a severe bottleneck in
taking real and imaginary parts of my functions, using
ComplexExpand, and I suspect that this slowdown has to do with
my inability to specify that the range of certain functions are
real. A simple example is given below:  Consider two tables,
whose elements I would like to decompose into real and imaginary
parts:  A1 = Table[ar[n]+I*ai[n], {n, 1, 500}]; A2 =
Table[(n+I*n),{n,1,500}];  Now, to find the real part of, e.g.,
A1.A1, I would take   The timing for these computations,
however, is radically different.  That is  {0.203348, Null}
{0.000585, Null}  So we see there is a difference of around 400!
Intuitively, it would seem that if I can tell Mathematica to
treat {ar[n],ai[n]} as being functions with ranges over the
reals, I can significantly improve the