File: cf.dem

package info (click to toggle)
maxima 5.21.1-2squeeze
  • links: PTS
  • area: main
  • in suites: squeeze
  • size: 94,928 kB
  • ctags: 43,849
  • sloc: lisp: 298,974; fortran: 14,666; perl: 14,325; tcl: 10,494; sh: 4,052; makefile: 2,975; ansic: 471; awk: 24; sed: 7
file content (35 lines) | stat: -rw-r--r-- 843 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/* ===================================================================== */
/* file: cf.dem    */
/* the line cf(frac1+frac2) loops !!!!  */
/* the 2 last lines gives erroneous results  */
/* CONTINUED FRACTIONS. THIS IS GOOD STUFF. */

frac1:cf([1,2,3,4]);
frac2:cf([2,3,4,5]);
cfdisrep(frac1);
cf(frac1+frac2);
cfdisrep(%);


cf(467288576/469097433);
cfdisrep(%);
ratsimp(%);


/* cf can make the continued fraction expansion of sqrt(n) to
   cflength terms. */

block([cflength:4],cfdisrep(cf(sqrt(3))));
ratsimp(%);
%^2-3;

ratsqrt(n,cflength):=ratsimp(cfdisrep(cf(sqrt(n))))$

ratsqrt(1776,25);
%^2-1776;

/* With the primitives of SQRT and rational operations 
   continued fraction expansions of many trancendental expressions
   may be made in the classical way. */

/* ======================== END ==== END  ====================== */