# Tag Info

13

You can use TransformedField to get a function that can be used as the first argument of ContourPlot: f = (r^2 - a^3/r) Sin[t]^2; tf = TransformedField[ "Polar" -> "Cartesian", f, {r, t} -> {x, y}] TeXForm @ tf $\frac{y^2 \left(x^2 \sqrt{x^2+y^2}+y^2 \sqrt{x^2+y^2}-1\right)}{\left(x^2+y^2\right)^{3/2}}$ cValues = {0.00001, 0.01, 0.05, 0.1, 0.3, ...

9

The "Details" section of that page refers to CoordinateChartData. Now this is a bit dense, but it contains everything you need. First of all, you can try to find out what kind of things you can find out about spherical coordinates: In[9]:= CoordinateChartData["Spherical", "Properties"] Out[9]= {"AlternateCoordinateNames", "CoordinateRangeAssumptions", ...

7

ClearAll[f] f[x0_, y0_] := D[{Sqrt[x^2 + y^2], ArcTan[x, y]}, {{x, y}}] /. {x -> x0, y -> y0} f[0.3, 0.5] // MatrixForm I would caution you against using MatrixForm in the definition, as that would leave you with results that cannot be easily used in further computation.

7

Mathematica's answer is correct and consistent with your expectations, but you are not accounting for the basis of the vector field. TransformedField transforms a vector field between two coordinate systems and bases. In this case, it is converting from $f(x,y)\hat x+g(x,y)\hat y$ to the same geometrical vector field expressed as $u(r,\theta)\hat r + v(r,\... 7 We can define our own functions. From$x',y'$to$r',\theta'$, we derive: $$r' = \left(\sqrt{x^2 +y^2} \right)' = \frac{(x^2 +y^2)'}{2 \sqrt{x^2 +y^2}}=\frac{xx' +yy'}{r}$$ and $$\theta' = \left(\arctan \frac{y}{x} \right)' = \frac{(y/x)'}{1+(y/x)^2} = \frac{y' x -x' y}{r^2}.$$ First, we define rdot[x1_, x2_] := (x1 (μ x1 - x2 - σ x1 (x1^2 + ... 7 Using MeshFunctions and Mesh in a ParametricPlot of polar coordinates to define the contours: cValues = {0.00001, 0.01, 0.05, 0.1, 0.3, 0.6, 1.0, 1.5, 2.0, 2.5, 3.2}; Block[{a = 1}, ParametricPlot[r {Cos[\[Theta]], Sin[\[Theta]]}, {r, 0, 3 a}, {\[Theta], 0, 2 Pi}, PlotStyle -> None, BoundaryStyle -> None, PlotPoints -> {60, 120}, ... 6 For your type of data, you may want to consider a more continuous type of plot than the sector chart that the solution you reference uses. I would suggest DensityPlot. Here's an example: data = Import["~/Downloads/data.csv"]; interp = Interpolation@Flatten[MapIndexed[{#2, #} &, data, {2}], 1]; DensityPlot[ interp[(Arg[x + y I] + Pi)/Degree, Sqrt[x^2 + ... 6 Here is how to do the coordinate system conversion by hand: cValues = {0.00001, 0.01, 0.05, 0.1, 0.3, 0.6, 1.0, 1.5, 2.0, 2.5, 3.2}; ContourPlot[ (Norm[{x, y}]^2 - 3/Norm[{x, y}]) Sin[ArcTan[x, y]]^2, {x, -3, 3}, {y, -3, 3}, Contours -> cValues ] 5 Carl's answer is very good. I'm offering this alternate answer for completeness. The documentation for CoordinateChartData contains a brief description of the different vcoordinates in the "Details" section. For example, it has this description for "Spherical": spherical coordinates with poles along the$z$axis and coordinates in the order radius, polar ... 5 You can use CoordinateChartData to get the expected standard names: coords = CoordinateChartData["Spherical", "StandardCoordinateNames"] {"r", "θ", "φ"} and the corresponding ranges: CoordinateChartData["Spherical","CoordinateRangeAssumptions"] @ coords "r" > 0 && 0 < "θ" < π && -π < "φ" <= π and the volume factor: ... 5 GeoProjectionData has the "UPSNorth" and "UPSSouth" projections. For example, take the same point chosen by Carl: In[1]:= alert = GeoPosition[{82.5307536, -62.2750895}] Out[1]= GeoPosition[{82.5308, -62.2751}] Then you can do: In[2]:= GeoGridPosition[alert, "UPSNorth"] Out[2]= GeoGridPosition[{1.26494*10^6, 1.61368*10^6}, "UPSNorth"] Or you can construct ... 5 As mentioned above, I think this problem may be considered as a duplicate, but let me show the usage of my implicitPlot anyway: cValues = {0.00001, 0.01, 0.05, 0.1, 0.3, 0.6, 1.0, 1.5, 2.0, 2.5, 3.2}; With[{a = 1}, implicitPlot[(r^2 - a^3/r) Sin[theta]^2, {r, 0, 3}, {theta, 0, 2 Pi}, "Polar", PlotPoints -> 25, Contours -> cValues]] You can of ... 5 Here is an alternative way. We can solve for r and plot$[\theta,r]$. Solve[(r^2 - a^3/r) Sin[θ]^2 == g, r]$\left\{\left\{r\to \frac{\sqrt[3]{2} g}{\sqrt[3]{\sqrt{729 \sin ^{12}(\theta )-108 g^3 \sin ^6(\theta )}+27 \sin ^6(\theta )}}+\frac{\csc ^2(\theta ) \sqrt[3]{\sqrt{729 \sin ^{12}(\theta )-108 g^3 \sin ^6(\theta )}+27 \sin ^6(\theta )}}{3 \sqrt[...

4

If you use BoundaryDiscretizeRegion, you can control the resolution of the boundary: BoundaryDiscretizeRegion[r2, MaxCellMeasure -> "Length" -> 0.005]

3

a1 = data[[All, 1]]^# & /@ {2, 1, 0} ; a2 = Table[data[[All, 1]]^(3 - i), {i, 3}] a1 == a2 == A True

3

I would interpret c) as asking for a plot of $\{r\,\cos\,\theta, r\,\sin\,\theta\}$. This can be done as follows: With[{mu = 4.5, g = 9.8}, {rF, θF} = NDSolveValue[ {(mu + 1)*r''[t] - r[t]*Theta'[t]^2 + g*(mu - Cos[Theta[t]]) == 0, r[t]*Theta''[t] + 2 r'[t]*Theta'[t] + g*Sin[Theta[t]] == 0, r[0] == 1, Theta[0] == Pi/2, r'[...

3

It may be possible using RiccatiSolve which can solve an equation of the form $$a^{T }.x+x.a-x.b.r^{-1}.b^{T }.x+q=0$$ If we assume $x=x^T$ and then choose values $a=0$, $b=I$, $r=A^{-1}$, and $q=B$, the above equation becomes $$0^{T }.x+x.0-x^T.I.(A^{-1})^{-1}.I^{T }.x+B=0$$ $$x^T.A.x=B$$ The assumption $x=x^T$ specifies conditions that the matrices \$...

2

Here is my second attempt. With this code, I'm able to reproduce the result of InverseRadon up to a small offset: {x, y} = {80, 330}; point = Image[Normal@SparseArray[{{x, y} -> 1}, {100, 360}]]; line = InverseRadon[point, {400, 400}]; pixel = PixelValuePositions[line, White, 1]; {h, w} = {100., 360.}; norm = 400; d = Rescale[x, {0, h}, {norm/Sqrt[2.], ...

2

Here is an alternative approach, which is a slightly simplified version of the "diskfun" methods available in Chebfun. One might wish to note the similarities and differences between this method and the method in this previous answer. Briefly: I will construct an interpolaing function to the OP's data by using SVD to decompose the data into a "radial part" ...

1

A={data[[All, 1]]^2, data[[All, 1]], Table[1, Length@ddata]}; B=data[[All, 2]]

1

Hint. x0 = m11*x1 + m12*y1 + m13*z1 + b1 y0 = m21*x1 + m22*y1 + m23*z1 + b2 z0 = m31*x1 + m32*y1 + m33*z1 + b3 m = 2 eqn = Sum[If[i + j + k <= m, Subscript[a, i, j, k]*x0^i*y0^j*z0^k, 0], {i, 0, m}, {j, 0, m}, {k, 0, m}] coefs = Flatten[CoefficientRules[eqn, {x1, y1, z1}]] For[i = 1; Lindex = {}, i <= Length[coefs], i++, AppendTo[Lindex, First[...

1

You can write something like f[{r_, θ_}] := Module[{M = D[{Sqrt[x^2 + y^2], ArcTan[x, y]}, {{x, y}}]}, Block[{x = r Cos[θ], y = r Sin[θ]}, M]] I wouldn't be surprised if this has a slightly simpler formulation. The symbolic result agrees with what I expect: Assuming[r > 0, Simplify[f[{r, θ}]]] (* {{Cos[θ], Sin[θ]}, {-(Sin[θ]/r), Cos[θ]/r}} *) ...

1

You can do this with the Geo functionality, which knows the "Hammer" projection: GeoImage["World", GeoStyling[{Import["..."], "Projection" -> "Hammer"}], GeoProjection -> "Equirectangular"]

1

(Several points that make it too long for a comment.) As @LouisB points out in the comments, StateSpaceTrasform is expecting a transformation of dimension {2, 2}. The usage of NonlinearStateSpaceModel should be something as shown below. What you have is GIGO. (Just try StateSpaceModel[system].) eqns = {D[y1[t], t] == y2[t], D[y2[t], t] == -theta[t]^2 ...

1

ClearAll[f] f[c_, d_] := d p1 = Plot3D[f[c, d], {c, 0, 1}, {d, 0, 1}, ImageSize -> 300]; f2 = Rescale[f[##], {0, 1}, {1, Sqrt[3]}/2] &; p2 = Plot3D[ f2[c, d], {c, 0, 1}, {d, 0, 1}, ImageSize -> 300]; Row[{p1, p2}, Spacer[5]]

1

You can solve this problem by using a web API to do arbitrary transformations (in this way you can convert to and from any spatial reference system, and are not limited to the systems that WL supports natively) For instance: geoposToXYZ[pos_] := Module[{ll = QuantityMagnitude[LatitudeLongitude@pos]}, <| "y" -> ll[[1]], "x" -> ll[[2]]|>] ...

1

My slightly different method matches Mathematica. aCartToCyl[{ax_, ay_}] := {ax Cos[ϕ] + ay Sin[ϕ], ay Cos[ϕ] - ax Sin[ϕ]} aCartToCyl[{μ x1 - x2 - σ x1 (x1^2 + x2^2), x1 + μ x2 - σ x2 (x1^2 + x2^2)}] // Simplify; % /. {x1 -> r Cos[ϕ], x2 -> r Sin[ϕ]} // Simplify (*{μ r - r^3 σ, r}*)

Only top voted, non community-wiki answers of a minimum length are eligible