~ubuntu-branches/ubuntu/karmic/maxima/karmic

« back to all changes in this revision

Viewing changes to share/contrib/fresnel/fresnelCStaylor.mac

  • Committer: Bazaar Package Importer
  • Author(s): Christophe Sauthier
  • Date: 2009-07-13 15:38:41 UTC
  • mfrom: (3.1.3 squeeze)
  • Revision ID: james.westby@ubuntu.com-20090713153841-gtux06oun30kuuo7
Tags: 5.17.1-1ubuntu1
* Merge from debian unstable, remaining changes (LP: #296643, LP: #242243):
   - debian/maxima-doc.doc-base.{tips, plotting}:
    + Use .shtml instead of .html to fix lintian errors.
   - debian/maxima-emacs.emacsen-install:
    + Install symlinks for source files rather than copying them.  This
      makes find-function work.
    + Install symlink for *.lisp so that we don't need to add
      /usr/share/emacs/site-lisp/maxima to load-path.
  - debian/maxima-emacs.emacsen-startup:
    + Remove use of /usr/share/emacs/site-lisp/maxima, since this
      causes load-path shadows and is not needed anymore.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
fresnelC(z):=block([nn,BFLOAT_PRECISION,term,az:dfloat(abs(z)),
 
2
   BL:ceiling(abs(log10(DFLOAT_PRECISION))),FLOAT2BF:true],
 
3
   BFLOAT_PRECISION:BL,
 
4
   for n:0 step 1 do (
 
5
      term:dfloat(((%pi/2)^(2*n)/(((2*n)!)*(4*n+1)))*(az^(4*n+1))),
 
6
      lterm:ceiling(log10(term)),
 
7
      if (lterm+BL) > BFLOAT_PRECISION then BFLOAT_PRECISION:lterm+BL,
 
8
      if term < DFLOAT_EPSILON then (nn:n,return(nn))
 
9
   ),
 
10
   BFLOAT_PRECISION:BFLOAT_PRECISION+2,
 
11
   z:bfloat(z),
 
12
   sum(bfloat((-1)^n*((%pi/2)^(2*n)/(((2*n)!)*(4*n+1)))*(z^(4*n+1))),n,0,nn)
 
13
)$
 
14
fresnelS(z):=block([nn,BFLOAT_PRECISION,term,az:dfloat(abs(z)),
 
15
   BL:ceiling(abs(log10(DFLOAT_PRECISION))),FLOAT2BF:true],
 
16
   BFLOAT_PRECISION:BL,
 
17
   for n:0 step 1 do (
 
18
      term:dfloat(((%pi/2)^(2*n+1)/(((2*n+1)!)*(4*n+3)))*(az^(4*n+3))),
 
19
      lterm:ceiling(log10(term)),
 
20
      if (lterm+BL) > BFLOAT_PRECISION then BFLOAT_PRECISION:lterm+BL,
 
21
      if term < DFLOAT_EPSILON then (nn:n,return(nn))
 
22
   ),
 
23
   BFLOAT_PRECISION:BFLOAT_PRECISION+2,
 
24
   z:bfloat(z),
 
25
   sum(bfloat((-1)^n*((%pi/2)^(2*n+1)/(((2*n+1)!)*(4*n+3)))*(z^(4*n+3))),n,0,nn)
 
26
)$