Course 1 : Basics

Programming Components

Special syntax symbols  : ; ` ' " ! # % κλπ

Strings

"Καλημέρα"
"bla bla bla"

Numbers

15
2/3
15.1
(Sqrt[15])
5+4 I
Degree

Symbols

x
y1
xx2
userssymbol

Numerical Operators

2+3
1+x+x
2*3
2 3
2x
2.5/3
2^5

Logical Operators

5>4
5≥4
5==6
5≠6
(5>3)||(4>2)
(5>3)&&(4>2)

syntax operators ( /. , <<, ->  )

Lists

{1,5,25,100}
{x, x+5, y*x, "hello"}

representations - expressions

x+x^2+1/x

If[x>0.5^2+1,Print["Hello"]]

Functions - Commands

Sqrt[15]
Sqrt[x+1]
N[2/3]
Factor[x^2-5x+6]
Plot[x^2-5x+6,{x,0,4}]
Print["Hello World"]

Assignments  (symbol = expression)

z=10
y=x^2-5x+6
g=Plot[x^2-5x+6,{x,0,4}];

Programming procedure and use of symbols

Serial execution

x=3

y=x^2+x+1

x=2

y=5

z=x+y

Clear values

x
y

Clear[x,y]  (* ClearAll[x,y] *)
x
y

Clear["Global`*"]

Names of Symbols

c=1;
neosimbolo1234=xx+c

C=1;
Neosimbolo1234=xx+C

sin=a+b
Sin=A+B

(* indexed symbols *)
x[1]=10
x[2]=5
x[3]=x[1]*x[2]

i=2; j=3;
x[i]+x[j]

Replace symbol in an expression

Clear[x,y]

y=x^2+5x+6

y/.{x->1}

y/.{x->a}

yy=y/.{x->Sqrt[2]}

Management of Mathematical Expressions

ClearAll["Global`*"]
y1=(x-3)^2 (x+k) / x -2*(x+k) 
y2=x^2-x+1
y=y1*y2
z=(x+y)^2-x^2-y^2-2x y

Simplification of mathematical expressions

Simplify[y]
Simplify[z]

FullSimplify[y]

Algebraic computations

z=Expand[y]

Factor[z]

Factor[x^2-4]
Factor[x^2-2]
Factor[x^2+1]

Factor[x^2-2, Extension->{(Sqrt[2])} ]
Factor[x^2+1, GaussianIntegers -> True ]

TrigToExp[Sin[x]]
ExpToTrig[(E^(I θ))]

(* rational expressions *)

z=(((x+1)(x^2+1))/(x^2-1))
Cancel[z]

w=Apart[z]

t=Together[w]

(* Computations for polynomials - see in Help "Polynomial algebra" *)

p=(x+1)(x+2)(x+3)
PolynomialQuotient[p,1+x,x]
PolynomialRemainder[p,1+x,x]

(* Δυνάμεις *)

(Sqrt[x^2])
PowerExpand[(Sqrt[x^2])] 
PowerExpand[(Sqrt[x y])]
Refine[(Sqrt[x^2]),x>0]
Refine[(Sqrt[x^2]),x ∈ Reals]

Clear[x,y]
ComplexExpand[Exp[x+I y]]
ComplexExpand[Sin[x+I y]]
ComplexExpand[(x+I y)^2, y]

Clear[x,y,z]
FullForm[(y^2)+1/z+(x/(Sqrt[5]))]