22 static Interval fwd(
const Interval& x1,
const Interval& x2);
23 static ScalarType fwd_natural(
const ScalarType& x1,
const ScalarType& x2);
24 static ScalarType fwd_centered(
const ScalarType& x1,
const ScalarType& x2);
25 static void bwd(
const Interval& y, Interval& x1, Interval& x2);
32 atan2(
const ScalarExpr& x1,
const ScalarExpr& x2)
34 return { std::make_shared<AnalyticOperationExpr<Atan2Op,ScalarType,ScalarType,ScalarType>>(x1,x2) };
44 inline ScalarType Atan2Op::fwd_natural(
const ScalarType& x1,
const ScalarType& x2)
48 x1.def_domain && x2.def_domain
49 && !(x1.a == 0. && x2.a == 0.)
53 inline ScalarType Atan2Op::fwd_centered(
const ScalarType& x1,
const ScalarType& x2)
55 if(centered_form_not_available_for_args(x1,x2))
56 return fwd_natural(x1,x2);
58 assert(x1.da.rows() == 1);
59 assert(x1.da.rows() == x2.da.rows() && x1.da.cols() == x2.da.cols());
61 IntervalMatrix d(1,x1.da.cols());
62 for(Index i = 0 ; i < d.size() ; i++)
63 d(0,i) = (-x1.a*x2.da(0,i)/(
sqr(x2.a)+
sqr(x1.a)))+(x2.a*x1.da(0,i)/(
sqr(x2.a)+
sqr(x1.a)));
69 x1.def_domain && x2.def_domain
70 && !(x1.a == 0. && x2.a == 0.)
92 if(!y_x2pos.is_empty())
94 Interval xpos = x2 & Interval(0,oo);
97 if(y_x2neg_x1pos.is_empty() || y_x2neg_x1neg.is_empty())
99 Interval z = yall/xpos;
100 AtanOp::bwd(y_x2pos,z);
101 DivOp::bwd(z,yall,xpos);
111 yres |= (x1 & Interval(0,oo));
116 yres |= (x1 & Interval(-oo,0));
120 if(!y_x2neg_x1pos.is_empty())
122 Interval xneg = x2 & Interval(-oo,0);
123 Interval ypos = x1 & Interval(0,oo);
124 Interval z = ypos/xneg;
126 DivOp::bwd(z,ypos,xneg);
131 if(!y_x2neg_x1neg.is_empty())
133 Interval xneg = x2 & Interval(-oo,0);
134 Interval yneg = x1 & Interval(-oo,0);
135 Interval z = yneg/xneg;
137 DivOp::bwd(z,yneg,xneg);
Interval class, for representing closed and connected subsets of .
Definition codac2_Interval.h:62
static Interval pi()
Provides an interval for .
Definition codac2_Interval_impl.h:555
static Interval zero()
Provides an interval for .
Definition codac2_Interval_impl.h:540
double lb() const
Returns the lower bound of this.
Definition codac2_Interval_impl.h:102
static Interval empty()
Provides an empty interval.
Definition codac2_Interval_impl.h:535
static Interval half_pi()
Provides an interval for .
Definition codac2_Interval_impl.h:550
Interval atan2(const Interval &y, const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:140
Interval sqr(const Interval &x)
Returns .
Definition codac2_Interval_operations_impl.h:21