codac 2.0.0
Loading...
Searching...
No Matches
Integration and primitive operations on sliced tubes

The following methods are valid for tubes defined for Interval or IntervalVector codomains. The returned values are integral enclosures of same type (respectively, Interval or IntervalVector). More...

Functions

codac2::SlicedTube< T >::integral (const Interval &t) const
 Returns an enclosure of the integrals of this tube from \(t_0\) to \([t]\).
codac2::SlicedTube< T >::integral (const Interval &t1, const Interval &t2) const
 Returns an enclosure of the integrals of this tube between the time intervals \([t_1]\) and \([t_2]\).
std::pair< T, T > codac2::SlicedTube< T >::partial_integral (const Interval &t) const
 Returns lower and upper enclosures of the integrals of this tube \([x](\cdot)=[x^-(\cdot),x^+(\cdot)]\) from \(t_0\) to \([t]\).
std::pair< T, T > codac2::SlicedTube< T >::partial_integral (const Interval &t1, const Interval &t2) const
 Returns lower and upper enclosures of the integrals of this tube \([x](\cdot)=[x^-(\cdot),x^+(\cdot)]\) between \([t_1]\) and \([t_2]\).
SlicedTube< T > codac2::SlicedTube< T >::primitive () const
 Returns a primitive of this tube with zero initial condition.
SlicedTube< T > codac2::SlicedTube< T >::primitive (const T &x0) const
 Returns a primitive of this tube with prescribed initial condition.

Detailed Description

The following methods are valid for tubes defined for Interval or IntervalVector codomains. The returned values are integral enclosures of same type (respectively, Interval or IntervalVector).

Function Documentation

◆ integral() [1/2]

template<typename T>
T codac2::SlicedTube< T >::integral ( const Interval & t) const

Returns an enclosure of the integrals of this tube from \(t_0\) to \([t]\).

This method computes an enclosure of

\[ \left\{ \int_{t_0}^{\tau} [x](s)\,ds \;\middle|\; \tau\in[t] \right\}. \]

It is obtained from partial_integral(t) by taking the hull between the lower bound of the lower enclosure and the upper bound of the upper enclosure.

Parameters
ttemporal interval \([t]\)
Returns
enclosure of the integrals of this tube over t
18 {
20
21 if(partial_integ.first.is_empty() || partial_integ.second.is_empty())
22 return this->empty_value();
23
24 else if(partial_integ.first.is_unbounded() || partial_integ.second.is_unbounded())
25 return this->all_reals_value();
26
27 else
28 return T(partial_integ.first.lb()) | partial_integ.second.ub();
29 }
Tube represented over a sliced temporal domain.
Definition codac2_SlicedTube.h:38
T all_reals_value() const
Returns the unbounded codomain value associated with T.
Definition codac2_SlicedTube.h:1051
T empty_value() const
Returns the empty codomain value associated with T.
Definition codac2_SlicedTube.h:1063
bool is_unbounded() const
Tests whether this tube is unbounded.
Definition codac2_SlicedTube.h:332
bool is_empty() const
Tests whether this tube is empty.
Definition codac2_SlicedTube.h:316
std::pair< T, T > partial_integral(const Interval &t) const
Returns lower and upper enclosures of the integrals of this tube from to .
Definition codac2_SlicedTube_integral_impl.h:58

◆ integral() [2/2]

template<typename T>
T codac2::SlicedTube< T >::integral ( const Interval & t1,
const Interval & t2 ) const

Returns an enclosure of the integrals of this tube between the time intervals \([t_1]\) and \([t_2]\).

This method computes an enclosure of

\[ \left\{ \int_{\tau_1}^{\tau_2} [x](s)\,ds \;\middle|\; \tau_1\in[t_1],\ \tau_2\in[t_2] \right\}. \]

The result is obtained by subtracting the partial integral enclosures at t1 and t2.

Parameters
t1first temporal interval \([t_1]\)
t2second temporal interval \([t_2]\)
Returns
enclosure of the integrals of this tube between t1 and t2
33 {
36
37 if(integ_t1.first.is_empty() || integ_t1.second.is_empty() ||
38 integ_t2.first.is_empty() || integ_t2.second.is_empty())
39 {
40 return this->empty_value();
41 }
42
43 else if(integ_t1.first.is_unbounded() || integ_t1.second.is_unbounded() ||
44 integ_t2.first.is_unbounded() || integ_t2.second.is_unbounded())
45 {
46 return this->all_reals_value();
47 }
48
49 else
50 {
51 auto lb = (integ_t2.first - integ_t1.first).lb();
52 auto ub = (integ_t2.second - integ_t1.second).ub();
53 return T(lb) | ub;
54 }
55 }
auto ub() const
Returns a matrix containing the upper bounds of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:103
auto lb() const
Returns a matrix containing the lower bounds of each interval element.
Definition codac2_MatrixBase_addons_IntervalMatrixBase.h:91

◆ partial_integral() [1/2]

template<typename T>
std::pair< T, T > codac2::SlicedTube< T >::partial_integral ( const Interval & t) const

Returns lower and upper enclosures of the integrals of this tube \([x](\cdot)=[x^-(\cdot),x^+(\cdot)]\) from \(t_0\) to \([t]\).

This method returns a pair \(([p^-],[p^+])\) such that:

\[ [p^-]\supset \left\{ \int_{t_0}^{\tau} x^-(s)\,ds \;\middle|\; \tau\in[t] \right\} \mathrm{~~and~~} [p^+]\supset \left\{\int_{t_0}^{\tau} x^+(s)\,ds \;\middle|\; \tau\in[t] \right\}. \]

This representation preserves more information than integral(t), which only returns the hull of these partial integral bounds.

Parameters
ttemporal interval \([t]\)
Returns
pair of lower and upper partial integral enclosures over t
59 {
60 //if(!t.is_subset(tdomain()->t0_tf()))
61 // return { Interval(), Interval() };
62
63 auto zero = this->all_reals_value();
64 zero.init(Interval(0.));
65
68
69 for(const auto& si : *this)
70 {
71 if(si.t0_tf().lb() >= t.ub())
72 break;
73
74 if(si.codomain().is_empty())
75 {
76 auto e = this->empty_value();
77 return { e, e };
78 }
79
80 if(si.codomain().is_unbounded())
81 {
82 auto u = this->all_reals_value();
83 return { u, u };
84 }
85
86 // From t0 to tlb
87
88 Interval intv_t = si.t0_tf() & Interval(tdomain()->t0_tf().lb(), t.lb());
89 if(!intv_t.is_empty())
90 {
91 p_integ.first += intv_t.diam() * si.codomain().lb();
92 p_integ.second += intv_t.diam() * si.codomain().ub();
94
95 if(intv_t.ub() == t.ub())
96 return p_integ; // end of the integral evaluation
97 }
98
99 // From tlb to tub
100
101 intv_t = si.t0_tf() & t;
102 if(!intv_t.is_empty())
103 {
105 p_integ_uncertain.first += Interval(0., intv_t.diam()) * si.codomain().lb();
106 p_integ_uncertain.second += Interval(0., intv_t.diam()) * si.codomain().ub();
107
108 p_integ.first |= p_integ_uncertain.first;
109 p_integ.second |= p_integ_uncertain.second;
110
111 p_integ_uncertain.first = p_integ_temp.first + intv_t.diam() * si.codomain().lb();
112 p_integ_uncertain.second = p_integ_temp.second + intv_t.diam() * si.codomain().ub();
113 }
114 }
115
116 return p_integ;
117 }
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:110
T codomain() const
Returns the global codomain of this tube.
Definition codac2_SlicedTube.h:347
Interval t0_tf() const
Returns the global temporal interval of this tube.
Definition codac2_TubeBase.h:61
const std::shared_ptr< TDomain > & tdomain() const
Returns the temporal domain of this tube.
Definition codac2_TubeBase.h:49

◆ partial_integral() [2/2]

template<typename T>
std::pair< T, T > codac2::SlicedTube< T >::partial_integral ( const Interval & t1,
const Interval & t2 ) const

Returns lower and upper enclosures of the integrals of this tube \([x](\cdot)=[x^-(\cdot),x^+(\cdot)]\) between \([t_1]\) and \([t_2]\).

This method returns a pair obtained by subtracting the partial integral enclosures at t1 from those at t2. The returned pair \(([p^-],[p^+])\) is such that:

\[ [p^-]\supset \left\{ \int_{\tau_1}^{\tau_2} x^-(s)\,ds \;\middle|\; \tau_1\in[t_1],\ \tau_2\in[t_2] \right\}, \]

and

\[ [p^+]\supset \left\{\int_{\tau_1}^{\tau_2} x^+(s)\,ds \;\middle|\; \tau_1\in[t_1],\ \tau_2\in[t_2] \right\}. \]

Parameters
t1first temporal interval \([t_1]\)
t2second temporal interval \([t_2]\)
Returns
pair of lower and upper enclosures of the integrals
121 {
124 return {
125 integ_t2.first - integ_t1.first,
126 integ_t2.second - integ_t1.second
127 };
128 }

◆ primitive() [1/2]

template<typename T>
SlicedTube< T > codac2::SlicedTube< T >::primitive ( ) const
inline

Returns a primitive of this tube with zero initial condition.

This is a shorthand for primitive(x0) with \(x_0 = 0\).

In other words, the returned tube encloses solutions of

\[ \dot{p}(\cdot) \in [x](\cdot), \qquad p(t_0)=0. \]

Returns
primitive tube with zero initial condition
1009 {
1010 auto x0 = all_reals_value();
1011 x0.init(0.);
1012 return primitive(x0);
1013 }
SlicedTube< T > primitive() const
Returns a primitive of this tube with zero initial condition.
Definition codac2_SlicedTube.h:1008

◆ primitive() [2/2]

template<typename T>
SlicedTube< T > codac2::SlicedTube< T >::primitive ( const T & x0) const
inline

Returns a primitive of this tube with prescribed initial condition.

This method constructs a tube p on the same temporal domain as this tube, imposes the initial condition \(p(t_0)=x_0\), and contracts p with this tube through the derivative relation using CtcDeriv.

In other words, the returned tube encloses solutions of

\[ \dot{p}(\cdot) \in [x](\cdot), \qquad p(t_0)=x_0. \]

Note
The current implementation may create an explicit gate at the initial time \(t_0\) if it is not already present in the temporal partition.
Parameters
x0initial condition at \(t_0\)
Returns
primitive tube satisfying the prescribed initial condition
1037 {
1038 auto x = all_reals_value();
1039 auto p = SlicedTube<T>(this->tdomain(), x);
1040 p.set(x0, this->tdomain()->t0_tf().lb()); // may create an unwanted gate
1041 CtcDeriv c;
1042 c.contract(p,*this);
1043 return p;
1044 }
SlicedTube(const std::shared_ptr< TDomain > &tdomain, const T &codomain)
Creates a sliced tube with constant codomain over all temporal slices.
Definition codac2_SlicedTube.h:47
void set(const T &codomain)
Sets all codomains of this tube to the same value.
Definition codac2_SlicedTube.h:443