solving equation using newton raphson method