Repository navigation
Expand file tree
/
Copy pathnew_limits2_y1.sh
More file actions
executable file
·110 lines (86 loc) · 2.3 KB
/
Copy pathnew_limits2_y1.sh
File metadata and controls
executable file
·110 lines (86 loc) · 2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
#!/bin/bash
###This is just to try this function before using it in find_het4.sh
function newlimits2_y1(){
###This is still not working.
##In this version we find in diff_stable_unstable.dat the interval
##where ngam is located. Then we look for y1min and y1max in unstable_manifold.dat
##and stable_manifold.dat
##We should have calculated at least two iterates.
local numdata
local file1
local k
local aux
file1=ordered_gammas2
numdata=$(cat $file1.dat | wc -l)
aux=$(tail -n +1 $file1.dat | head -n 1 | awk '{print $1}')
if [ $(echo "scale=$digits; $ngamm<$aux" | bc) -eq 1 ]; then
echo "$ngamm $i" > $file1.tmp
y1max=$firsty1max
y1min=$firsty1min
cat $file1.tmp $file1.dat > $file1.tmp2
mv -f $file1.tmp2 $file1.dat
rm -f $file1.tmp
else
k=1
while [ $k -le $numdata ] && [ $(echo "scale=$digits; $aux<$ngamm" | bc) -eq 1 ]; do
let k=k+1
aux=$(tail -n +$k $file1.dat | head -n 1 | awk '{print $1}')
done
echo "$ngamm $i" > $file1.tmp
if [ $k -gt $numdata ]; then
y1max=$firsty1max
y1min=$firsty1min
cat $file1.dat $file1.tmp > $file1.tmp2
mv -f $file1.tmp2 $file1.dat
rm -f $file1.tmp
else
local index
local y1
local y2
local y3
local y4
local aux2
local aux3
index=$(tail -n +$k $file1.dat | head -n 1 | awk '{print $2}')
y1=$(tail -n +$index unstable_manifold.dat | head -n 1 | awk '{print $2}')
y2=$(tail -n +$index stable_manifold.dat | head -n 1 | awk '{print $2}')
let k=k-1
index=$(tail -n +$k $file1.dat | head -n 1 | awk '{print $2}')
y3=$(tail -n +$index unstable_manifold.dat | head -n 1 | awk '{print $2}')
y4=$(tail -n +$index stable_manifold.dat | head -n 1 | awk '{print $2}')
aux2=$(max $y1 $y2)
aux3=$(max $y3 $y4)
y1max=$(max $aux2 $aux3)
aux2=$(min $y1 $y2)
aux3=$(min $y3 $y4)
y1min=$(min $aux2 $aux3)
head -n $k $file1.dat > $file1.tmp2
let aux=$numdata-$k
tail -n $aux $file1.dat > $file1.tmp3
cat $file1.tmp2 $file1.tmp $file1.tmp3 > $file1.dat
rm -f $file1.tmp*
fi
fi
}
function max(){
if [ $(echo "scale=$digits; $1>$2" | bc) -eq 1 ]; then
echo $1
else
echo $2
fi
}
function min(){
if [ $(echo "scale=$digits; $1>$2" | bc) -eq 1 ]; then
echo $2
else
echo $1
fi
}
firsty1max=1.1
firsty1min=0.9
digits=60
i=3
ngamm=.825287809941879781139948820394827823697781341575894138433948
newlimits2_y1
echo $y1min
echo $y1max