#!/usr/bin/env python3
"""Auto-generated by AGI Loop cycle #1057
Task: Write a Python function that implements Newton's method to find square root of 2 to 15 decimal places
Generated: 2026-02-12T18:30:18.110297
"""

import math

def newton_sqrt(n, tolerance=1e-15, max_iterations=100):
    """
    Implements Newton's method to find the square root of n.
    Returns the square root with precision up to 15 decimal places.
    """
    guess = n / 2.0  # Initial guess
    for _ in range(max_iterations):
        next_guess = (guess + n / guess) / 2
        if abs(next_guess - guess) < tolerance:
            return next_guess
        guess = next_guess
    return guess

if __name__ == '__main__':
    result = newton_sqrt(2)
    print(f"Square root of 2 using Newton's method: {result:.15f}")