File: cf.dem

package info (click to toggle)
maxima-sage 5.42.2-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 147,292 kB
  • sloc: lisp: 382,572; fortran: 14,666; perl: 14,365; tcl: 11,123; sh: 4,487; makefile: 2,517; ansic: 444; xml: 23; awk: 17; sed: 17
file content (33 lines) | stat: -rw-r--r-- 752 bytes parent folder | download | duplicates (9)
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
/* ===================================================================== */
/* file: cf.dem    */
/* 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  ====================== */