Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python newton raphson

from PIL import Image

imagesize = 1024
image = Image.new("RGB", (imagesize, imagesize))

maxIt = 60

for y in range(imagesize):
  zy = y * (2.0 - 2.0) / (imagesize - 1) + 2.0
  for x in range(imagesize):
    zx = x * (2.0 - 2.0) / (imagesize - 1) + 2.0

    z = complex(zx, zy)

    for i in range(maxIt):

      z0 = z - (z**3 - 1.0) / (3 * z**2) 
      if abs(z0 - z) < 1e-3: 
        break
        z = z0

        image.putpixel((x, y), (i % 4 * 64, i % 8 * 32, i % 16 * 16))
        
image.save(f"./newton.png", "PNG")
Comment

PREVIOUS NEXT
Code Example
Python :: selenium find element by link text 
Python :: text to speech module python 
Python :: partition python 
Python :: Finding the maximum element from a matrix with Python numpy.argmax() 
Python :: how to use iteration in python 
Python :: python string: immutable string 
Python :: jquery datepicker disable 
Python :: How to get the Tkinter Label text 
Python :: print numbers from 1 to 100 in python 
Python :: api key python 
Python :: open chrome console in selenium 
Python :: stringindexer pyspark 
Python :: fluffy ancake recipe 
Python :: add in python 
Python :: put grid behind matplotlib 
Python :: python how to make a user input function 
Python :: python builtwith 
Python :: how to find the summation of all the values in a tuple python 
Python :: error aesthetics must be either length 1 or the same as the data (3) fill 
Python :: python global keyword 
Python :: value_counts sort by index 
Python :: print items of list using list comprehension in python 
Python :: slug 
Python :: bash: line 1: templates/addtask.html: No such file or directory in flask app 
Python :: create bbox R sp 
Python :: run shell script to yaml file 
Shell :: remove angular cli 
Shell :: git allow unrelated histories 
Shell :: ubuntu install gimp 
Shell :: maven skip tests 
ADD CONTENT
Topic
Content
Source link
Name
4+9 =