Zadanie 2 z pracy pisemnej na 31.10.2014

1359 days ago by Marian

def f(x,y): if y != 0 or x != 0: return (x^2+y^2)*sin(1/(x^2+y^2)) else: return 0 
       
P = plot3d(f,(-1,1),(-1,1), adaptive=True, color=rainbow(60, 'rgbtuple'), max_bend=.1, max_depth=15) P.show() 
       
p1 = plot(lambda x: f(x,0),x,-1,1, color='blue') p2 = plot(lambda x: f(x,0.1),x,-1,1, color='green') p3 = plot(lambda x: f(x,0.5),x,-1,1, color='red') p4 = plot(lambda x: f(x,1),x,-1,1, color='yellow') p5 = plot(lambda x: f(x,5),x,-1,1, color='black') p1+p2+p3+p4+p5 
       
def dfdx(x,y): if y != 0 or x != 0: return 2*x*(sin(1/(x^2+y^2)) + (x^2+y^2)*cos(1/(x^2+y^2))) else: return 0 
       
p1 = plot(lambda x: dfdx(x,1/200),x,-1,1, color='red') p2 = plot(lambda x: dfdx(x,1/100),x,-1,1, color='green') p1+p2 
       
p1 = plot(lambda x: dfdx(x,1/2),x,-1,1, color='red') p2 = plot(lambda x: dfdx(x,1),x,-1,1, color='green') p3 = plot(lambda x: dfdx(x,11/10),x,-1,1, color='blue') p1+p2+p3