human
I am working on the file "OODE/.ipynb_checkpoints/introduction_hints-checkpoint.ipynb".
The first task is:
In functions declared with def it is also possible to have optional arguments.
They have to appear after nonoptional arguments:
Can you write Python program for it?
assistant
#Here is the Python program you requested.

def newton_squareroot(a, x0 = 1.0, tol = 1e-12, itmax = 100):
    """
    Compute square root of a by Newton iteration, with initial guess x0
    """
    x = x0
    it = 0
    while (abs(x*x-a) > tol and it < itmax):
        x = .5*(x+a/x)
        it += 1
    return x, it                 # return the computed square root x and the number of iterations

print(newton_squareroot(3.4))