Professional Documents
Culture Documents
sm
1 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
A 0 B 1 C 2
Clear A 1
A B 1 C 2
lastError "A - not defined."
Clear B , C 1
A B C
2 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
t 2 a b
a 1 0 0
A Z identity 3 0 1 0
b 0 0 1
1 π A B C
Unknowns B
e i t r s Unknowns Z 0
C
r x
Unknowns f x , y
s y
3 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
4 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
π 2 12.7
7 π 4
e
5 14
Max 8 , , , 2 54.6
1 25 44 6 5 6
10 4 7
3 7
π 2 12.7
7 π 4
e
5 14
Min 8 , , , 2 10
1 25 44 6 5 6
10 4 7
3 7
5 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
1 4 7 i 1 8.06
1 1
Abs 4 7 i 2 8.06 2
4 7 i 2 8.06 2
6 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
UoM 2 1 UoM 2 1
kN kN kg
UoM 2 1 m Pa UoM 2
m m 2
s
UoM 2 ft kip 1J 2
kg m
UoM 2 ft kip
N 2
UoM 2 1 Pa s
2
mm N kg
UoM 2
2 2
mm m s
UoM 2 cm 1m
UoM 2 cm m
kg m
1
2 kg m
3 kN s
UoM 2
4 kN kg m 3 kN s
1 UoM
2 4 kN kg m
s
2
s
kg m
1
2 kg m
3 kN s
UoM 2
4 kN kg m 3 kN s
1 UoM
2 4 kN kg m
s
2
s
7 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
OoM 60 m 1 OoM 60 m 1
1
OoM 60 m 1 10 OoM 60 m 10
10 10
60 m
eOoM 60 m 2 ln
m
2 eOoM 60 m round ,0
eOoM 60 m 1 10 ln 10
10
60 m
ln
m
round ,0
ln 10
eOoM 60 m 10
10
y
4
0 x
-4
-6 -4 -2 0 2 4 6
x
OoM 10
x
eOoM 10
0 x
-16 -8 0 8 16
OoM x
10
eOoM x
10
8 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
Fast typing:
y 1 0 1 1 0 1
2 1.1 1 0.9 1 1 0
0.9 1.0 1.1 1 1 2
1
0 x
-1
-2 -2 -1 0 1 2
x
π π i ∞ 4 4 i ∞
π π i 4 4 i
2 "string" 2 "string"
2 "string" 2 "string"
9 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
Fast typing:
y 1 0 1 1 0 1
2 1.1 1 0.9 2 1 1
0.9 1.0 1.1 0 1 1
1
0 x
-1
-2 -2 -1 0 1 2
x
π π i ∞ 3 3 i ∞
π π i 3 3 i
2 "string" 1 "string"
2 "string" 1 "string"
10 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
0
0 clone of built-in matrix(2,3)
Zeros 5 0
0 0 0
0 Zeros 2 , 3
0 0 0
0
11 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
1
1
1 1 1
Ones 5 1 Ones 2 , 3
1 1 1
1
1
12 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
1 2 3 1 0 0 1 2 3 1 0 0 1 1 0 0 0
Diag 4 5 6 0 5 0 4 5 6 0 5 0 2 0 2 0 0
Diag Diag
7 8 9 0 0 9 7 8 9 0 0 9 3 0 0 3 0
10 11 12 0 0 0 4 0 0 0 4
13 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
1 1 1 1
2 2 2 2
sys2mat sys2mat
3 3 3 3
4 4 4 4
0 0 0 0
1 1 1 1
sys2mat 2 2 sys2mat 2 2
1 1
3 3 3 3
4 4 4 4
14 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
1 1 1 1 1 1 1 1
2 2 2 2 2 2 2 2
mat2sys mat2sys
3 3 3 3 3 3 3 3
4 4 4 4 4 4 4 4
1 1
2 2
1 3 1 3
3 4 3 4
mat2sys 2 4 mat2sys 2 4
5 6 7 5 5 6 7 5
6 6
7 7
1
2
1 3
3 4
mat2sys 2 4
1
5 6 7 5
6
7
15 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
"hello"
strjoin " " , "hello world!"
"world!"
"hello"
strjoin " " , "hello world!"
"world!"
"the"
strjoin " " , "fox" "the quick brown fox ..."
"quick" "brown"
"..."
"bread"
"milk"
strjoin ", " , "bread, milk, sugar, ..."
"sugar"
"..."
16 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
"the"
"QUICK"
strsplit "the QUICK bRoWn FoX...", " "
"bRoWn"
"FoX..."
17 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
18 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
19 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
20 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
21 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
11
GetType 12 "number" GetType 12.5 "number" GetType "number"
3
1
GetType "matrix" GetType 1 "matrix" GetType 1 "matrix"
2
1
GetType "system" GetType 2 "system" GetType 2 "system"
2
22 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
3 3
var2str "0.75" var2str "-0.75" var2str "something" "something"
4 4
y y
6 6
5 [ 123.46 , 1.41 ] 5 { 123.46
4
[ 3.14 , 2.72 ] 4
{ 3.14
3 3
2 2
1 1
0 x 0 x
-1 0 4 8 12 16 20 24 28 -1 0 4 8 12 16 20 24
123.456 2 123.456
5 5 var2str , 2 12 "darkblue" 5 5 var2str , 2 12 "darkblue"
π e π
23 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
2D LINEAR INTERPOLATION
XX 20 50 100 150 200 250 300 350 400 450 500 550 600
xx 20 yy 215
InterpBilinear XX , YY , MM , xx , yy 14.6
XX XX mm xx xx mm YY YY mm yy yy mm MM MM K
InterpBilinear XX , YY , MM , xx , yy 14.6 K
24 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
Fast typing: or
i θ i θ 1 4 7 i 1 4 7 i
ρ e ρ e
4 7 i 2 4 7 i 2
5 3 i 5 3 i
1 4 7 i 1 4 7 i
1 1
5 3 i 5 3 i 4 7 i 2 4 7 i 2
4 7 i 2 4 7 i 2
25 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
function name
gegt 3 a x b a x x b
gtge 3 a x b a x x b
gtgt 3 a x b a x x b
26 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
Fast typing:
a if x 0 3 if x 0
b otherwise 2 if 1 x 0.5
f x
1 if x 2
a if x 0 1 otherwise
b if x 0
c otherwise
4 y
3
0 x
-1
-3 -2.5 -2 -1.5 -1 -0.5 0 0.5 1 1.5
-2
f x
a if x 0
b if x 0 x 0 0 a x 0 0 x 0 0 b x 0 0 c
c otherwise
a if x 0 5
b if x 0 f x dx
c otherwise 3
27 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
Fast typing:
1 if i j show cases() δ 1
δ 33
ij 0 otherwise on 'none'
optimization δ 0
34
28 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
Fast typing:
N
N%
100
29 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
Fast typing:
N
N‰
1000
30 / 32
3 mar 2016 19:34:49 - CustomFunctions_examples.sm
at(2)
d
f z
dz
x
at(3) b
d
f x
dx
a
x
1
sin x sin x sin x sin x sin x
x 0 x 1 0
0 0
y y
2 2
0 x 0 x
-2
-8 -4 0 4 8 -2
-8 -4 0 4 8
x π
sin z sin x
x 2 π x
f a, b 2 a b
f x, y y 2 x
implicit equivalence:
- any unknown needs a value;
- values are set sorting unknowns in alphabetical order.
f a, b y 2 x f a, b y 2 x
x x y
y
f a, b y 2 x
x
y
f a, b y 2 a "a" untouched
a y
f a, b a 2 b swap unknowns
b a
explicit equivalence:
- allowed total or partial replacement;
- random sorting allowed;
f a, b y 2 x f a, b y 2 x
a x a x b y
b y
f a, b y 2 x
a x
b y
f a, b y 2 x
b y a x random sorting
f a, b b 2 x partial replacement
a x
f a, b y 2 a partial replacement
b y
31 / 32
y 3 mar 2016 19:34:49 - CustomFunctions_examples.sm
d 3 d 3 2 2
f z z 3 z 3 5 75
dz dz
5
z!
f x z x f 4 235.4
1 z
z= 1
f x 235.4
4
4 k n k dk 12 n k dk
3 k 3
32 / 32