Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Olivier Mullier
interval_integrals
Commits
b21fb00e
Commit
b21fb00e
authored
Apr 05, 2019
by
Olivier Mullier
Browse files
ajout d'exemples
parent
42f4baff
Changes
3
Hide whitespace changes
Inline
Side-by-side
src/integralii.cpp
View file @
b21fb00e
...
...
@@ -51,16 +51,25 @@ std::list<ibex::Interval *>& IntegralII::compute_list_of_zeros(ibex::Interval se
return
*
res
;
}
bool
p_interval_compare
(
const
ibex
::
Interval
*
a
,
const
ibex
::
Interval
*
b
)
{
return
a
->
ub
()
<
b
->
lb
();
}
std
::
list
<
ibex
::
Interval
*>&
IntegralII
::
compute_list_of_zeros_inf
()
{
std
::
list
<
ibex
::
Interval
*>&
res
=
compute_list_of_zeros
(
_inf_endpoint
);
res
.
sort
();
res
.
sort
(
p_interval_compare
);
return
res
;
}
std
::
list
<
ibex
::
Interval
*>&
IntegralII
::
compute_list_of_zeros_sup
()
{
return
compute_list_of_zeros
(
_sup_endpoint
);
std
::
list
<
ibex
::
Interval
*>&
res
=
compute_list_of_zeros
(
_sup_endpoint
);
// for (auto * elem : res){
// cout << *elem << endl;
// }
return
res
;
}
...
...
src/integralrr.h
View file @
b21fb00e
...
...
@@ -21,7 +21,7 @@
#include
<ibex.h>
#define __EPS__ (1e-
4
)
#define __EPS__ (1e-
5
)
/**
* @todo write docs
...
...
src/main.cpp
View file @
b21fb00e
...
...
@@ -2,15 +2,58 @@
#include
"integralii.h"
int
main
(){
cout
<<
setprecision
(
15
);
void
example1
(){
ibex
::
Variable
x
(
1
);
ibex
::
Function
f
(
x
,
ibex
::
cos
(
x
));
ibex
::
Function
f
(
x
,
x
*
ibex
::
cos
(
x
));
ibex
::
Interval
inf_inter
(
0
,
5
);
ibex
::
Interval
sup_inter
(
7
,
15
);
IntegralII
integ_inter
(
inf_inter
,
sup_inter
,
&
f
);
cout
<<
"Result: "
<<
endl
;
cout
<<
integ_inter
<<
endl
;
ibex
::
Function
g
(
x
,
x
*
ibex
::
sin
(
x
)
+
ibex
::
cos
(
x
));
cout
<<
"Calcul avec la solution analytique : "
<<
g
<<
endl
;
ibex
::
IntervalVector
x_vec
(
1
),
y_vec
(
1
);
x_vec
[
0
]
=
integ_inter
.
get_solution
().
first
.
get_inf_endpoint
();
y_vec
[
0
]
=
integ_inter
.
get_solution
().
first
.
get_sup_endpoint
();
cout
<<
"
\t
min : ("
<<
x_vec
<<
", "
<<
y_vec
<<
") : "
<<
g
.
eval_vector
(
y_vec
)
-
g
.
eval_vector
(
x_vec
)
<<
endl
;
x_vec
[
0
]
=
integ_inter
.
get_solution
().
second
.
get_inf_endpoint
();
y_vec
[
0
]
=
integ_inter
.
get_solution
().
second
.
get_sup_endpoint
();
cout
<<
"
\t
max : ("
<<
x_vec
<<
", "
<<
y_vec
<<
") : "
<<
g
.
eval_vector
(
y_vec
)
-
g
.
eval_vector
(
x_vec
)
<<
endl
;
}
void
example2
(){
ibex
::
Variable
x
(
1
);
ibex
::
Function
f
(
x
,
x
*
ibex
::
sin
(
x
));
ibex
::
Interval
inf_inter
(
0
,
5
);
ibex
::
Interval
sup_inter
(
7
,
15
);
IntegralII
integ_inter
(
inf_inter
,
sup_inter
,
&
f
);
cout
<<
"Result: "
<<
endl
;
cout
<<
integ_inter
<<
endl
;
ibex
::
Function
g
(
x
,
-
x
*
ibex
::
cos
(
x
)
+
ibex
::
sin
(
x
));
cout
<<
"Calcul avec la solution analytique : "
<<
g
<<
endl
;
ibex
::
IntervalVector
x_vec
(
1
),
y_vec
(
1
);
x_vec
[
0
]
=
integ_inter
.
get_solution
().
first
.
get_inf_endpoint
();
y_vec
[
0
]
=
integ_inter
.
get_solution
().
first
.
get_sup_endpoint
();
cout
<<
"
\t
min : ("
<<
x_vec
<<
", "
<<
y_vec
<<
") : "
<<
g
.
eval_vector
(
y_vec
)
-
g
.
eval_vector
(
x_vec
)
<<
endl
;
x_vec
[
0
]
=
integ_inter
.
get_solution
().
second
.
get_inf_endpoint
();
y_vec
[
0
]
=
integ_inter
.
get_solution
().
second
.
get_sup_endpoint
();
cout
<<
"
\t
max : ("
<<
x_vec
<<
", "
<<
y_vec
<<
") : "
<<
g
.
eval_vector
(
y_vec
)
-
g
.
eval_vector
(
x_vec
)
<<
endl
;
}
int
main
(){
cout
<<
setprecision
(
15
);
example2
();
return
EXIT_SUCCESS
;
}
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment