Ask Your Question
1

show (a[i] for i in 1:5)

asked 2022-02-03 20:18:03 +0200

ErWinz gravatar image

hi

 f(x,y)=y^2-x/2
 a=[]
 a.append(implicit_plot(f(x,y)==1,(x,-9,9),(y,-9,9)))
 a.append(implicit_plot(f(x,y)==2,(x,-9,9),(y,-9,9)))
 show(a[0]+a[1])

if i make a for, in order to plot several {f(x,y)=k}, how can i write the 'show' ?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2022-02-04 00:28:08 +0200

slelievre gravatar image

Use sum.

show(sum(a))
edit flag offensive delete link more
0

answered 2022-02-03 20:37:11 +0200

Emmanuel Charpentier gravatar image

updated 2022-02-03 20:46:13 +0200

One possibility :

sage: f(x,y) = y^2-x/2
sage: sum(map(lambda u:implicit_plot(f-u, (-9, 9), (-9, 9)), range(5)))
Launched png viewer for Graphics object consisting of 5 graphics primitives

Another :

sage: contour_plot(f, (-9, 9), (-9, 9), contours=range(5), labels=True, fill=False)

HTH,

edit flag offensive delete link more

Comments

thanks a lot !

ErWinz gravatar imageErWinz ( 2022-02-03 20:44:13 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2022-02-03 20:18:03 +0200

Seen: 109 times

Last updated: Feb 04 '22