Contact
CoCalc Logo Icon
StoreFeaturesDocsShareSupport News AboutSign UpSign In
| Download
Views: 168

###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.

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 correct a bug in the FriCAS/Axiom interface

There is a problem in the current implementation in Sage 6.6 that results in chopping the first character of each line of output. See this patch on github.
from fricas import fricas

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 def fricas_md(s): import re t = fricas.eval(s) 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(r'\\tag{\1}',t) t=re.compile(r'\\leqno\((.*)\)\n').sub(r'',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.

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

Type: Void

imag(z)==(z-conjugate(z))/2/sqrt(-1)

Type: Void

imag(sqrt(-1))

Compiling function imag with type AlgebraicNumber -> Expression(Integer)

11

Type: Expression(Integer)

setSimplifyDenomsFlag(true)
falsefalse

Type: Boolean

Abs(x)==sqrt(x*conjugate(x))

Type: Void

testr:Expression Integer := x^2+sqrt(-1)*y^3
y3 1+x2{{{y} ^{3}} \ {\sqrt {-1}}}+{{x} ^{2}}

Type: Expression(Integer)

testc:=eval(testr,[x=real(z),y=imag(z)])

Compiling function real with type Variable(z) -> Polynomial(Fraction(Integer)) Compiling function imag with type Variable(z) -> Polynomial(AlgebraicNumber)

z3+(3 z+2) z2+(3 z2+4 z) zz3+2 z28{{{{\overline z}} ^{3}}+{{\left( -{3 \ z}+2 \right)} \ {{{\overline z}} ^{2}}}+{{\left( {3 \ {{z} ^{2}}}+{4 \ z} \right)} \ {\overline z}} -{{z} ^{3}}+{2 \ {{z} ^{2}}}} \over 8

Type: Expression(Integer)

test(differentiate(testc,z)=1/2*z+1/2*conjugate(z)-3/8*(z-conjugate(z))^2)
truetrue

Type: Boolean

test(differentiate(testc,conjugate z)=1/2*z+1/2*conjugate(z)+3/8*(z-conjugate(z))^2)
truetrue

Type: Boolean

testc:=2*log(sqrt(z*conjugate(z)))
2 log(z z)2 \ {\log \left( {{\sqrt {{z \ {\overline z}}}}} \right)}

Type: Expression(Integer)

differentiate(testc,z)
1z1 \over z

Type: Expression(Integer)

differentiate(testc,conjugate z)
1z1 \over {\overline z}

Type: Expression(Integer)

differentiate(Abs x,x)

Compiling function Abs with type Variable(x) -> Expression(Integer)

x x2 x{\sqrt {{x \ {\overline x}}}} \over {2 \ x}

Type: Expression(Integer)

WIRTINGER DERIVATIVES, BELTRAMI EQUATION & ELLIPSE FIELDS

by Thomas Schramm

Abstract

This worksheet contains a set of routines to transform complex expressions depending on two real variables e.g. x,y into equivalent expressions containing the complex variable e.g. z and conjugate(z) , respectively. This representation is used to invoke Wirtinger derivatives which are used to describe complex expressions locally. A visualisation of this local behaviour is given by the ellipse fields of the mappings defined by the Beltrami equation

jacob(expr,z)==Abs(differentiate(expr,z))^2-Abs(differentiate(expr,conjugate z))^2

Type: Void

μ(expr,z)==differentiate(expr,conjugate z)/differentiate(expr,z)

Type: Void

axialratio(expr,z)==(1-Abs(μ(expr,z)))/(1+Abs(μ(expr,z)))

Type: Void

--mu(expr,z)==differentiate(expr, conjugate z)/differentiate(expr,z)
--axialratio(expr,z)==(1-Abs(mu(expr,z)))/(1+Abs(mu(expr,z)))
direction(expr,z)==argument(μ(expr,z))/2-%pi/2

Type: Void

w(z)==z-1/conjugate(z)

Type: Void

J:=jacob(w(z),z)

Compiling function w with type Variable(z) -> Fraction(Polynomial(Integer)) Compiling function Abs with type Fraction(Polynomial(Integer)) -> Expression(Integer) Compiling function jacob with type (Fraction(Polynomial(Integer)), Variable(z)) -> Expression(Integer)

z2 z21z2 z2{{{{z} ^{2}} \ {{{\overline z}} ^{2}}} -1} \over {{{z} ^{2}} \ {{{\overline z}} ^{2}}}

Type: Expression(Integer)

m:=μ(w(z),z)

Compiling function μ with type (Fraction(Polynomial(Integer)), Variable(z)) -> Fraction(Polynomial(Integer))

1z21 \over {{{\overline z}} ^{2}}

Type: Fraction(Polynomial(Integer))

differentiate(conjugate(z)::Expression(Integer),conjugate z)
11

Type: Expression(Integer)