Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #6961 > unrolled thread
| Started by | Barrie Stokes <Barrie.Stokes@newcastle.edu.au> |
|---|---|
| First post | 2011-12-06 08:16 +0000 |
| Last post | 2011-12-08 10:39 +0000 |
| Articles | 6 — 3 participants |
Back to article view | Back to comp.soft-sys.math.mathematica
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: Ploting a transformation of a set Barrie Stokes <Barrie.Stokes@newcastle.edu.au> - 2011-12-06 08:16 +0000
Re: Ploting a transformation of a set Dan <dflatin@rcn.com> - 2011-12-07 11:16 +0000
Re: Ploting a transformation of a set Dan <dflatin@rcn.com> - 2011-12-07 11:24 +0000
Re: Ploting a transformation of a set Barrie Stokes <Barrie.Stokes@newcastle.edu.au> - 2011-12-08 10:34 +0000
Re: Ploting a transformation of a set Barrie Stokes <Barrie.Stokes@newcastle.edu.au> - 2011-12-08 10:35 +0000
Re: Ploting a transformation of a set 真 童 <z.tong1017@gmail.com> - 2011-12-08 10:39 +0000
| From | Barrie Stokes <Barrie.Stokes@newcastle.edu.au> |
|---|---|
| Date | 2011-12-06 08:16 +0000 |
| Subject | Re: Ploting a transformation of a set |
| Message-ID | <jbkj0l$i30$1@smc.vnet.net> |
Hi Ray
Very nice.
This is exactly what I had in mind when I went to use colour in ListPlot, but as I said , ListPlot seems to need Joined->True, and then colours the lines.
Based entirely on your code, I offer the following Manipulate, suggesting other ways to explore/understand the (slightly generalised) transformation.
xy = .08 Flatten[Table[{x, y}, {x, 0, 25}, {y, 0, 25 - x}], 1];
Manipulate[
mapping = (s \[Function] {(s[[1]] + c s[[2]])^p, (s[[2]] + c s[[1]])^
p});
With[{plotstuff = {AspectRatio -> Automatic, Frame -> True},
h = Hue[.5 Plus @@ #] &},
Show[GraphicsRow[
{Graphics[{PointSize[.02], {h@#, Point@#} & /@ xy}, plotstuff],
Graphics[{PointSize[.02], {h@#, Point@mapping@#} & /@ xy},
plotstuff]}],
ImageSize -> 600]],
{{c, 0.5}, 0, 1, 0.05},
{{p, 0.5}, 0.1, 1, 0.05}]
Cheers
Barrie
>>> On 05/12/2011 at 7:49 pm, in message
<485951015.465117.1323074989841.JavaMail.root@jaguar8.sfu.ca>, Ray Koopman
<koopman@sfu.ca> wrote:
> Here are two static plots that should help clarify
> which points on the left map into which points on the right.
> The only difference between the two plots is the definition of h.
>
> xy = .08 Flatten[Table[{x,y}, {x,0,25},{y,0,25-x}], 1];
> UV = Sqrt[#.{{1,.5},{.5,1}}]&;
>
> With[{plotstuff = {AspectRatio -> Automatic, Frame->True},
> h = Hue[.5Plus@@#]&},
> Show[GraphicsRow[
> {Graphics[{PointSize[.03],{h@#,Point@#}&/@xy}, plotstuff],
> Graphics[{PointSize[.03],{h@#,Point@UV@#}&/@xy}, plotstuff]}],
> ImageSize -> 600]]
>
> With[{plotstuff = {AspectRatio -> Automatic, Frame->True},
> h = Hue[(Subtract@@#+2)/4]&},
> Show[GraphicsRow[
> {Graphics[{PointSize[.03],{h@#,Point@#}&/@xy}, plotstuff],
> Graphics[{PointSize[.03],{h@#,Point@UV@#}&/@xy}, plotstuff]}],
> ImageSize -> 600]]
>
> ----- Barrie Stokes <Barrie.Stokes@newcastle.edu.au> wrote:
>> Hi Ray, Hi Justin
>>
>> Ray, I like your idea for displaying this transformation, but wanted
>> to be sure myself which xy points were going to which uv points.
>>
>> The first thing I tried was to get colour into the picture,
>> but the following is deceptive:
>>
>> xy = .2 Flatten[
>> Table[ {x, y}, {x, 0, 10, 0.2}, {y, 0, 10 - x, 0.2} ], 1 ];
>> uv = Sqrt[ xy.{{1, .5}, {.5, 1}} ];
>> With[ {plotstuff = {Joined -> True, AspectRatio -> Automatic,
>> Frame -> True, Axes -> None, Prolog -> PointSize[ .02 ]}},
>> Show[ GraphicsRow[ {ListPlot[ xy, plotstuff,
>> ColorFunction -> "Rainbow" ],
>> ListPlot[ uv, plotstuff, ColorFunction -> "Rainbow" ]} ],
>> ImageSize -> 600 ] ]
>>
>> as I found when I tried
>>
>> Manipulate[
>> (xy = .2 Flatten[
>> Table[ {x, y}, {x, 0, 10, 0.25}, {y, 0, 10 - x, 0.25} ], 1 ];
>> uv = Sqrt[ xy.{{1, .5}, {.5, 1}} ];
>> With[ {
>> plotstuff1 = {AspectRatio -> Automatic, Frame -> True,
>> Axes -> None,
>>
>> Prolog -> {PointSize[ .02 ], {PointSize[ .04 ], Hue[ 0 ],
>> Point[ u ]}}},
>> plotstuff2 = {AspectRatio -> Automatic, Frame -> True,
>> Axes -> None,
>> Prolog -> {PointSize[ .02 ], {PointSize[ .04 ], Hue[ 0 ],
>> Point[ {Sqrt[
>> \!\(\*SubscriptBox[\(u\), \(\(\[LeftDoubleBracket]\)\(\ \)\(1\)\(\ \)\
>> \(\[RightDoubleBracket]\)\)]\) + 0.5
>> \!\(\*SubscriptBox[\(u\), \(\(\[LeftDoubleBracket]\)\(\ \)\(2\)\(\ \)\
>> \(\[RightDoubleBracket]\)\)]\)], Sqrt[
>> \!\(\*SubscriptBox[\(u\), \(\(\[LeftDoubleBracket]\)\(\ \)\(2\)\(\ \)\
>> \(\[RightDoubleBracket]\)\)]\) + 0.5
>> \!\(\*SubscriptBox[\(u\), \(\(\[LeftDoubleBracket]\)\(\ \)\(1\)\(\ \)\
>> \(\[RightDoubleBracket]\)\)]\)]} ]}}}},
>> Show[ GraphicsRow[ {ListPlot[ xy, plotstuff1 ],
>> ListPlot[ uv, plotstuff2 ]} ],
>> ImageSize -> 600 ] ]),
>> {u, {0, 0}, {2, 2}}, ControlType -> Slider2D ]
>>
>> As the latter shows clearly, the xy diagonal maps to the curved end
>> of the "fan" region in the uv plane, but the colours (only possible
>> easily with Joined->True, at a quick look) in the first plot cover
>> the spectrum from red (0,2) to purple (2,0) along the xy diagonal,
>> whereas the colours across the end of the "fan" are in the red to
>> orange range only.
>>
>> I'll bet there are other ways to show the details of such mappings, but
>> I like to try to find uses for Manipulate, hence my red dot animation.
>>
>> Cheers
>>
>> Barrie
>>
>> On 02/12/2011 at 11:20 pm, in message <201112021220.HAA01862@smc.vnet.net>,
>> Ray Koopman <koopman@sfu.ca> wrote:
>>> On Nov 30, 12:19 am, Justin <justin.vala...@gmail.com> wrote:
>>>> Hello,
>>>> I would like to plot the following transformation of the set
>>>> {x,y; x+y<2 & x>0 & y>0} => {(x+.5y)^.5, (y+.5x)^.5}.
>>>> Is there any way to do this in mathematica?
>>>> thanks
>>>
>>> xy = .2 Flatten[Table[{x,y},{x,0,10},{y,0,10-x}],1];
>>> uv = Sqrt[xy.{{1,.5},{.5,1}}];
>>> With[{plotstuff = {AspectRatio->Automatic, Frame->True, Axes->None,
>>> Prolog->PointSize[.02], DisplayFunction->Identity}},
>>> Show[GraphicsArray[{ListPlot[xy,plotstuff],ListPlot[uv,plotstuff]}],
>>> ImageSize->600]]
[toc] | [next] | [standalone]
| From | Dan <dflatin@rcn.com> |
|---|---|
| Date | 2011-12-07 11:16 +0000 |
| Message-ID | <jbnhv7$470$1@smc.vnet.net> |
| In reply to | #6961 |
Here is another version of the grid approach, this time using grid
lines conforming to the color function used in the thread above.
Manipulate[
Module[{g1,g2,map,opts,n=5,pp,ppm},
g1[t_,k_]:=2{t+(k/n),-t};
g2[t_,k_]:=2{t-(k/n),t};
map=({x,y}\[Function]{(x+a y)^b,(a x+y)^b});
opts=Sequence[PlotRange->{{0,2},{0,2}},
Frame->True,Axes->False,
ImageSize->200,ImagePadding->{{30,5},{20,5}}];
pp[g_,kmin_,kmax_,color_]:=ParametricPlot[Table[g[t,k],
{k,kmin,kmax}],{t,-5,5},
PlotStyle->color,Evaluate@opts
];
ppm[g_,kmin_,kmax_,color_]:=ParametricPlot[Table[map@@g[t,k],
{k,kmin,kmax}],{t,-5,5},
PlotStyle->color,Evaluate@opts
];
Grid[{{
Show[{pp[g1,0,2n,ColorData[1][1]],pp[g2,-n,n,ColorData[1][2]]}],
Show[{ppm[g1,0,2n,ColorData[1][1]],ppm[g2,-n,n,ColorData[1]
[2]]}]
}}]
],
{{a,0.5},0,1,0.05},
{{b,0.5},0.1,1,0.05}
]
[toc] | [prev] | [next] | [standalone]
| From | Dan <dflatin@rcn.com> |
|---|---|
| Date | 2011-12-07 11:24 +0000 |
| Message-ID | <jbnidi$4a0$1@smc.vnet.net> |
| In reply to | #6961 |
Another approach would be to look at the transformation of the grid. I
find this sort of visualization more informative for these sorts of
mappings. For example:
With[{n=10,c1=ColorData[1][1],c2=ColorData[1][2]},
refGrid=Show[{
ParametricPlot[Table[{2t,2(k/n)},{k,n}],{t,0,1},PlotStyle->c1],
ParametricPlot[Table[{2(k/n),2t},{k,n}],{t,0,1},PlotStyle->c2]
},ImageSize->200];
Manipulate[
Module[{map},
map=({x,y}\[Function]{(x+a y)^b,(a x+y)^b});
Grid[{{
refGrid,
Show[{
ParametricPlot[Table[map@@{2t,2(k/n)},{k,n}],{t,
0,1},PlotStyle->c1],
ParametricPlot[Table[map@@{2(k/n),2t},{k,n}],{t,
0,1},PlotStyle->c2]
},ImageSize->200]
}}]
],
{{a,0.5},0,1,0.05},
{{b,0.5},0.1,1,0.05}
]
]
-- Dan
[toc] | [prev] | [next] | [standalone]
| From | Barrie Stokes <Barrie.Stokes@newcastle.edu.au> |
|---|---|
| Date | 2011-12-08 10:34 +0000 |
| Message-ID | <jbq3rt$ipo$1@smc.vnet.net> |
| In reply to | #6961 |
Hi Dan
As I suspected, the sky's the limit. This is very elegant, because the map is coded very explicitly in your approach.
Barrie
>>> On 07/12/2011 at 10:13 pm, in message <201112071113.GAA04114@smc.vnet.net>, Dan
<dflatin@rcn.com> wrote:
> Here is another version of the grid approach, this time using grid
> lines conforming to the color function used in the thread above.
>
> Manipulate[
> Module[{g1,g2,map,opts,n=5,pp,ppm},
> g1[t_,k_]:=2{t+(k/n),-t};
> g2[t_,k_]:=2{t-(k/n),t};
> map=({x,y}\[Function]{(x+a y)^b,(a x+y)^b});
> opts=Sequence[PlotRange->{{0,2},{0,2}},
> Frame->True,Axes->False,
> ImageSize->200,ImagePadding->{{30,5},{20,5}}];
> pp[g_,kmin_,kmax_,color_]:=ParametricPlot[Table[g[t,k],
> {k,kmin,kmax}],{t,-5,5},
> PlotStyle->color,Evaluate@opts
> ];
> ppm[g_,kmin_,kmax_,color_]:=ParametricPlot[Table[map@@g[t,k],
> {k,kmin,kmax}],{t,-5,5},
> PlotStyle->color,Evaluate@opts
> ];
> Grid[{{
> Show[{pp[g1,0,2n,ColorData[1][1]],pp[g2,-n,n,ColorData[1][2]]}],
> Show[{ppm[g1,0,2n,ColorData[1][1]],ppm[g2,-n,n,ColorData[1]
> [2]]}]
> }}]
> ],
> {{a,0.5},0,1,0.05},
> {{b,0.5},0.1,1,0.05}
> ]
[toc] | [prev] | [next] | [standalone]
| From | Barrie Stokes <Barrie.Stokes@newcastle.edu.au> |
|---|---|
| Date | 2011-12-08 10:35 +0000 |
| Message-ID | <jbq3ts$iqa$1@smc.vnet.net> |
| In reply to | #6961 |
Hi Dan
This is very nice too.
I think stabilising the mapped plane with PlotRange helps:
With[ {n = 10, c1 = ColorData[ 1 ][ 1 ], c2 = ColorData[ 1 ][ 2 ]},
refGrid = Show[ {
ParametricPlot[ Table[ {2 t, 2 (k/n)}, {k, n} ], {t, 0, 1},
PlotStyle -> c1 ],
ParametricPlot[ Table[ {2 (k/n), 2 t}, {k, n} ], {t, 0, 1},
PlotStyle -> c2 ]
}, ImageSize -> 200 ];
Manipulate[
Module[ {map},
map = ({x, y} \[Function] {(x + a y)^b, (a x + y)^b});
Grid[ {{
refGrid,
Show[ {
ParametricPlot[ Table[ map @@ {2 t, 2 (k/n)}, {k, n} ], {t,
0, 1}, PlotStyle -> c1, PlotRange -> {{0, 2}, {0, 2}} ],
ParametricPlot[ Table[ map @@ {2 (k/n), 2 t}, {k, n} ], {t,
0, 1}, PlotStyle -> c2, PlotRange -> {{0, 2}, {0, 2}} ]
}, ImageSize -> 200 ]
}} ]
],
{{a, 0.5}, 0, 1, 0.05},
{{b, 0.5}, 0.1, 1, 0.05}
]
]
Cheers
Barrie
PS
I like your indenting for clarity. I purposely use "[space" and "space]" everywhere in code I paste into emails. Gradually my spellchecker will know every reserved word in Mathematica.
>>> On 07/12/2011 at 10:15 pm, in message <201112071115.GAA04280@smc.vnet.net>, Dan
<dflatin@rcn.com> wrote:
> Another approach would be to look at the transformation of the grid. I
> find this sort of visualization more informative for these sorts of
> mappings. For example:
>
> With[{n=10,c1=ColorData[1][1],c2=ColorData[1][2]},
> refGrid=Show[{
> ParametricPlot[Table[{2t,2(k/n)},{k,n}],{t,0,1},PlotStyle->c1],
> ParametricPlot[Table[{2(k/n),2t},{k,n}],{t,0,1},PlotStyle->c2]
> },ImageSize->200];
> Manipulate[
> Module[{map},
> map=({x,y}\[Function]{(x+a y)^b,(a x+y)^b});
> Grid[{{
> refGrid,
> Show[{
> ParametricPlot[Table[map@@{2t,2(k/n)},{k,n}],{t,
> 0,1},PlotStyle->c1],
> ParametricPlot[Table[map@@{2(k/n),2t},{k,n}],{t,
> 0,1},PlotStyle->c2]
> },ImageSize->200]
> }}]
> ],
> {{a,0.5},0,1,0.05},
> {{b,0.5},0.1,1,0.05}
> ]
> ]
>
> -- Dan
[toc] | [prev] | [next] | [standalone]
| From | 真 童 <z.tong1017@gmail.com> |
|---|---|
| Date | 2011-12-08 10:39 +0000 |
| Message-ID | <jbq45r$isd$1@smc.vnet.net> |
| In reply to | #6961 |
hello,can u help me solve a matrix problem~
A1 = {{-1/2*S22*\[Chi]^2 + I*a21*\[Chi],
I/(2*\[HBar])*\[CapitalDelta], -I/(2*\[HBar])*\[CapitalDelta],
0}, {I/(2*\[HBar])*\[CapitalDelta],
2*S12/\[HBar] - S22*X^2/2 - 2*S11/\[HBar] -
I*\[Epsilon]/\[HBar] - 2*I*\[Lambda]/\[HBar],
0, -I/(2*\[HBar])*\[CapitalDelta]}, {-I/(2*\[HBar])*\
\[CapitalDelta],
0, -2*S12/\[HBar] - S22*X^2/2 - 2*S11/\[HBar] +
I*\[Epsilon]/\[HBar] + 2*I*\[Lambda]/\[HBar],
I/(2*\[HBar])*\[CapitalDelta]}, {0, \
-I/(2*\[HBar])*\[CapitalDelta],
I/(2*\[HBar])*\[CapitalDelta], -1/2*S22*\[Chi]^2 +
I*a21*\[Chi]}} // MatrixForm
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Solve the eigenvalues of the matrix A1,thx!~
[toc] | [prev] | [standalone]
Back to top | Article view | comp.soft-sys.math.mathematica
csiph-web