FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Sample_program_ODE/Sample012/main_sim.cpp at master · mino2357/Sample_program_ODE · GitHub
mino2357
/
Sample_program_ODE
Public
Notifications
You must be signed in to change notification settings
Fork
3
Star
23
Code
Issues
1
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Sample_program_ODE
/
Sample012
/
main_sim.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
60 lines (45 loc) · 1.39 KB
Breadcrumbs
Sample_program_ODE
/
Sample012
/
main_sim.cpp
Copy path
File metadata and controls
60 lines (45 loc) · 1.39 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
/*
* RKF78法で二階の常微分方程式を解く.
* テーマ:アレンストーフ軌道.
* 線形代数ライブラリのEigenを使用.
* Boostも使用.
*
* by みーくん.
*/
#
include
"
ERK.hpp
"
#
include
<
iostream
>
#
include
<
cmath
>
#
include
<
limits
>
#
include
<
iomanip
>
#
include
<
string
>
#
include
<
Eigen/Core
>
#
include
<
Eigen/Sparse
>
#
include
<
Eigen/Dense
>
#
include
<
boost/multiprecision/cpp_dec_float.hpp
>
namespace
mp
=
boost::multiprecision;
using
multiFloat = mp::cpp_dec_float_100;
//
時刻に関するパラメータ
multiFloat
dt
(
"
1.0e-8
"
);
const
multiFloat
t_limit
(
"
100.0
"
);
const
multiFloat
RTol
(
"
10e-20
"
);
const
multiFloat
ATol
(
"
10e-20
"
);
const
multiFloat
t_min
(
"
10e-40
"
);
const
multiFloat
t_max
(
"
0.1
"
);
//
インターバル
constexpr
int
INTV
=
1
;
//
movie
constexpr
int
sim =
0
;
int
main
(){
Eigen::Matrix<multiFloat,
4
,
1
>
x
(
0.994
,
0
,
0
, -
2.00158510637908252240537862224
);
std::cout << std::fixed <<
std::setprecision
(
35
);
std::cerr << std::fixed <<
std::setprecision
(
35
);
multiFloat t{};
mino2357::
RKF78
<multiFloat>
rkf78
(ATol, RTol);
for
(
int
i=
0
; t<t_limit; i++){
if
(i%
INTV
==
0
){
//
std::cerr << t << " " << mp::log10(dt) << std::endl;
std::cout << t <<
"
"
<<
mp::log10
(dt) <<
"
"
<<
x
(
0
,
0
) <<
"
"
<<
x
(
1
,
0
) <<
"
"
<<
x
(
2
,
0
) <<
"
"
<<
x
(
3
,
0
) << std::endl;
}
rkf78.
Integrate
(t, dt, x);
}
}
Back
|
FazBrowse Home
|
New Git URL