Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Difference engine
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Initial values == The initial values of columns can be calculated by first manually calculating N consecutive values of the function and by [[backtracking]] (i.e. calculating the required differences). Col <math>1_0</math> gets the value of the function at the start of computation <math>f(0)</math>. Col <math>2_0</math> is the difference between <math>f(1)</math> and <math>f(0)</math>...<ref name="Thelen">{{cite web |url=http://ed-thelen.org/bab/bab-intro.html |title=Babbage Difference Engine #2 β How to Initialize the Machine β |last=Thelen |first=Ed |date=2008 }}</ref> If the function to be calculated is a [[polynomial function]], expressed as : <math> f(x) = a_n x^n + a_{n-1} x^{n-1} + \cdots + a_2 x^2 + a_1 x + a_0 \, </math> the initial values can be calculated directly from the constant coefficients ''a''<sub>0</sub>, ''a''<sub>1</sub>,''a''<sub>2</sub>, ..., ''a<sub>n</sub>'' without calculating any data points. The initial values are thus: * Col <math>1_0</math> = ''a''<sub>0</sub> * Col <math>2_0</math> = ''a''<sub>1</sub> + ''a''<sub>2</sub> + ''a''<sub>3</sub> + ''a''<sub>4</sub> + ... + ''a<sub>n</sub>'' * Col <math>3_0</math> = 2''a''<sub>2</sub> + 6''a''<sub>3</sub> + 14''a''<sub>4</sub> + 30''a''<sub>5</sub> + ... * Col <math>4_0</math> = 6''a''<sub>3</sub> + 36''a''<sub>4</sub> + 150''a''<sub>5</sub> + ... * Col <math>5_0</math> = 24''a''<sub>4</sub> + 240''a''<sub>5</sub> + ... * Col <math>6_0</math> = 120''a''<sub>5</sub> + ... * <math>...</math> === Use of derivatives === Many commonly used functions are [[analytic function]]s, which can be expressed as [[power series]], for example as a [[Taylor series]]. The initial values can be calculated to any degree of accuracy; if done correctly the engine will give exact results for first N steps. After that, the engine will only give an [[approximation]] of the function. The Taylor series expresses the function as a sum obtained from its [[derivative]]s at one point. For many functions the higher derivatives are trivial to obtain; for instance, the [[sine]] function at 0 has values of 0 or <math>\pm1</math> for all derivatives. Setting 0 as the start of computation we get the simplified [[Maclaurin series]] :<math> \sum_{n=0}^{\infin} \frac{f^{(n)}(0)}{n!}\ x^{n} </math> The same method of calculating the initial values from the coefficients can be used as for polynomial functions. The polynomial constant coefficients will now have the value :<math> a_n \equiv \frac{f^{(n)}(0)}{n!} </math> === Curve fitting === The problem with the methods described above is that errors will accumulate and the series will tend to diverge from the true function. A solution which guarantees a constant maximum error is to use [[curve fitting]]. A minimum of ''N'' values are calculated evenly spaced along the range of the desired calculations. Using a curve fitting technique like [[Gaussian reduction]] an ''N''β1th degree [[polynomial interpolation]] of the function is found.<ref name="Thelen" /> With the optimized polynomial, the initial values can be calculated as above.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)