| |||||||||||||||||
![]() |
![]() |
![]() |
|||||||||||||||
|
Continued Fraction using Mathematica Mathematica has three useful functions related to Continued fraction FromContinuedFraction[ list ] ContinuedFraction[ x , n ] Rationalize[ x ]
FromContinuedFraction[ list ] will produce the convergence of the continued fraction
Example: Compute continued fraction In: FromContinuedFraction[{2, 3, 1, 2, 3, 1}] Out:
Example: to compute the convergence of In: FromContinuedFraction[{1, {1, 2}}] Out :
Mathematica function ContinuedFraction[ x , n ] will return the list of continued fraction up to n terms. This is exactly inverse procedure of FromContinuedFraction[ list ]
Example: In: Out: {1,{1,2}}
Example: In: Out: {2, 3, 1, 2, 4}
Rationalize[ x, accuracy ] will return rational approximation or decimal to fraction converter
Example: In: Rationalize[Pi, 0.01] Out: 22/7
Example: In: Rationalize[Pi, 0.0001] Out: 333/106
Example: In: Rationalize[2.14567, 0.01] Out: 15/7 Preferable reference for this tutorial is Teknomo, Kardi. Continued Fraction. http://people.revoledu.com/kardi/tutorial/ContinuedFraction/index.html
|
|||||||||||||||
|
||||||||||||||||
© 2006 Kardi Teknomo. All Rights Reserved. Designed by CNV Media |
||||||||||||||||