Group Abstract Group Abstract

Message Boards Message Boards

0
|
3.5K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

An attempt to make an exprssion shorter and neater

Posted 3 years ago

I have the following expression:

Show[
 ParametricPlot[
  Table[
   {u[j]},
   {j, Min[Im@z1, Im@z2], Max[Im@z1, Im@z2]}]
  , {t, 0, 1}]
 ,
 ParametricPlot[
  Table[
   v[j],
   {j, Min[Re@z1, Re@z2], Max[Re@z1, Re@z2]}]
  , {t, 0, 1}]
 ]

I am not showing the explicit meaning of u and v to de-clutter the idea of the question.

As you can see the limits for the iterator j of the two Tables make use of Min and Max in a very similar way, once with the Im and once with the Re of z1 and z2.

My question is if I can make this expression look neater and more concise, together with the fact that the limits for ParametricPlot is {t,0,1} in both of them.

Any idea or suggestion would be very welcome.

POSTED BY: Ehud Behar
2 Replies
POSTED BY: Michael Rogers

It is somewhat tricky to unify the similar constructs, because Table must be kept from evaluating too soon. Here is an attempt, probably not so readable:

With[{z = {1 + I, -1 - 2 I},
  u = {t + #, #} &, v = {t - #, t^2 #} &},
 Flatten[
  tbl[f[j], {j, Splice[MinMax[g /@ z]]}] /.
    {{f -> u, g -> Im},
     {f -> v, g -> Re}} /.
   tbl -> Table,
  1];
 ParametricPlot[%, {t, 0, 1}]]
POSTED BY: Gianluca Gorni
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard