Question: How do I only plot certain points from a list?

I have a set of points. I only want to plot ones with x and y less that 5 units from [0,0]. I can do it with for do loop. Can't get it to work with seq. Ideally I don't want to create another list.

restart

NULL

points := [[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.7259335832e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.1855663689e-1, .1572001339], [8.963609684, 7.419424024], [.7724026996, .1662719092], [1.278337644, 0.7583092624e-1]]

``

" points2:= [seq('if'(" abs"(points[i,1])<5 and abs(points[i,2])<5, points[i] ,0)  ,i=1..10)] "

[[-.4821957161, -.3251957485], [-1.079859775, -1.473869954], [.7429089919, .1649759550], [1.329939269, 0.7259335832e-1], [-.1254930617, .1268183497], [-10.63408888, -2.637665397], [-0.1855663689e-1, .1572001339], `if`(false, [8.963609684, 7.419424024]), [.7724026996, .1662719092], [1.278337644, 0.7583092624e-1]]

(1)

``

redp := plots:-pointplot(points, colour = red, symbolsize = 4, symbol = solidcircle)

 

plots:-pointplot(points2, colour = red, symbolsize = 4, symbol = solidcircle)

Error, invalid input: `if` expects 3 arguments, but received 2

 

NULL

NULL

Download 13-3-22_remove_points_plotting.mw

Please Wait...