1
index data
a
dtype :float/str
...
put
Titles
not
es
away)
↑ anders <1D
a
Senes
)
pd Series (Cint/float, ..... ,
I
.
name kitc
index = ['string 's... ] I
list within
Dataframe (2D Away)
pd Dataframe
2 3) (8
C
B
A
S
,
,
,
By De
index =
---
locating
indices
,
4
63]]
,
[A' , B'ic]
columns =
:
↑
.
=23(((1
i
irst
/
[x' it' it] (
for solumns
& C'A'iB'] only works
ilsh (1 : 3 ] numbers , index
·
los
·
[Crow) [sols]
,
additional syntax
drop
af
.
drop) ....
!
axis
,
Now, ca
=
/1)
od
↳name
new
↑
'
'X :
'
of rename Sindex/columns
sort
sortvalues /by =I ascending-tre/Fully
:
,
af
df. Sort index (axrs-OIl
.
sout ↓
date/time
,
ascending-ime/Fall)
is
Sortonlyappy
/
,
...
pd to, datetime /"df[]" format
.
,
not drop (
% H : Y M : % S")
,
"
=
.
data 2 , one column (now)
pd Merge/datal
puts into
findsaintersection) and
,
.
The
Dataframe
& state voctor
dynamics
can dition
& initial
& instants
& dynamics functions
g .., y8 ,&, d + 5
tim
time step it era
t max-start to end of x
simulation
1steps int (tmax/at]
* keeping
② array
=
..
=
* = up
.
zels ((n- Steps , 2)]
if : away I columns
u =
X [O] = up away ((y8 , V8]]
.
* Dynamics func
dof dynamics lawy)
:
array [5]
v = avery [1]
y
=
↓formula :
v
&
g
* d
Yformulas y * v * g
1) if crough = 8
if
Y- formula < = 0 :
~ formula
Y = farmy (a = +
+
d
note : this
-o - arrays 21
away new
-
return
=
and
~ forms (g]]
up-array /CY-formula,
alay
,
new
* simulation
range /step-1C :
(x)
* [k + 1) :
for k
in
dynamics
y plotting =
& plating
X9 : 18)
-
extract
time-up Grange (8 Amax
-
,
,
at &
↑
codes
notes · not es a cut
a
sliding windows
data
1
=
]
...
(index 873]
window size = 3
for ;
range ((lon (data)
in
window
windowsze + 1)
-
under
[data(i : i
:
avornge-up
.
,
:
size
mean (window
Gaverge :2A3")
print(f'step Gi + 13 Sunders arg
=
Step
[4 7 2]
1
:
,
.
result
=
,
ang = 4 33
.
,
...
S]
=
result. append (window garage)
,
systems
nM-linear
linear
·g
will ibrium
u((2+ )] ax[b) + bn(k+ 1] na(k]+ u(k] + 2
=
=
u(kt]-nCk]sh(kin
=
Y solve
im
42 + m + 2
s ability
n[(2+ )] ax(b) bm(k+ 1] 8 7u(() + 8 um(k 1) + 18
=
=
+
+
.
.
(smStanj
-
(a) !
141
22
.
.
4
↳ solve
(b) < 1 /
+
0 72 + 0
=
.
roots all
the
have to
matplotlib pyp lat
be
<1
.
fig ax
,
plt subplots (1
=
·
,
2)
avosay
##
(1
,
-
X/y labe) (')
Set-Xylim('1)
Set
·
12 , 1]
2]
-
·
·
plt tight layout))
-
.
depends on rowsn cols
marker size for
titles
P It pl of /n axis yaxrs ,
.
Scatter e
,
,
marker-"Markersizes
↓
markerstyles"
limestyle -"
labels
,
autopat
plt hot (
.
25rV
-
,
=
'
size
')
T
pie
linesty le
percentages
=
-
% I
.
-
If %% l
bins 'auto' /number)
creates intervals on histogram
3
layer order Marker Lorder ,
.
=
markers
B
-
,
color = "
Of Yiamond
#patter
plt pis S
1
,
.
line Lorder 2
----
=
.:
!
"
Optimisation
Brute force
specify variables
1.
* MD
def
.
define objective
.
3
7
.
optionize
avange (1 25
,
8
,
.
,
,
max
Al
&
an array
# find X w/ minimum perimeter
minimum-index
Up Arymin (p-rals]
& index of minimum
=
p-min
=
win
&
x [minimum index]
=
y-min
,
a
-
X- Min
pevals
While 13-a)/2
=
if
·
&Se
np sign /grad(())
N Sign (gradcal) :
.
==
C
:
j
b= a
num-iter
+=
1
X.best
·
·
pop
has both values
intersectic a both
lists
unidn
up
polyfit-generate
continue
in
smooth
a
lin
-
loop
slips current ,
go to next loop
break-stop keep all together
lambdax : like f(N)
:
2x
A = lambda x
A(27 2(2]
=
serted Literable , key=
reverse T/f)
,,
Leb lambda x: x[I]
:
,
...
I
=
scipy
**
z(
x 0 = 2 ?-
a work
why
(a + b)/2
a=
·
Scipy
.
if start &
,
then
A/8
.
>
.
useful syntaxes
=-
21
#3
computing gradient
<
yMin ,
,
.
=
/
f(h)
tolerance and
A/Xmir
value num-iterations > max-iterations i
[minimum-index]
R-Vals
actual min
~
at
value
.
,
,
=
result XCO]
y-optimised -> A/X, Optimised
recult. fun
↑ optimised
then star
-
=
-
X optimused -
-
↑ rustouts
* min
&
# tolerance > if domain >,
=
# assign
-
import
minimize
(incert formula ]
perimeter func
result-minimize (perimeter func
4 8
bounds [(1 253] 7
[2]
i terations = 258
num-iterations
return 2 * X+ y
perimetor subs (x , A)
↑vals
=
⑨
#
Iterations
=
.
from scipy- minimize
b = 28
811
porimeter subs (X
y A/X
optimum !
# Domains
a= 1
let bounds
.
2
Areas 24
scripy minimize
Bisection
least
squares
, 1 y'(k) y(k])2
-
capture errors between
producted n real
value
.