-cubic solution using newton's method