Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitdf9eda9

Browse files
Revert "use np to solve equation"
This reverts commit115772a
1 parent115772a commitdf9eda9

File tree

1 file changed

+2
-43
lines changed

1 file changed

+2
-43
lines changed

‎31.py

Lines changed: 2 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,10 @@
11
fromPILimportImage
22
fromPILimportImageSequence
3-
importnumpyasnp
4-
importmatplotlib.pyplotasplt
53

64

75
defmain():
86
pic_path="ufo/mandelbrot.gif"
9-
# first_step(pic_path)
10-
# second_step()
11-
# plt.imshow(mandelbrot(1000, 1000))
12-
# plt.show()
13-
numPyVersion()
7+
first_step(pic_path)
148

159

1610
deffirst_step(input):
@@ -24,44 +18,9 @@ def first_step(input):
2418
height=480
2519
forxinrange(width):
2620
foryinrange(height):
27-
print(im.getpixel((x,y)),end=" ")
21+
print(im.getpixel((x,y)),end=" ")
2822
print()
2923

3024

31-
defsecond_step():
32-
a=np.arange(15).reshape(3,5)
33-
print(a)
34-
print(a.shape)
35-
print(a.ndim)
36-
print(a.dtype.name)
37-
print(a.dtype)
38-
print(a.itemsize)
39-
print(type(a))
40-
41-
b=np.array([6,7,8])
42-
print(b)
43-
print(b.shape)
44-
pass
45-
46-
47-
defmandelbrot(h,w,maxit=20):
48-
y,x=np.ogrid[-1.4:1.4:h*1j,-2:0.8:w*1j]
49-
c=x+y*1j
50-
z=c
51-
divtime=maxit+np.zeros(z.shape,dtype=int)
52-
53-
foriinrange(maxit):
54-
z=z**2+c
55-
diverge=z*np.conj(z)>2**2
56-
div_now=diverge& (divtime==maxit)
57-
divtime[div_now]=i
58-
z[diverge]=2
59-
returndivtime
60-
61-
62-
defnumPyVersion():
63-
print(np.version.version)
64-
65-
6625
if__name__=="__main__":
6726
main()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp