MATH76108/24/2018

Lab01: An introduction to SciComp@UNC environment

1TeXmacs

TeXmacs is an editor especially well suited for scientific work:

2Embedded sessions

The public-domain Linux environment encourages compatibility among conforming applications, such that they can work together to solve complex tasks. This approach is in marked contrast to closed-form commercial operating systems (Windows, macOS) and applications. Even commercial programs (e.g., Mathematica) that conform to standard Linux practices can work in concert with other applications.

Within SciComp@UNC, TeXmacs has been configured to embed sessions of other applications:

Asymptote

A general purpose vector graphics language

Asymptote]

size(5cm);

for (int n = 3; n <= 7; ++n) {

draw(shift(2.2*n, 0) *

polygon(n));}

Asymptote]

Figure 1. Figure generated using folded Asymptote code

Eukleides

An environment for generation of geometrical figures

Eukleides]

box -1, -1, 7, 3

A B C isosceles

H = projection(C, line(A, B))

draw

(A.B.C)

C.H dashed

H

end

label

A 180:

B 0:

C 90:

B, H, C right

B, A, C double

C, B, A double

A.H

B.H

A.C double

C.B double

end

Eukleides]

Gnuplot
Gnuplot is graphics application

GNUplot]

plot sin(cos(x))+cos(sin(x))

GNUplot]

Lisp

;; Loading file /opt/TeXmacs/plugins/lisp/clisp/clisp-init.lisp … ;; Loading file lisp/tmlib.lisp … ;; Loaded file lisp/tmlib.lisp

;; Loaded file /opt/TeXmacs/plugins/lisp/clisp/clisp-init.lisp

CLisp>

(car '(a b c))

A

CLisp>

(cdr '(a b c))

(B C)

CLisp>

Mathematica

Mathematica

In[1]:=

N[Pi,1000]

3.141592653589793238462643383279502884197169399375105820974944592307816406286208998628034825342117067982148086513282306647093844609550582231725359408128481117450284102701938521105559644622948954930381964428810975665933446128475648233786783165271201909145648566923460348610454326648213393607260249141273724587006606315588174881520920962829254091715364367892590360011330530548820466521384146951941511609433057270365759591953092186117381932611793105118548074462379962749567351885752724891227938183011949129833673362440656643086021394946395224737190702179860943702770539217176293176752384674818467669405132000568127145263560827785771342757789609173637178721468440901224953430146549585371050792279689258923542019956112129021960864034418159813629774771309960518707211349999998372978049951059731732816096318595024459455346908302642522308253344685035261931188171010003137838752886587533208381420617177669147303598253490428755468731159562863882353787593751957781857780532171226806613001927876611195909216420199

In[2]:=

100!

93326215443944152681699238856266700490715968264381621468592963895217599993229915608941463976156518286253697920827223758251185210916864000000000000000000000000

In[4]:=

D[Sin[Cos[x]]+Cos[Sin[x]],{x,10}]

945sin5(x)sin(sin(x))-2205sin3(x)sin(sin(x))+sin(x)sin(sin(x))-945cos(cos(x))cos5(x)+2205cos(cos(x))cos3(x)-cos(cos(x))cos(x)+cos10(x)(-cos(sin(x)))-120cos8(x)cos(sin(x))+45sin(x)sin(sin(x))cos8(x)+630sin2(x)cos6(x)cos(sin(x))-2352cos6(x)cos(sin(x))+2730sin(x)sin(sin(x))cos6(x)-3150sin3(x)sin(sin(x))cos4(x)+15750sin2(x)cos4(x)cos(sin(x))-4725sin2(x)cos4(x)sin(cos(x))-5440cos4(x)cos(sin(x))-3150cos4(x)sin(cos(x))+19530sin(x)sin(sin(x))cos4(x)+3150sin4(x)cos(cos(x))cos3(x)+22050sin2(x)cos(cos(x))cos3(x)+630sin6(x)cos2(x)sin(cos(x))-4725sin4(x)cos2(x)cos(sin(x))+15750sin4(x)cos2(x)sin(cos(x))-22050sin3(x)sin(sin(x))cos2(x)+25515sin2(x)cos2(x)cos(sin(x))+25515sin2(x)cos2(x)sin(cos(x))-256cos2(x)cos(sin(x))+255cos2(x)sin(cos(x))+7125sin(x)sin(sin(x))cos2(x)-sin10(x)sin(cos(x))-45sin8(x)cos(cos(x))cos(x)-120sin8(x)sin(cos(x))-2730sin6(x)cos(cos(x))cos(x)-2352sin6(x)sin(cos(x))-19530sin4(x)cos(cos(x))cos(x)-3150sin4(x)cos(sin(x))-5440sin4(x)sin(cos(x))-7125sin2(x)cos(cos(x))cos(x)+255sin2(x)cos(sin(x))-256sin2(x)sin(cos(x))

In[5]:=

1 == 2

False

In[6]:=

1 == 1

True

In[7]:=

Eq = x==1

x=1

In[8]:=

Eq /. x->1

True

In[9]:=

ODE = y'[x] + x y[x] == Sin[x]

y'(x)+xy(x)=sin(x)

In[14]:=

sol = DSolve[ODE,y[x],x]

{{y(x)c1e-x22-12iπ2e12-x22(erfi(x+i2)-erfi(x-i2))}}

In[17]:=

z[x_] = y[x] /. sol[[1,1]]

c1e-x22-12iπ2e12-x22(erfi(x+i2)-erfi(x-i2))

In[15]:=

sol[[1,1]]

y(x)c1e-x22-12iπ2e12-x22(erfi(x+i2)-erfi(x-i2))

In[18]:=

z[1.]

0.606531c1+(1.21479+0.i)

In[19]:=

Maxima

(%i1)

diff(sin(x),x);

(%o1) cos(x)

(%i2)

Octave
A=( 0.45229 0.22986 0.70938 0.65207 0.84622 0.8479 0.28058 0.5938 0.36148 ),A-1=( -11.373 19.462 -23.333 0.12663 -2.0461 4.5509 8.6198 -11.746 13.402 )

octave>

A=rand(3)

( 0.93125 0.050603 0.82831 0.22199 0.11851 0.75259 0.09635 0.24193 0.66373 )

octave>

inv(A)

( 1.5894 -2.5636 0.9233 1.15 -8.273 7.9454 -0.6499 3.3876 -1.5235 )

octave>

Python

Python]

from pylab import *

Python]

x=arange(0.,3.15,0.01); y=sin(x); plot(x,y);

Python]

show()

None

Python]

Shell

Shell session inside TeXmacs pid = 26400

Shell]

pwd

/home/student

Shell]

ls

bearclaw documents ecss0.log mitran-web research Wolfram Mathematica

courses Downloads fontconfig perl5 TeXmacs

Desktop ecbx0.log mitran projects tmp

Shell]