MathGroup Archive 2013

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

Search the Archive

Order-of-evaluation related issue when using TransformedField

  • To: mathgroup at smc.vnet.net
  • Subject: [mg131440] Order-of-evaluation related issue when using TransformedField
  • From: ZdenÄk HurÃk <hurak at seznam.cz>
  • Date: Tue, 23 Jul 2013 17:19:26 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • Delivered-to: l-mathgroup@wolfram.com
  • Delivered-to: mathgroup-outx@smc.vnet.net
  • Delivered-to: mathgroup-newsendx@smc.vnet.net

Hello,

I am facing the following problem when plotting planar vector fields defined in polar coordinates. I use the TransformedField function to convert the field given in polar coordinates to a cartesian-coordinate field and then I use StreamPlot (or VectorPlot) to plot the field. I run into errors with this code

==========================
==========================
=================
In[25]:= VectorPlot[
 TransformedField[
  "Polar" -> "Cartesian", {r, 0}, {r, \[Theta]} -> {x, y}], {x, -2,
  2}, {y, -2, 2}]

During evaluation of In[25]:= TransformedField::nocoord: {-1.99971,-1.99971} is not a non-empty list of valid variables. >>

During evaluation of In[25]:= TransformedField::nocoord: {-1.99971,-1.99971} is not a non-empty list of valid variables. >>

During evaluation of In[25]:= TransformedField::nocoord: {-1.714,-1.99971} is not a non-empty list of valid variables. >>

During evaluation of In[25]:= General::stop: Further output of TransformedField::nocoord will be suppressed during this calculation. >>
==========================
==========================
=================

I guess this must be related to the order of evaluation because if I rewrite the above one-liner to two lines like this

==========================
==========================
=================
In[27]:= tf1 =
 TransformedField[
  "Polar" -> "Cartesian", {r, 0}, {r, \[Theta]} -> {x, y}]

Out[27]= {x, y}

In[28]:= VectorPlot[
 tf1["Polar" -> "Cartesian", {r, 0}, {r, \[Theta]} -> {x, y}], {x, -2,
   2}, {y, -2, 2}]

Out[28]= \!\(\*
GraphicsBox[{},
AspectRatio->1,
Frame->True,
Method->{"TransparentPolygonMesh" -> True},
PlotRange->{{-2., 2.}, {-2., 2.}},
PlotRangeClipping->True,
PlotRangePadding->{
Scaled[0.02],
Scaled[0.02]}]\)

==========================
==========================
=================

things are just fine.

It appears that in the latter case, the first input line creates the list of symbolic expressions and this is then numerically evaluated by the second line, whereas in the former case the numerical evaluation somehow tries to precede the creation of the symbolic expression. I would be grateful for shedding some more light on this, possibly by directing me to some tutorial.  I confess I am a Mathematica rookie. Thanks.






  • Prev by Date: Incorrect (unexpected) output from TransformedField
  • Next by Date: anyone know of software to recover .nb files from a reformatted PC HDD?
  • Previous by thread: Re: Incorrect (unexpected) output from TransformedField
  • Next by thread: anyone know of software to recover .nb files from a reformatted PC HDD?