MathGroup Archive 2009

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

Search the Archive

Problems with Complie and generating a nested list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg101755] Problems with Complie and generating a nested list
  • From: Robert Smith <8888rob at gmail.com>
  • Date: Thu, 16 Jul 2009 08:18:34 -0400 (EDT)

Hi,

I have problem with compiling a function and then generating a nested list.
I would really appreciate if someone could help me with this problem.
I have a 2x2 matrix with complex components. I need to find a an expresion
that involes finding derivative of components of this matrix (with respect
to real variable, say, t) and then generating a nested list.
It is something like this:
complexmatrix= ....  is the matrix I am talking about,
matrixfunction:= Compile[{{m, _Complex, 2}},
D[ComplexExpand[ArcTan[Re[m[[1,1]]]/Im[m[[2,2]]]],TargetFunctions->{Re,
Im}], t]]]
matrixdata:=Table[{t, matrixfunction[complexmatrix]}, {t, tmin, tmax}]
matrixdata
and this givers errors ...... like Part specification m[[2,2]] longer than
depth of object......

I have even tried
matrixfunction:= Compile[{{m, _Complex, 2}},
Evaluate[D[ComplexExpand[ArcTan[Re[m[[1,1]]]/Im[m[[2,2]]]],TargetFunctions->{Re,
Im}], t]]]]
but even that does not work.
And I have to use:
D[ComplexExpand[ArcTan[Re[m[[1,1]]]/Im[m[[2,2]]]],TargetFunctions->{Re,
Im}], t]
because otherwise mathematica will not calculate correctly. I checked this
for simple matrices (where I did not have to use Compile) and I get the
right result, but for larger matrices I need to use Compile function and
there things become complicated. Perhaps the problem is {t, tmin, tmax} in
the table which confuses the derivative.

I shall be really thankful if someone could help me with this problem.

Rob



  • Prev by Date: Re: Add syntax highlighting to own command
  • Next by Date: Re: SphericalPlot3D: shifting the origin
  • Previous by thread: Re: how to use vb.net/netlink to export a dxf file
  • Next by thread: False divergence of the NDSolve solution: how to avoid