Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #15240

Order-of-evaluation related issue when using TransformedField

From Zdeněk Hurák <hurak@seznam.cz>
Newsgroups comp.soft-sys.math.mathematica
Subject Order-of-evaluation related issue when using TransformedField
Date 2013-07-23 21:17 +0000
Message-ID <ksmrsc$66$1@smc.vnet.net> (permalink)
Organization Time-Warner Telecom

Show all headers | View raw


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.



Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Order-of-evaluation related issue when using TransformedField Zdeněk Hurák <hurak@seznam.cz> - 2013-07-23 21:17 +0000

csiph-web