aboutsummaryrefslogtreecommitdiff
path: root/src/input/vectors.input.pamphlet
blob: fc6acef8a473491239e95fc43c5a4449e2364ffa (plain)
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
\documentclass{article}
\usepackage{axiom}
\begin{document}
\title{\$SPAD/src/input vectors.input}
\author{The Axiom Team}
\maketitle
\begin{abstract}
\end{abstract}
\eject
\tableofcontents
\eject
\section{License}
<<license>>=
--Copyright The Numerical Algorithms Group Limited 1991.
@
<<*>>=
<<license>>

)r arrows
clipValue :SF :=  6
clipFun(x) == min(max(x,-clipValue),clipValue)
realSteps :INT := 25
imagSteps :INT := 25
C := Complex SF
S := Segment SF
drawComplexVectorField :(C -> C, S, S) -> VIEW3D
drawComplexVectorField(f,realRange,imagRange) ==
  delReal := (hi realRange - lo realRange)/realSteps
  delImag := (hi imagRange - lo imagRange)/imagSteps
  sp := create3Space()$ThreeSpace SF
  real := lo realRange
  for i in 1..realSteps + 1 repeat
    imag := lo imagRange
    for j in 1..imagSteps + 1 repeat
       z := f complex(real, imag)
       arg := argument z
       len := clipFun sqrt norm z
       p1 := point[real, imag, 0.0@SF, arg]
       scaleLen := delReal * len
       p2 := point[p1.1 + scaleLen * cos(arg),
                   p1.2 + scaleLen * sin(arg), 0.0@SF, arg]
       arrow := makeArrow(p1, p2)
       for a in arrow repeat curve(sp, a)
       imag := imag + delImag
    real := real + delReal
  makeViewport3D(sp, "Complex Vector Field")$VIEW3D

drawComplex :(C->C, S, S) -> VIEW3D
drawComplex(f, realRange, imagRange) ==
  deltaReal :SF := (hi realRange - lo realRange)/realSteps
  deltaImag :SF := (hi imagRange - lo imagRange)/imagSteps
  llp:List List Point SF := []
  real :SF := lo realRange
  for i in 1..realSteps + 1 repeat
    imag :SF := lo imagRange
    lp := []$(List Point SF)
    for j in 1..imagSteps + 1 repeat
      z :COMPLEX SF := f(complex(real, imag))
      pt :Point SF := point[real, imag, clipFun sqrt norm z, argument z]
      lp := cons(pt, lp)
      imag := imag + deltaImag
    real := real + deltaReal
    llp := cons(reverse! lp, llp)
  llp := reverse! llp
  makeViewport3D(mesh(llp), "Complex Function")$VIEW3D
@
\eject
\begin{thebibliography}{99}
\bibitem{1} nothing
\end{thebibliography}
\end{document}