Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download

fricas-CR is an extension of FriCAS that implements the calculus of differentiable functions over an involutive algebra of symbolic expressions — principally functions of complex variables.

Views: 71

fricas-CR is an extension of FriCAS

that implements the calculus of differentiable functions over an involutive algebra of symbolic expressions -- functions of complex variables.

To run a customized version of FriCAS in a Sage worksheet

The following Sage/Python command modifies the PATH variable to include $HOME/bin. Sage looks for the fricas executable in this PATH.
os.environ['PATH'] = '%s/bin:%s'%(os.environ['HOME'],os.environ['PATH'])

To typeset the output of FriCAS

A mode in SageMathCloud is just a function that takes as input a string. For example, this function takes whatever the cells input is, executes the code in Fricas, then takes the output and displays it using Markdown:
%sage from fricas import fricas def fricas_md(s): import re t = fricas.eval(s) #print t t=re.compile(r'\r').sub('',t) # mathml overbar t=re.compile(r'&#x000AF;').sub('&#x203E;',t,count=0) # cleanup FriCAS LaTeX t=re.compile(r'\\leqno\(.*\)\n').sub('',t) t=re.compile(r'\\sb ').sub('_',t,count=0) t=re.compile(r'\\sp ').sub('^',t,count=0) # float result type to the right t=re.compile(r' *Type: (.*)\n').sub(r'<p style="text-align:right">Type: \1</p>',t,count=0) #print t md(t, hide=False)
%default_mode fricas_md
)set output mathml off )set output tex on )set output algebra off

This version of fricas-CR was compiled on

)version

Value = "FriCAS 2017-08-05 compiled at Fri Dec 22 00:46:50 UTC 2017"

In fricas-CR every symbol has a conjugate that can appear in polynomials and more general expressions.

conjugate(x)
x\overline x

Type: Symbol

conjugate conjugate(x)
xx

Type: Symbol

x+conjugate(x)
x+x{\overline x}+x

Type: Polynomial(Integer)

real(x)==(x+conjugate(x))/2

Type: Void

sin(real x)

Compiling function real with type Variable(x) -> Polynomial(Fraction(Integer))

sin(x+x2)\sin \left( {{{{\overline x}+x} \over 2}} \right)

Type: Expression(Integer)

Every symbolic operator has a conjugate but no other assumptions are made.

f:=operator 'f conjugate f conjugate f(x)
ff

Type: BasicOperator

f\overline f

Type: BasicOperator

f(x){\overline f} \left( {x} \right)

Type: Expression(Integer)

g:=operator 'g conjugate g(x)
gg

Type: BasicOperator

g(x){\overline g} \left( {x} \right)

Type: Expression(Integer)

Wirtinger chain rule

fricas-CR implements the Wirtinger derivative

differentiate(f(g x),x)
g" ",(x) f" ",(g(x))+f" ",(g(x)) g" ",(x){{{{\overline g} _{\verb#" "#} ^{,}} \left( {x} \right)} \ {\overline {{{\overline f} _{\verb#" "#} ^{,}} \left( {{g \left( {x} \right)}} \right)}}}+{{{f _{\verb#" "#} ^{,}} \left( {{g \left( {x} \right)}} \right)} \ {{g _{\verb#" "#} ^{,}} \left( {x} \right)}}

Type: Expression(Integer)

differentiate(f(g x),conjugate x)
f" ",(g(x)) g" ",(x)+f" ",(g(x)) g" ",(x){{{f _{\verb#" "#} ^{,}} \left( {{g \left( {x} \right)}} \right)} \ {\overline {{{\overline g} _{\verb#" "#} ^{,}} \left( {x} \right)}}}+{{\overline {{{\overline f} _{\verb#" "#} ^{,}} \left( {{g \left( {x} \right)}} \right)}} \ {\overline {{g _{\verb#" "#} ^{,}} \left( {x} \right)}}}

Type: Expression(Integer)

test(differentiate(f(g x),conjugate x)=conjugate differentiate(conjugate f(g x),x))
truetrue

Type: Boolean

differentiate(f conjugate x,x)
f" ",(x)\overline {{{\overline f} _{\verb#" "#} ^{,}} \left( {{\overline x}} \right)}

Type: Expression(Integer)

differentiate(f conjugate x, conjugate x)
f" ",(x){f _{\verb#" "#} ^{,}} \left( {{\overline x}} \right)

Type: Expression(Integer)

differentiate(f(x,conjugate x),x)
f,2(x,x)+f,1(x,x){\overline {{{\overline f} _{{,2}}} \left( {x, \: {\overline x}} \right)}}+{{f _{{,1}}} \left( {x, \: {\overline x}} \right)}

Type: Expression(Integer)

differentiate(f(x,conjugate x),conjugate x)
f,1(x,x)+f,2(x,x){\overline {{{\overline f} _{{,1}}} \left( {x, \: {\overline x}} \right)}}+{{f _{{,2}}} \left( {x, \: {\overline x}} \right)}

Type: Expression(Integer)

Conjugation commutes with holomorphic functions and the conjugate derivative is zero due to Cauchy-Riemann.

h:=holomorphic operator 'h conjugate h(x)
hh

Type: BasicOperator

h(x)h \left( {{\overline x}} \right)

Type: Expression(Integer)

differentiate(h(x),conjugate x)
00

Type: Expression(Integer)

Many common functions are holomorphic, e.g.

conjugate sin(x) differentiate(sin x,conjugate x)
sin(x)\sin \left( {{\overline x}} \right)

Type: Expression(Integer)

00

Type: Expression(Integer)

differentiate(sin conjugate x,x)
00

Type: Expression(Integer)

The following definition for the conjugate of   \sqrt{\ }

conjugate sqrt(x)
11x1 \over {\sqrt {{1 \over {\overline x}}}}

Type: Expression(Integer)

makes   \sqrt{\ } a holomorphic function.

differentiate(sqrt x,conjugate x)
00

Type: Expression(Integer)

conjugate(sqrt(-1))
111 \over {\sqrt {-1}}

Type: Expression(Integer)

retract %
1-{\sqrt {-1}}

Type: AlgebraicNumber

cin:=conjugate operator(operator('sin))$Expression Integer
sin\overline \sin

Type: BasicOperator

cin(x)
sin(x){\overline \sin} \left( {x} \right)

Type: Expression(Integer)

conjugate %
sin(x)\sin \left( {x} \right)

Type: Expression(Integer)

conjugate(sin(x))
sin(x)\sin \left( {{\overline x}} \right)

Type: Expression(Integer)

sin(1- %i)
sin(1i)\sin \left( {{1 -i}} \right)

Type: Expression(Complex(Integer))

conjugate %
sin(1+i)\sin \left( {{1+i}} \right)

Type: Expression(Complex(Integer))

simplify %
sin(1+i)\sin \left( {{1+i}} \right)

Type: Expression(Complex(Integer))

expand %
sin(1+i)\sin \left( {{1+i}} \right)

Type: Expression(Complex(Integer))

simplify %
sin(1+i)\sin \left( {{1+i}} \right)

Type: Expression(Complex(Integer))