Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

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

Search the Archive

Re: the temperamental loop or something wrong with my expression

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80705] Re: [mg80534] the temperamental loop or something wrong with my expression
  • From: "Jack Yu" <Jack.Yu at astro.cf.ac.uk>
  • Date: Wed, 29 Aug 2007 04:21:02 -0400 (EDT)
  • References: <22937955.1187939639338.JavaMail.root@m35>

hello thanks for the reply and the tips.  But I still cannot use it to great
effect.  The integral is

Integrate[Sin[t] conjSphericalHarmonicY[l,m,t,p] Fab[f,t,p], {t,0,Pi},
{p,0,2Pi}]    .

It would be ideal, as you mentioned, if I can get this as an simple
algebraic expression so that I can define it as a pattern as

a[f_,l_,m_]=Integrate[Sin[t] conjSphericalHarmonicY[l,m,t,p] Fab[f,t,p],
{t,0,Pi}, {p,0,2Pi}]    .

Then, because  '=', instead of ':=', is used, a[f,l,m] should evaluate
relatively fast given any l and m, and so, in turn, aET[f,l,m], which is
defined in terms of a[f,l,m] should also evaluate quicker too.  The problem
I find is that SphericalHarmonicY[l,m,t,p] only returns
'SphericalHarmonicY[l,m,t,p]'. Only when l and m are substituted by numbers
does it return an expression which can be integrated.  This means that the
integral still has to be done every time I enter a different value of l or m
in a[f,l,m].  What's worse is that the defined function
conjSphericalHarmonicY, which is supposed to give the complex conjugate of
spherical harmonics, has no effect if l and m are not numbers.  For example,
with

delconj[eq_] := Conjugate@Total@eq /. Conjugate[x_]->x;
conjSphericalHarmonicY[l,m,t,p] := delconj(1+SphericalHarmonicY[l,m,t,p]) -
1;  ,

SphericalHarmonicY[1,1,t,p]

-(1/2)Exp[I*p]Sqrt[3/(2Pi)]Sin[t]

and

conjSphericalHarmonicY[1,1,tp]

-(1/2)Exp[-I*p]Sqrt[3/(2Pi)]Sin[t]

, which is correct.  But

SphericalHarmonicY[l,m,t,p]

SphericalHarmonicY[l,m,t,p]

and

conjSphericalHarmonicY[l,m,t,p]

SphericalHarmonicY[l,m,t,p]

, which is not correct, and so, the integral will be wrong anyway.  Any more
ideas? I'm quite new to Mathematica, but surely there must be easier ways of
calculating the complex conjugate of spherical harmonics, and of calculating
the multiple moments of a general function.

thanks!

jack

On 24/08/07, DrMajorBob <drmajorbob at bigfoot.com> wrote:
>
> Post that without "In[...]:=" and the outputs, and you'd triple the chance
> that anybody will respond. To do anything with your code, we have to
> manually, laboriously figure out what's a printed output (guessing in some
> cases), delete all of it, find all the Ins and Outs, delete those...
>
> Who'd do that?
>
> Well... I might, but I don't have a lot to do some days!
>
> The first line tells me the likely problem, however... and that's
> Simplify. You're using complicated expressions, making them even MORE
> complicated... and then trying to Simplify. Frequently.
>
> That can easily take more time than you'll ever have.
>
> When possible you should Simplify once and for all and use Set, not
> SetDelayed, for example:
>
> approxFab[f_,t_,p_]=1/384 f^2 (-35-28 Cos[2 t]-Cos[4 t]+8 (Cos[4
> p]+Sqrt[3] Sin[4 p]) Sin[t]^4)+1/147456f^4 (5702-86 Cos[4 t]-7 Cos[6 t]-16
> Sin[t]^4 (-41 Cos[2 p]+95 Cos[4 p]+Sqrt[3] (41 Sin[2 p]+95 Sin[4 p])+2
> Cos[6 p] Sin[t]^2)+Cos[2 t] (4631+16 (-Cos[2 p]+7 Cos[4 p]+Sqrt[3] (Sin[2
> p]+7 Sin[4 p])) Sin[t]^4))-1/6144\[ImaginaryI] f^3 (32 (7+Cos[2 t]) Sin[3
> p] Sin[t]^3+16 Sqrt[3] Cos[5 p] Sin[t]^5+16 Sin[5 p] Sin[t]^5-Sqrt[3]
> Cos[p] (42 Sin[t]+27 Sin[3 t]+Sin[5 t])+Sin[p] (42 Sin[t]+27 Sin[3
> t]+Sin[5 t]))//Simplify
>
> (1/147456)f^2 (384 (-35-28 Cos[2 t]-Cos[4 t]+8 (Cos[4 p]+Sqrt[3] Sin[4 p])
> Sin[t]^4)+f^2 (5702-86 Cos[4 t]-7 Cos[6 t]-16 Sin[t]^4 (-41 Cos[2 p]+95
> Cos[4 p]+Sqrt[3] (41 Sin[2 p]+95 Sin[4 p])+2 Cos[6 p] Sin[t]^2)+Cos[2 t]
> (4631+16 (-Cos[2 p]+7 Cos[4 p]+Sqrt[3] (Sin[2 p]+7 Sin[4 p]))
> Sin[t]^4))-24 \[ImaginaryI] f (16 Sin[t]^3 (2 (7+Cos[2 t]) Sin[3
> p]+(Sqrt[3] Cos[5 p]+Sin[5 p]) Sin[t]^2)-Sqrt[3] Cos[p] (42 Sin[t]+27
> Sin[3 t]+Sin[5 t])+Sin[p] (42 Sin[t]+27 Sin[3 t]+Sin[5 t])))
>
> In that case Simplify didn't accomplish much (reducing LeafCount from 248
> to 243), but it's worth trying, and Set ("=") will still yield (usually) a
> function that executes faster than with SetDelayed (":="). This can't be
> done with a function like delconj that uses Part, but even so, delconj
> could be simplified to
>
> delconj[eq_] := Conjugate@Total@eq /. Conjugate[x_] -> x
>
> I'm not sure what "/. Conjugate[x_] -> x" accomplishes for you (too many
> details for me), but eliminate it if you can. Even if you can't, the above
> will be much faster than the original.
>
> Similarly, expandaa becomes:
>
> expandaa[eq_] := CoefficientList[eq, f].f^Range@Length@eq
>
> (Dot product is fast.)
>
> It's doubtful that Expand[Simplify[....]] makes the Integrate in
> a\[Alpha]\[Alpha][f_, l_, m_] evaluate faster or better. If the
> integration can be done for symbolic f, l, and m, do it just ONCE (not
> every time the function is called), like this:
>
> a\[Alpha]\[Alpha][f_, l_, m_] =
>       Integrate[
>              Sin[\[Theta]]*
>                 conjSphericalHarmonicY[l,
>                    m, \[Theta], \[Phi]] approxF\[Alpha]\[Alpha][
>                    f, \[Theta], \[Phi]], {\[Theta], 0, Pi}, {\[Phi], 0,
>      2 Pi}]
>
> That doesn't work as things are, but try to redefine
> conjSphericalHarmonicY and approxF\[Alpha]\[Alpha] so that it DOES.
>
> I hope some of that helps!
>
> Bobby
>
> On Fri, 24 Aug 2007 01:06:10 -0500, Jack Yu <Jack.Yu at astro.cf.ac.uk>
> wrote:
>
> > Hi
> > I have defined a function whose value I want to know  for a range of two
> > of its arguments.  So to save time, I use a Do loop.  However, after a
> > few loops, it just doesn't produce any more result, even though at the
> > top it still says: 'Running ...'. I know that when I do this by manually
> > changing the arguments without using a Do loop, they all evaluate.  So I
> > thought it's to do with Do, and after reading somewhere in this forum
> > that For and While are faster, I tried them as well, but they still
> > become stuck after a few loops.  The best I can do using a loop is to
> > split the range of the variables into smaller ones; for some reason,
> > this sometimes work, but sometimes it still doesn't work.  The quickest
> > I can do is actually just do them individually without using a loop.  I
> > find this a bit puzzling and would really appreciate if anyone can help
> > me with this.
> >
> > The Notebook is here:
> > ***********************************************
> > In[1]:=
> > delconj[eq_] :=
> >     Apply[Plus,(Conjugate[
> >             Simplify[
> >               Table[Expand[eq][[i]],{i,1,
> >                   Length[Expand[eq]]}]]]) /. {Conjugate[x_]\[Rule]x}];
> >
> > In[2]:=
> > conjSphericalHarmonicY[l_,m_,\[Theta]_,\[Phi]_]:=
> >     delconj[1+SphericalHarmonicY[l,m,\[Theta],\[Phi]]]-1;
> >
> > In[3]:=
> > conjY[eq_]:= Conjugate[eq] /. Conjugate[x_]\[Rule]x;
> >
> > In[4]:=
> > expandaa[eq_]:=(aaa=eq;bbb=CoefficientList[aaa,f];
> >       Apply[Plus,Table[bbb[[i]]f^(i-1),{i,1,Length[bbb]}]]);
> >
> > In[5]:=
> > \!\(\(approxF\[Alpha]\[Alpha][f_, \[Theta]_, \[Phi]_] :=
> >       1\/12\ \((Cos[\[Theta]]\^2\ \((3 + Cos[4\ \[Phi]])\) +
> >               4\ \((1 +
> >                     Cos[\[Theta]]\^4)\)\ Cos[\[Phi]]\^2\
> Sin[\[Phi]]\^2)\)\ f\
> > \^2 + \(1\/147456\) \((\((\(-11278\) - 9307\ Cos[2\ \[Theta]] +
> >                   94\ Cos[4\ \[Theta]] + 11\ Cos[6\ \[Theta]] +
> >                   128\ \((\(-5\) + Cos[2\ \[Theta]])\)\ Cos[
> >                       2\ \[Phi]]\ Sin[\[Theta]]\^4 -
> >                   64\ \((\(-37\) + 5\ Cos[2\ \[Theta]])\)\ Cos[
> >                       4\ \[Phi]]\ Sin[\[Theta]]\^4 -
> >                   32\ Cos[6\ \[Phi]]\ Sin[\[Theta]]\^6)\)\ f\^4)\);\)\)
> >
> > In[7]:=
> > \!\(\(approxF\[Alpha]\[Beta][f_, \[Theta]_, \[Phi]_] :=
> >       1\/384\ \((\(-35\) - 28\ Cos[2\ \[Theta]] - Cos[4\ \[Theta]] +
> >               8\ Sin[\[Theta]]\^4\ \((Cos[
> >                       4\ \[Phi]] + \@3\ Sin[
> >                         4\ \[Phi]])\))\)\ f\^2 + \(-\(\(1\/6144\) \((\
> > \[ImaginaryI]\ \((16\ \@3\ Cos[
> >                         5\ \[Phi]]\ Sin[\[Theta]]\^5 -
> > \@3\ Cos[\[Phi]]\ \
> > \((42\ Sin[\[Theta]] + 27\ Sin[3\ \[Theta]] +
> >                           Sin[5\ \[Theta]])\) + \((42\ Sin[\[Theta]] +
> >                           27\ Sin[3\ \[Theta]] +
> >                           Sin[5\ \[Theta]])\)\ Sin[\[Phi]] +
> >                     32\ \((7
> > + Cos[2\ \[Theta]])\)\ Sin[\[Theta]]\^3\ Sin[
> >                         3\ \[Phi]] +
> >                     16\ Sin[\[Theta]]\^5\ Sin[
> >                         5\ \[Phi]])\)\ f\^3)\)\)\) + \(1\/147456\)
> > \((\((5702 \
> > - 86\ Cos[4\ \[Theta]] - 7\ Cos[6\ \[Theta]] -
> >                   16\ Sin[\[Theta]]\^4\ \((\(-41\)\ Cos[2\ \[Phi]] +
> >                         95\ Cos[4\ \[Phi]] +
> >                         2\ Cos[
> >                             6\ \[Phi]]\ Sin[\[Theta]]\^2
> > + \@3\ \((41\ Sin[
> >                                   2\ \[Phi]] + 95\ Sin[4\ \[Phi]])\))\)
> +
> >                   Cos[2\ \[Theta]]\ \((4631 +
> >                         16\ Sin[\[Theta]]\^4\ \((\(-Cos[2\ \[Phi]]\) +
> >                               7\ Cos[
> >                                   4\ \[Phi]] + \@3\ \((Sin[2\ \[Phi]] +
> >                                     7\ Sin[
> >                                         4\ \[Phi]])\))\))\))\)\
> f\^4)\);\)\)
> >
> > In[8]:=
> > a\[Alpha]\[Alpha][f_,l_,m_]:=
> >     Integrate[
> >       Expand[Simplify[
> >           Sin[\[Theta]]*
> >             conjSphericalHarmonicY[l,
> >               m,\[Theta],\[Phi]]approxF\[Alpha]\[Alpha][
> >               f,\[Theta],\[Phi]]]],{\[Theta],0,Pi},{\[Phi],0,2Pi}];
> >
> > In[10]:=
> > a\[Alpha]\[Beta][f_,l_,m_]:=
> >     Integrate[
> >       Expand[Simplify[
> >           Sin[\[Theta]]*
> >
> conjSphericalHarmonicY[l,m,\[Theta],\[Phi]]approxF\[Alpha]\[Beta][
> >               f,\[Theta],\[Phi]]]],{\[Theta],0,Pi},{\[Phi],0,2Pi}];
> >
> > In[12]:=
> > \!\(\(a\[Beta]\[Beta][f_, l_, m_] :=
> >       Exp[\(-I\)*m*\((\(2  Pi\)\/3)\)] a\[Alpha]\[Alpha][f, l, m];\)\)
> >
> > In[13]:=
> > \!\(\(a\[Gamma]\[Gamma][f_, l_, m_] :=
> >       Exp[\(-I\)*m*\((\(4  Pi\)\/3)\)] a\[Alpha]\[Alpha][f, l, m];\)\)
> >
> > In[15]:=
> > \!\(\(a\[Beta]\[Gamma][f_, l_, m_] :=
> >       Exp[\(-I\)*m*\((\(2  Pi\)\/3)\)] a\[Alpha]\[Beta][f, l, m];\)\)
> >
> > In[17]:=
> > \!\(\(a\[Gamma]\[Alpha][f_, l_, m_] :=
> >       Exp[\(-I\)*m*\((\(4  Pi\)\/3)\)] a\[Alpha]\[Beta][f, l, m];\)\)
> >
> > In[19]:=
> > a\[Alpha]\[Gamma][f_,l_,m_]:= (-1)^m*conjY[a\[Alpha]\[Beta][f,l,m]];
> >
> > In[21]:=
> > \!\(\(a\[Beta]\[Alpha][f_, l_, m_] := \((\(-1\))\)^m*
> >         Exp[\(-I\)*m*\((\(2  Pi\)\/3)\)] conjY[a\[Alpha]\[Beta][f, l,
> > m]];\)\)
> >
> > In[23]:=
> > \!\(\(a\[Gamma]\[Beta][f_, l_, m_] := \((\(-1\))\)^m*
> >         Exp[\(-I\)*m*\((\(4  Pi\)\/3)\)] conjY[a\[Alpha]\[Beta][f, l,
> > m]];\)\)
> >
> > In[24]:=
> > \!\(\(aET[f_, l_,
> >         m_] := \ \(1\/\(3 \@ 2\)\) \((a\[Alpha]\[Alpha][f, l, m] -
> >             2  a\[Beta]\[Beta][f, l, m] + a\[Gamma]\[Gamma][f, l, m] +
> >             a\[Alpha]\[Beta][f, l, m] - 2  a\[Beta]\[Alpha][f, l, m] +
> >             a\[Gamma]\[Beta][f, l, m] -
> >             2  a\[Beta]\[Gamma][f, l, m] + \((a\[Alpha]\[Gamma][f, l, m]
> > +
> >                 a\[Gamma]\[Alpha][f, l, m])\))\);\)\)
> >
> > In[34]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,6,2]]]]]
> >
> > Out[34]=
> > \!\({53.921514`8.183307071248283\ Second, \(\((3\ \[ImaginaryI] -
> > \@3)\)\ \
> > f\^4\ \@\(\[Pi]\/910\)\)\/4752}\)
> >
> > Do[Print["aET(f,",l,m,")=",
> >     expandaa[FullSimplify[ComplexExpand[aET[f,l,m]]]]],{l,0,6},{m,0,l}]
> >
> >
> aET(f,\[InvisibleSpace]0\[InvisibleSpace]0\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]1\[InvisibleSpace]0\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > \!\(\*
> >   InterpretationBox[\("aET(f,"\[InvisibleSpace]1\[InvisibleSpace]1\
> > \[InvisibleSpace]")="\[InvisibleSpace]\(1\/168\ \((\(-\[ImaginaryI]\) +
> \
> > \@3)\)\ f\^3\ \@\[Pi]\)\),
> >     SequenceForm[ "aET(f,", 1, 1, ")=",
> >       Times[
> >         Rational[ 1, 168],
> >         Plus[
> >           Complex[ 0, -1],
> >           Power[ 3,
> >             Rational[ 1, 2]]],
> >         Power[ f, 3],
> >         Power[ Pi,
> >           Rational[ 1, 2]]]],
> >     Editable->False]\)
> >
> >
> aET(f,\[InvisibleSpace]2\[InvisibleSpace]0\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]2\[InvisibleSpace]1\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > \!\(\*
> >   InterpretationBox[\("aET(f,"\[InvisibleSpace]2\[InvisibleSpace]2\
> > \[InvisibleSpace]")="\[InvisibleSpace]\(1\/864\ \((\(-3\)\ \[ImaginaryI]
> > + \
> > \@3)\)\ f\^4\ \@\(\[Pi]\/5\)\)\),
> >     SequenceForm[ "aET(f,", 2, 2, ")=",
> >       Times[
> >         Rational[ 1, 864],
> >         Plus[
> >           Complex[ 0, -3],
> >           Power[ 3,
> >             Rational[ 1, 2]]],
> >         Power[ f, 4],
> >         Power[
> >           Times[
> >             Rational[ 1, 5], Pi],
> >           Rational[ 1, 2]]]],
> >     Editable->False]\)
> >
> >
> aET(f,\[InvisibleSpace]3\[InvisibleSpace]0\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > \!\(\*
> >   InterpretationBox[\("aET(f,"\[InvisibleSpace]3\[InvisibleSpace]1\
> > \[InvisibleSpace]")="\[InvisibleSpace]\(1\/72\ \((\(-\[ImaginaryI]\)
> > + \@3)\)\
> > \ f\^3\ \@\(\[Pi]\/14\)\)\),
> >     SequenceForm[ "aET(f,", 3, 1, ")=",
> >       Times[
> >         Rational[ 1, 72],
> >         Plus[
> >           Complex[ 0, -1],
> >           Power[ 3,
> >             Rational[ 1, 2]]],
> >         Power[ f, 3],
> >         Power[
> >           Times[
> >             Rational[ 1, 14], Pi],
> >           Rational[ 1, 2]]]],
> >     Editable->False]\)
> >
> >
> aET(f,\[InvisibleSpace]3\[InvisibleSpace]2\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]3\[InvisibleSpace]3\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]4\[InvisibleSpace]0\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]4\[InvisibleSpace]1\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > \!\(\*
> >   InterpretationBox[\("aET(f,"\[InvisibleSpace]4\[InvisibleSpace]2\
> > \[InvisibleSpace]")="\[InvisibleSpace]\(\[ImaginaryI]\ \((\[ImaginaryI]
> > + \
> > \@3)\)\ f\^4\ \@\(\[Pi]\/5\)\)\/3168\),
> >     SequenceForm[ "aET(f,", 4, 2, ")=",
> >       Times[
> >         Complex[ 0,
> >           Rational[ 1, 3168]],
> >         Plus[
> >           Complex[ 0, 1],
> >           Power[ 3,
> >             Rational[ 1, 2]]],
> >         Power[ f, 4],
> >         Power[
> >           Times[
> >             Rational[ 1, 5], Pi],
> >           Rational[ 1, 2]]]],
> >     Editable->False]\)
> >
> >
> aET(f,\[InvisibleSpace]4\[InvisibleSpace]3\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > \!\(\*
> >   InterpretationBox[\("aET(f,"\[InvisibleSpace]4\[InvisibleSpace]4\
> > \[InvisibleSpace]")="\[InvisibleSpace]\(-\(\(17\ \[ImaginaryI]\ \((\(-\
> > \[ImaginaryI]\) + \@3)\)\ f\^4\ \@\(\[Pi]\/35\)\)\/3168\)\)\),
> >     SequenceForm[ "aET(f,", 4, 4, ")=",
> >       Times[
> >         Complex[ 0,
> >           Rational[ -17, 3168]],
> >         Plus[
> >           Complex[ 0, -1],
> >           Power[ 3,
> >             Rational[ 1, 2]]],
> >         Power[ f, 4],
> >         Power[
> >           Times[
> >             Rational[ 1, 35], Pi],
> >           Rational[ 1, 2]]]],
> >     Editable->False]\)
> >
> >
> aET(f,\[InvisibleSpace]5\[InvisibleSpace]0\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > \!\(\*
> >   InterpretationBox[\("aET(f,"\[InvisibleSpace]5\[InvisibleSpace]1\
> > \[InvisibleSpace]")="\[InvisibleSpace]\(\((\(-\[ImaginaryI]\)
> > + \@3)\)\ f\^3\ \
> > \@\(\[Pi]\/55\)\)\/1008\),
> >     SequenceForm[ "aET(f,", 5, 1, ")=",
> >       Times[
> >         Rational[ 1, 1008],
> >         Plus[
> >           Complex[ 0, -1],
> >           Power[ 3,
> >             Rational[ 1, 2]]],
> >         Power[ f, 3],
> >         Power[
> >           Times[
> >             Rational[ 1, 55], Pi],
> >           Rational[ 1, 2]]]],
> >     Editable->False]\)
> >
> >
> aET(f,\[InvisibleSpace]5\[InvisibleSpace]2\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]5\[InvisibleSpace]3\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]5\[InvisibleSpace]4\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > \!\(\*
> >   InterpretationBox[\("aET(f,"\[InvisibleSpace]5\[InvisibleSpace]5\
> > \[InvisibleSpace]")="\[InvisibleSpace]\(1\/72\ \((3
> > + \[ImaginaryI]\ \@3)\)\ \
> > f\^3\ \@\(\[Pi]\/154\)\)\),
> >     SequenceForm[ "aET(f,", 5, 5, ")=",
> >       Times[
> >         Rational[ 1, 72],
> >         Plus[ 3,
> >           Times[
> >             Complex[ 0, 1],
> >             Power[ 3,
> >               Rational[ 1, 2]]]],
> >         Power[ f, 3],
> >         Power[
> >           Times[
> >             Rational[ 1, 154], Pi],
> >           Rational[ 1, 2]]]],
> >     Editable->False]\)
> >
> >
> aET(f,\[InvisibleSpace]6\[InvisibleSpace]0\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > Do[Print["aET(f,",l,m,")=",
> >     expandaa[FullSimplify[ComplexExpand[aET[f,l,m]]]]],{l,6,8},{m,0,l}]
> >
> >
> aET(f,\[InvisibleSpace]6\[InvisibleSpace]0\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]6\[InvisibleSpace]1\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > \!\(\*
> >   InterpretationBox[\("aET(f,"\[InvisibleSpace]6\[InvisibleSpace]2\
> > \[InvisibleSpace]")="\[InvisibleSpace]\(\((3\ \[ImaginaryI] -
> > \@3)\)\ f\^4\ \
> > \@\(\[Pi]\/910\)\)\/4752\),
> >     SequenceForm[ "aET(f,", 6, 2, ")=",
> >       Times[
> >         Rational[ 1, 4752],
> >         Plus[
> >           Complex[ 0, 3],
> >           Times[ -1,
> >             Power[ 3,
> >               Rational[ 1, 2]]]],
> >         Power[ f, 4],
> >         Power[
> >           Times[
> >             Rational[ 1, 910], Pi],
> >           Rational[ 1, 2]]]],
> >     Editable->False]\)
> >
> >
> aET(f,\[InvisibleSpace]6\[InvisibleSpace]3\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > \!\(\*
> >   InterpretationBox[\("aET(f,"\[InvisibleSpace]6\[InvisibleSpace]4\
> > \[InvisibleSpace]")="\[InvisibleSpace]\(-\(\(\[ImaginaryI]\ \((\(-\
> > \[ImaginaryI]\) + \@3)\)\ f\^4\ \@\(\[Pi]\/91\)\)\/3168\)\)\),
> >     SequenceForm[ "aET(f,", 6, 4, ")=",
> >       Times[
> >         Complex[ 0,
> >           Rational[ -1, 3168]],
> >         Plus[
> >           Complex[ 0, -1],
> >           Power[ 3,
> >             Rational[ 1, 2]]],
> >         Power[ f, 4],
> >         Power[
> >           Times[
> >             Rational[ 1, 91], Pi],
> >           Rational[ 1, 2]]]],
> >     Editable->False]\)
> >
> >
> aET(f,\[InvisibleSpace]6\[InvisibleSpace]5\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]6\[InvisibleSpace]6\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]7\[InvisibleSpace]0\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]7\[InvisibleSpace]1\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> >
> aET(f,\[InvisibleSpace]7\[InvisibleSpace]2\[InvisibleSpace])=\[InvisibleSpace]\
> > 0
> >
> > $Aborted
> >
> > In[38]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,7,3]]]]]
> >
> > Out[38]=
> > {54.478757 Second,0}
> >
> > In[39]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,7,4]]]]]
> >
> > Out[39]=
> > {76.970704 Second,0}
> >
> > In[40]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,7,5]]]]]
> >
> > Out[40]=
> > {60.329395 Second,0}
> >
> > In[42]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,7,6]]]]]
> >
> > Out[42]=
> > {32.853831 Second,0}
> >
> > In[43]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,7,7]]]]]
> >
> > Out[43]=
> > {32.139781 Second,0}
> >
> > In[44]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,8,0]]]]]
> >
> > Out[44]=
> > {69.877317 Second,0}
> >
> > In[45]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,8,1]]]]]
> >
> > Out[45]=
> > {91.335676 Second,0}
> >
> > In[46]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,8,2]]]]]
> >
> > Out[46]=
> > {88.233249 Second,0}
> >
> > In[47]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,8,3]]]]]
> >
> > Out[47]=
> > {77.997297 Second,0}
> >
> > In[48]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,8,4]]]]]
> >
> > Out[48]=
> > {79.343742 Second,0}
> >
> > In[49]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,8,5]]]]]
> >
> > Out[49]=
> > {62.095294 Second,0}
> >
> > In[50]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,8,6]]]]]
> >
> > Out[50]=
> > {49.984301 Second,0}
> >
> > In[51]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,8,7]]]]]
> >
> > Out[51]=
> > {33.587836 Second,0}
> >
> > In[52]:=
> > AbsoluteTiming[expandaa[FullSimplify[ComplexExpand[aET[f,8,8]]]]]
> >
> > Out[52]=
> > {32.811034 Second,0}
> >
> > ********************************************
> >
> > aET[f,l,m] is the function I want to evaluate for {l,0,8} and for each
> > l, {m,-l,l}.  As can be seen in the first Do loop, it stopped at
> > aET[f,6,0]; I deleted 'Aborted'. And as can be seen in the second Do
> > loop, it stopped at aET[f,7,2].  I finished the rest just by using the
> > expression expandaa[FullSimplify[ComplexExpand[aET[f,l,m]]]] again and
> > again.  When I was doing this I noticed that the above expression
> > sometimes gets stuck and I have to do it one step at a time. e.g
> > aET[f,l,m], then ComplexExpand[aET[f,l,m]], then
> > FullSimplify[ComplexExpand[aET[f,l,m]]] and so on, then the whole
> > expression will work afterwards.  This is also very strange.
> >
> >
>
>
>
> --
> DrMajorBob at bigfoot.com
>



  • Prev by Date: Re: Bad imports of data files -- extra empty lists showing up?
  • Next by Date: Limits of Nested Expressions
  • Previous by thread: Re: the temperamental loop or something wrong with my expression
  • Next by thread: Name retrieval