I have to solve an equation using Newton-Raphson. The problem is requiring that the code should not do more iterations than necessary.Also, the code must output the result of each iteration until the required solution.
took for example sin(x)=cos(2x) , starting point x(0)=1.
I'm thinking that I have to use a while loop, but I dont know what variable is the solution(for example if its x, x(k), the function).
Please give me some hints such that output is as required.