|
|
|
last edited 12 years ago by test1 |
| 1 2 3 4 5 6 7 | ||
|
Editor: Bill Page
Time: 2009/06/20 20:37:50 GMT-7 |
||
| Note: sqrt | ||
changed: -ComplexManifold(R:Join(Field,RadicalCategory,OrderedSet)): Join(RadicalCategory,DirectProductCategory(2,R)) with ComplexManifold(R:Join(Field,RadicalCategory,TranscendentalFunctionCategory)): Join(RadicalCategory,DirectProductCategory(2,R)) with added: norm: % -> R arg: % -> R added: -- represent as conjugate pair added: -- just swap changed: - - -- sqrt(abs real x)+sqrt(abs imag x) - -- sign(real x)*sqrt(abs real x)-sign(imag x)*sqrt(abs imag x) - sqrt(x:%):% == per directProduct vector [ _ - (if real(x)>=0 then sqrt real(x) else sqrt(-real(x))) + _ - (if imag(x)<=0 then sqrt(-imag(x)) else sqrt imag(x)), _ - (if real(x)>=0 then sqrt real(x) else -sqrt(-real(x))) + _ - (if imag(x)<=0 then sqrt(-imag(x)) else -sqrt imag(x)) ] -- multiplication is interesting (x:% * y:%):% == per directProduct vector [ _ real(x)*rep(y).1 + imag(x)*rep(y).2, _ real(x)*rep(y).2 - imag(x)*rep(y).1] norm(x:%):R == retract(x*conj(x)) arg(x:%):R == (2::R)*atan(imag(x)/(norm(x)+real(x))) sqrt(x:%):% == per( sqrt(sqrt(norm(x)))*directProduct(vector [cos(pi()*arg(x)) + sin(pi()*arg(x)), cos(pi()*arg(x)) - sin(pi()*arg(x))] ) ) -- [sqrt(abs real x)+sqrt(abs imag x). -- sign(real x)*sqrt(abs real x)-sign(imag x)*sqrt(abs imag x)] -- too complicated? --sqrt(x:%):% == per directProduct vector [ _ -- (if real(x)>=0 then sqrt real(x) else sqrt(-real(x))) + _ -- (if imag(x)<=0 then sqrt(-imag(x)) else sqrt imag(x)), _ -- (if real(x)>=0 then sqrt real(x) else -sqrt(-real(x))) + _ -- (if imag(x)<=0 then sqrt(-imag(x)) else -sqrt imag(x)) ] coerce(x:%):OutputForm == complex(real x,imag x)$Complex(R)::OutputForm added: norm a norm b ab:=a*b real ab imag ab added: real I norm I added: norm c1 s3:=sqrt(c1) real s3 imag s3
)abbrev domain CM ComplexManifold
ComplexManifold(R:Join(Field,RadicalCategory,TranscendentalFunctionCategory)): Join(RadicalCategory,DirectProductCategory(2,R)) with
elt:(%,"pos") -> R
elt:(%,"neg") -> R
imaginary: () -> %
real: % -> R
imag: % -> R
conj: % -> %
norm: % -> R
arg: % -> R
== DirectProduct(2,R) add
-- represent as conjugate pair
Rep == DirectProduct(2,R)
elt(x,"pos") == rep(x).1
elt(x,"neg") == rep(x).2
imaginary():% == per directProduct vector [1,-1]
real(x:%):R == (rep(x).1 + rep(x).2)/(2::R)
imag(x:%):R == (rep(x).1 - rep(x).2)/(2::R)
-- just swap
conj(x:%):% == per directProduct vector [rep(x).2,rep(x).1]
-- multiplication is interesting
(x:% * y:%):% == per directProduct vector [ _
real(x)*rep(y).1 + imag(x)*rep(y).2, _
real(x)*rep(y).2 - imag(x)*rep(y).1]
norm(x:%):R == retract(x*conj(x))
arg(x:%):R == (2::R)*atan(imag(x)/(norm(x)+real(x)))
sqrt(x:%):% == per( sqrt(sqrt(norm(x)))*directProduct(vector [cos(pi()*arg(x)) + sin(pi()*arg(x)), cos(pi()*arg(x)) - sin(pi()*arg(x))] ) )
-- [sqrt(abs real x)+sqrt(abs imag x).
-- sign(real x)*sqrt(abs real x)-sign(imag x)*sqrt(abs imag x)]
-- too complicated?
--sqrt(x:%):% == per directProduct vector [ _
-- (if real(x)>=0 then sqrt real(x) else sqrt(-real(x))) + _
-- (if imag(x)<=0 then sqrt(-imag(x)) else sqrt imag(x)), _
-- (if real(x)>=0 then sqrt real(x) else -sqrt(-real(x))) + _
-- (if imag(x)<=0 then sqrt(-imag(x)) else -sqrt imag(x)) ]
coerce(x:%):OutputForm == complex(real x,imag x)$Complex(R)::OutputForm
Compiling OpenAxiom source code from file
/var/zope2/var/LatexWiki/7433806807856594830-25px001.spad using
Spad compiler.
CM abbreviates domain ComplexManifold
------------------------------------------------------------------------
initializing NRLIB CM for ComplexManifold
compiling into NRLIB CM
Adding Integer modemaps
Adding NonNegativeInteger modemaps
Adding PositiveInteger modemaps
Adding $ modemaps
Adding R modemaps
Adding R modemaps
Adding R modemaps
Adding Integer modemaps
Adding NonNegativeInteger modemaps
Adding PositiveInteger modemaps
Adding Rep modemaps
compiling exported elt : (%,pos) -> R
Adding DirectProduct(2,R) modemaps
Time: 0.12 SEC.
compiling exported elt : (%,neg) -> R
Adding DirectProduct(2,R) modemaps
Time: 0.01 SEC.
compiling exported imaginary : () -> %
Adding DirectProduct(2,R) modemaps
Adding Vector R modemaps
Adding List R modemaps
Time: 0.05 SEC.
compiling exported real : % -> R
Adding DirectProduct(2,R) modemaps
Time: 0 SEC.
compiling exported imag : % -> R
Adding DirectProduct(2,R) modemaps
Time: 0.01 SEC.
compiling exported conj : % -> %
Adding DirectProduct(2,R) modemaps
Adding Vector R modemaps
Adding List R modemaps
Time: 0.02 SEC.
compiling exported * : (%,%) -> %
Adding DirectProduct(2,R) modemaps
Adding Vector R modemaps
Adding List R modemaps
Time: 0.06 SEC.
compiling exported norm : % -> R
Time: 0 SEC.
compiling exported arg : % -> R
Time: 0 SEC.
compiling exported sqrt : % -> %
Adding DirectProduct(2,R) modemaps
Adding Vector R modemaps
Adding List R modemaps
Time: 0.02 SEC.
Adding OutputForm modemaps
compiling exported coerce : % -> OutputForm
Adding Complex R modemaps
Time: 0.05 SEC.
Adding R modemaps
augmenting R: DifferentialRing
Adding R modemaps
augmenting R: Evalable R
Adding R modemaps
augmenting R: LinearlyExplicitRingOver Integer
Adding R modemaps
augmenting R: PartialDifferentialRing Symbol
Adding R modemaps
augmenting R: RetractableTo Fraction Integer
Adding R modemaps
augmenting R: RetractableTo Integer
Adding R modemaps
augmenting R: DifferentialRing
Adding R modemaps
augmenting R: DifferentialRing
Adding R modemaps
augmenting R: RetractableTo Integer
Adding R modemaps
augmenting R: OrderedAbelianMonoidSup
augmenting $: shallowlyMutable
Adding R modemaps
augmenting R: Finite
Adding R modemaps
augmenting R: OrderedAbelianMonoidSup
Adding R modemaps
augmenting R: OrderedRing
Predicate:
(|has| $ (ATTRIBUTE |finiteAggregate|)) replaced by:
T Predicate:
(|has| $ (ATTRIBUTE |shallowlyMutable|)) replaced by:
NIL Predicate:
(|has| $ (ATTRIBUTE |finiteAggregate|)) replaced by:
T (time taken in buildFunctor: 75)
Time: 0.87 SEC.
Cumulative Statistics for Constructor ComplexManifold
Time: 1.21 seconds
--------------non extending category----------------------
ComplexManifold #1 of category Join(RadicalCategory,
DirectProductCategory(2,#1)) with
?.pos : (%,pos) -> #1
?.neg : (%,neg) -> #1
imaginary : () -> %
real : % -> #1
imag : % -> #1
conj : % -> %
norm : % -> #1
arg : % -> #1
has no DirectProductCategory(NIL,#1)
finalizing NRLIB CM
Processing ComplexManifold for Browser database:
--->-->ComplexManifold((elt (R % pos))): Not documented!!!!
--->-->ComplexManifold((elt (R % neg))): Not documented!!!!
--->-->ComplexManifold((imaginary (%))): Not documented!!!!
--->-->ComplexManifold((real (R %))): Not documented!!!!
--->-->ComplexManifold((imag (R %))): Not documented!!!!
--->-->ComplexManifold((conj (% %))): Not documented!!!!
--->-->ComplexManifold((norm (R %))): Not documented!!!!
--->-->ComplexManifold((arg (R %))): Not documented!!!!
--->-->ComplexManifold(constructor): Not documented!!!!
--->-->ComplexManifold: Missing Description
------------------------------------------------------------------------
ComplexManifold is now explicitly exposed in frame initial
ComplexManifold will be automatically loaded when needed from
/var/zope2/var/LatexWiki/CM.NRLIB/code.oa:CM(EXPR INT) := 3
| (1) |
b:CM(EXPR INT) := -5
| (2) |
real(a)
| (3) |
norm a
| (4) |
norm b
| (5) |
ab:=a*b
| (6) |
real ab
| (7) |
imag ab
| (8) |
s1:=sqrt(a)
| (9) |
real s1
| (10) |
imag s1
| (11) |
s2:=sqrt(b)
| (12) |
real s2
| (13) |
imag s2
| (14) |
I:CM(EXPR INT) := imaginary()
| (15) |
real I
| (16) |
norm I
| (17) |
imag I
| (18) |
imag conj I
| (19) |
c1:=conj(a+b*I)
| (20) |
real c1
| (21) |
imag c1
| (22) |
norm c1
| (23) |
s3:=sqrt(c1)
| (24) |
real s3
| (25) |
imag s3
| (26) |