Message Boards Message Boards

0
|
3237 Views
|
3 Replies
|
0 Total Likes
View groups...
Share
Share this post:

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

Posted 4 years ago
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

POSTED BY: Yaw Antoa Onyina
3 Replies
Posted 4 years 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 BY: Rohit Namjoshi

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.

POSTED BY: Ahmed Elbanna

Thanking everybody for the excellent effort.

POSTED BY: Yaw Antoa Onyina
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