PHP代写:ICS3 Performance Task - Estimating Using Newton's Method

代写基本的PHP语法作业,用PHP递归实现牛顿定律的计算工作。

Background

This performance task will challenge students to create a dynamic site that will allow a users to enter information into a form and then give an output.

Newton’s Method is an excellent example of a recursive algorithm. It is a very old algorithm dating 1000s of years back - it was improved upon by Newton and the Calculus that he developed. This algorithm can be used to quickly calculate the square root of a number to a high degree of accuracy without using a calculator.

What is a Recursive Algorithm?

“A recursive algorithm is an algorithm which calls itself with “smaller (or simpler)” input values, and which obtains the result for the current input by applying simple operations to the returned value for the smaller (or simpler) input.”

Recursive algorithms can be done using conditional statements and loops. That is the task at hand.

If we were to keep a lot more decimal places we would quickly see that for each iteration after number 6 we would become more and more accurate. Putting the square root of 91 into your calculator.

Your Task

Create a file called preformance-task-newtons-method.php - the file should be a complete and properly formatted html document. Save it and upload it to the server; also link it to your index.php page.

  • The application should have an input that allows the user to enter in the number that they would like to take the square root of.
  • The user can also enter in how many iterations of the recursion they would like to do. Limit this this 20 iterations.
  • When the user submits the form the application will run the calcuation as a loop for the desired number of iterations and output the value each time.
  • Once the loop is complete use the sqrt() function in php to calculate the square root of the number and compare it to the estimated value using Newton’s Method.
  • You must style the page and give it a relevant theme and heading. You must also include a graphic of the equation used in the recursion, a flow chart explaining the recursion, research and describe what a recursive algorithm is with references as well as a description of Newton’s Method.