Message Boards Message Boards

GROUPS:

Excluding the input value say j=0 from the input values {j, -30, 30, 10}

Posted 1 month ago
386 Views
|
3 Replies
|
0 Total Likes
|
lat = Table[j Pi/180., {j, -30, 30, 10}]; Show[Graphics3D[Sphere[]], 
     ParametricPlot3D[{Cos[x] Sin[Pi/2 - #], Sin[x] Sin[Pi/2 - #], 
         Cos[Pi/2 - #]}, {x, 0, 2 Pi}] & /@ lat, Boxed -> False]

Is it possible to exclude an input value say j=0 from the input values {{j, -30, 30, 10} for the function Table[j Pi/180., {{j, -30, 30, 10}] in the above Mathematica code just so the middle latitude which happens to be the equator will not be drawn

The Mathematica code happens to be a code I want to adopt from the reply of Hans Dolhaine, retired in the community post "How to display latitude and longitude lines on the sphere?" contributed by Qiu Mianp, SOHO

3 Replies
Posted 1 month ago

Hi Yaw,

If you just want to exclude zero values

lat = Table[j Pi/180., {j, -30, 30, 10}] // Select[# != 0 &]

If you want specific values

lat = Table[j Pi/180., {j, {-45, -22.5, -15, 15, 30, 60}}]
Posted 1 month ago

another way...

lat= # Pi/180 & /@ Complement[Range[-30, 30, 10], {0}]

and you can add any elements to the set {0} to remove from the generated input values.

Thanking everybody for the excellent effort.

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract