forked from fricas/fricas
-
Notifications
You must be signed in to change notification settings - Fork 0
/
paramete.spad
186 lines (162 loc) · 7.01 KB
/
paramete.spad
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
)abbrev domain PARPCURV ParametricPlaneCurve
++ Author: Clifton J. Williamson
++ Date Created: 24 May 1990
++ Basic Operations: curve, coordinate
++ Related Constructors:
++ Also See:
++ AMS Classifications:
++ Keywords: parametric curve, graphics
++ References:
++ Description: ParametricPlaneCurve is used for plotting parametric plane
++ curves in the affine plane.
ParametricPlaneCurve(ComponentFunction) : Exports == Implementation where
ComponentFunction : Type
NNI ==> NonNegativeInteger
Exports ==> with
curve : (ComponentFunction, ComponentFunction) -> %
++ curve(c1, c2) creates a plane curve from 2 component functions \spad{c1}
++ and \spad{c2}.
coordinate : (%, NNI) -> ComponentFunction
++ coordinate(c, i) returns a coordinate function for c using 1-based
++ indexing according to i. This indicates what the function for the
++ coordinate component i of the plane curve is.
Implementation ==> add
Rep := Record(xCoord : ComponentFunction, yCoord : ComponentFunction)
curve(x, y) == [x, y]
coordinate(c, n) ==
n = 1 => c.xCoord
n = 2 => c.yCoord
error "coordinate: index out of bounds"
)abbrev package PARPC2 ParametricPlaneCurveFunctions2
++ Description:
++ This package \undocumented
ParametricPlaneCurveFunctions2(CF1 : Type, CF2 : Type) : with
map : (CF1 -> CF2, ParametricPlaneCurve(CF1)) -> ParametricPlaneCurve(CF2)
++ map(f, x) \undocumented
== add
map(f, c) == curve(f coordinate(c, 1), f coordinate(c, 2))
)abbrev domain PARCCURV ParametricComplexCurve
++ Author: W. Hebisch
++ Description: ParametricComplexCurve is used for drawing complex
++ curves on the plane. Its main effect is on function selection,
++ namely introducing \spad{complex_curve} in the middle
++ disambiguates between expression defining real function
++ (default) and expression defining complex function.
ParametricComplexCurve(VT) : Exports == Implementation where
VT : Type
Exports ==> with
complex_curve : VT -> %
get_value : % -> VT
Implementation ==> add
complex_curve(x : VT) : % == x pretend %
get_value(x : %) : VT == x pretend VT
)abbrev domain PARSCURV ParametricSpaceCurve
++ Author: Clifton J. Williamson
++ Date Created: 24 May 1990
++ Basic Operations: curve, coordinate
++ Related Constructors:
++ Also See:
++ AMS Classifications:
++ Keywords: parametric curve, graphics
++ References:
++ Description: ParametricSpaceCurve is used for plotting parametric space
++ curves in affine 3-space.
ParametricSpaceCurve(ComponentFunction) : Exports == Implementation where
ComponentFunction : Type
NNI ==> NonNegativeInteger
Exports ==> with
curve : (ComponentFunction, ComponentFunction, ComponentFunction) -> %
++ curve(c1, c2, c3) creates a space curve from 3 component functions
++ \spad{c1}, \spad{c2}, and \spad{c3}.
coordinate : (%, NNI) -> ComponentFunction
++ coordinate(c, i) returns a coordinate function of c using 1-based
++ indexing according to i. This indicates what the function for the
++ coordinate component, i, of the space curve is.
Implementation ==> add
Rep := Record(xCoord : ComponentFunction, _
yCoord : ComponentFunction, _
zCoord : ComponentFunction)
curve(x, y, z) == [x, y, z]
coordinate(c, n) ==
n = 1 => c.xCoord
n = 2 => c.yCoord
n = 3 => c.zCoord
error "coordinate: index out of bounds"
)abbrev package PARSC2 ParametricSpaceCurveFunctions2
++ Description:
++ This package \undocumented
ParametricSpaceCurveFunctions2(CF1 : Type, CF2 : Type) : with
map : (CF1 -> CF2, ParametricSpaceCurve(CF1)) -> ParametricSpaceCurve(CF2)
++ map(f, x) \undocumented
== add
map(f, c) == curve(f coordinate(c, 1), f coordinate(c, 2), f coordinate(c, 3))
)abbrev domain PARSURF ParametricSurface
++ Author: Clifton J. Williamson
++ Date Created: 24 May 1990
++ Basic Operations: surface, coordinate
++ Related Constructors:
++ Also See:
++ AMS Classifications:
++ Keywords: parametric surface, graphics
++ References:
++ Description: ParametricSurface is used for plotting parametric surfaces in
++ affine 3-space.
ParametricSurface(ComponentFunction) : Exports == Implementation where
ComponentFunction : Type
NNI ==> NonNegativeInteger
Exports ==> with
surface : (ComponentFunction, ComponentFunction, ComponentFunction) -> %
++ surface(c1, c2, c3) creates a surface from 3 parametric component
++ functions \spad{c1}, \spad{c2}, and \spad{c3}.
coordinate : (%, NNI) -> ComponentFunction
++ coordinate(s, i) returns a coordinate function of s using 1-based
++ indexing according to i. This indicates what the function for the
++ coordinate component, i, of the surface is.
Implementation ==> add
Rep := Record(xCoord : ComponentFunction, _
yCoord : ComponentFunction, _
zCoord : ComponentFunction)
surface(x, y, z) == [x, y, z]
coordinate(c, n) ==
n = 1 => c.xCoord
n = 2 => c.yCoord
n = 3 => c.zCoord
error "coordinate: index out of bounds"
)abbrev package PARSU2 ParametricSurfaceFunctions2
++ Description:
++ This package \undocumented
ParametricSurfaceFunctions2(CF1 : Type, CF2 : Type) : with
map : (CF1 -> CF2, ParametricSurface(CF1)) -> ParametricSurface(CF2)
++ map(f, x) \undocumented
== add
map(f, c) == surface(f coordinate(c, 1), f coordinate(c, 2), f coordinate(c, 3))
--Copyright (c) 1991-2002, The Numerical ALgorithms Group Ltd.
--All rights reserved.
--
--Redistribution and use in source and binary forms, with or without
--modification, are permitted provided that the following conditions are
--met:
--
-- - Redistributions of source code must retain the above copyright
-- notice, this list of conditions and the following disclaimer.
--
-- - Redistributions in binary form must reproduce the above copyright
-- notice, this list of conditions and the following disclaimer in
-- the documentation and/or other materials provided with the
-- distribution.
--
-- - Neither the name of The Numerical ALgorithms Group Ltd. nor the
-- names of its contributors may be used to endorse or promote products
-- derived from this software without specific prior written permission.
--
--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
--IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
--TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
--PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER
--OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
--EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
--PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
--PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
--LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
--NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
--SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.