login  home  contents  what's new  discussion  bug reports     help  links  subscribe  changes  refresh  edit

Edit detail for SandBoxComplexManifold revision 3 of 7

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

fricas
(1) -> <spad>
fricas
)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</spad>
fricas
Compiling FriCAS source code from file 
      /var/lib/zope2.10/instance/axiom-wiki/var/LatexWiki/7433806807856594830-25px001.spad
      using system compiler.
   CM abbreviates domain ComplexManifold 
------------------------------------------------------------------------
   initializing NRLIB CM for ComplexManifold 
   compiling into NRLIB CM 
****** Domain: R already in scope
****** Domain: R already in scope
************* USER ERROR **********
available signatures for Rep: 
    NONE
NEED Rep: () -> ?
****** comp fails at level 1 with expression: ******
((DEF (|Rep|) (NIL) (|DirectProduct| 2 R)))
****** level 1  ******
x:= (DEF (Rep) (NIL) (DirectProduct 2 R))
m:= $EmptyMode
f:=
((((* #) (+ #) (|1| #) (< #) ...)))
>> Apparent user error: unspecified error

fricas
a:CM(EXPR INT) := 3
ComplexManifold is an unknown constructor and so is unavailable. Did you mean to use -> but type something different instead?