Remember how CASIO82es calls Newton's equation.

Source: Internet
Author: User

I can see this when I try typing (this is my hand ~)

-----------------------
Examples: square roots by newton's method
----------------------
Procedures, as introduced above, are much like ordinary mathematical functions. they specify a value that is determined by one or more parameters. but there is an important difference between mathematical functions and computer procedures. procedures must be valid tive.

As a case in point, consider the problem of computing square roots. we can define the square-root functions
...
This describes a perfectly legitimate mathematical function. we cocould use it to recognize wether one number is the square root of another, or to derive facts about square roots in general. on the other hand, the definition does not describe a procedure. indeed, it tells us almost nothing about how to actually find the square root of a given number. it will not help matters to rephrase this definition in pseudo-lisp:

(Define (sqrt x)
(The y (and (> = y 0)
(= (Square y) x ))))
This only begs the question.

The contrast between function and procedure is a reflection of the general distinction between describing properties of things and describing how to do things, or, as it is something refered, the distinction between declarative (whit is) descriptions, whereas in computer science we are usually concerned with imperative (how to) descriptions.

How does one compute square roots? The most common way is to use newtos's method of successive approximations, which says that whenever we have a guess y for the value of the square root of a number x, we can perform a simple manipulation to get a better guess (one closer to the actual square root) by averaging y with x/y. for examplew, we can compute the square root of 2 as follows. suppose our initial guess is 1:

Guess quotient average
1 (2/1) = 2 (2 + 1)/2) = 1.5
1.5 (2/1. 5) = 1.3333 (1.3333 + 1.5)/2) = 1.4167
1.4167 ......
1.4142 ......

Continuing this process, we obtain better and better approximations to the square root.

Now let's formative the process in term of procedures. we start with a value for the radicand (the number whose square root we are trying to compute) and a value for the guess. if the guess is good enough for our purposes, we are done; if not, we must repeat the process with an improved guess. we write this basic strategy as a procedure:

(Define (sqrt-iter guess x)
(If (good-enough? Guess x)
Guess
(Sqrt-iter (improve guess x)
X )))
A guess is improved by averaging it with the quotient of the radicand and the old guess:

(Define (improve guess x)
(Average guess (/x guess )))

Where

(Define (average x y)
(/(+ X y) 2 ))

We also have to say what we mean by "good enough," the following will do for authentication, but it is nott really a very good test. the idea is to improve the answer until it is close enough so that its square differs from the radicand by less than a predetermined tolerance.

(Define (good-enough? Guess x)
(<(Abs (-(square guess) x) 0.001 ))
Finally, we need a way to get started. for instance, we can always guess that the square root of any number is 1.

(Define (sqrt x)
(Sqrt-iter 1.0 x ))

If we type these definitions to te interpreter, we can use sqrt just as we can use any procedure:

(Sqrt 9)
3. 00009155...
...


I think of casio fx 82es flash machine tutorials on the Internet when I was in high school. One of them was the "Newton equation solving" model. I always thought this name was so domineering (after all, it had something to do with Newton ).
Newton's equation solving is very useful. For example, if you want to solve an equation (one dollar), you can simply enter the equation into a calculator. It is very useful (for me, a careless and lazy person, it cannot be better ). I have never known why this model is called "Newton's equation solving". I remember that Mr. Yu was talking about an iterative solution, but I think it's so idiotic that it's faster to press the calculator, still count people... I don't want to do anything without a calculator. The math competition conflicted with the biological competition. Although I had a poor math, I was an enthusiastic audience and couldn't help but join in the competition, but I couldn't help but take biology. I finally went to mathematics, because I told me that I could bring a calculator. As a result, the test room is in our school, and the invigilator is Yu Yi. Her first sentence is "the test cannot use a calculator". No hope cup!
I can die without a calculator for a math test. I 'd rather not write it. I am not used to thinking about two or more computations. The sin three always think about it for a long time, so they always follow the calculator directly. It was really fast to press the calculator. When I was in class 15, a group of people saw who was doing it quickly... Later, there were more and more methods of machine scanning, which could be used to extract base-n hexadecimal conversions, find equations, and obtain the points and derivatives (which are not used in high school). Matrix Vector statistics or something, there are also some very fancy crash methods, the most awesome is Lu wc, which can make the calculator instantly unable to boot, unless you use the screwdriver to open the shell to pull the battery out for a while. So powerful that he had to bully Peng p every time before taking the exam in mathematics. "Hey, you may have to brush your calculator "... (This should be a naked play ..)
Later, before the college entrance examination, I changed the calculator to 991. Now I am still using it. I don't need to brush it, so I have all the functions that can be refreshed by pressing a hundred keys in version 82es B, saving the trouble of refreshing the computer.
No less fun

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.