void QtfeCanal::paintEvent(QPaintEvent *event) { QPainter painter(this); painter.setRenderHint(QPainter::Antialiasing, true); // background painter.drawImage(0,0,*background); // all points QPen pen(Qt::black, pointSizePixel, Qt::SolidLine); painter.setPen(pen); for(int i=0 ; i<list.size() ; ++i) { painter.drawPoint(listPos2WidgetPos(*list[i])); } // points interpolation line pen.setWidth(lineWidth); painter.setPen(pen); qreal x0 = 0.0; qreal y0 = evalf(x0); for(int p=1 ; p < list.size() ; ++p) for(int i=1 ; i <= 10 ; ++i) { qreal x1 = interp1(list[p-1]->x(), list[p]->x(), i/10.0); qreal y1 = evalf(x1); painter.drawLine(listPos2WidgetPos(QPointF(x0, y0)), listPos2WidgetPos(QPointF(x1, y1))); x0 = x1; y0 = y1; } // selected point pen.setColor(Qt::red); painter.setPen(pen); if(selected) { painter.drawEllipse(listPos2WidgetPos(*selected),circleSizePixel,circleSizePixel); } QWidget::paintEvent(event); }
ex row_power_z::evalf(int ind) { if(Digits < ind*10) Digits = ind*10; if(ind < 0) return 0; while(ind > int(numTk.size()) - 1) { numTk.push_back(/*ex_to<numeric>*/(coeff(s_taylor, numTk.size()).evalf())); //DEBUG_OUT("numTk[" + ToString(ind) + "] = " << numTk[ind]) } if(ind == 0) if(! coeff(s_taylor, 0).evalf().is_equal(numTk[ind])) { numTk.clear(); return evalf(ind); } return numTk[ind]; }
static ex eta_evalf(const ex &x, const ex &y) { // It seems like we basically have to replicate the eval function here, // since the expression might not be fully evaluated yet. if (x.info(info_flags::positive) || y.info(info_flags::positive)) return _ex0; if (x.info(info_flags::numeric) && y.info(info_flags::numeric)) { const numeric nx = ex_to<numeric>(x); const numeric ny = ex_to<numeric>(y); const numeric nxy = ex_to<numeric>(x*y); int cut = 0; if (nx.is_real() && nx.is_negative()) cut -= 4; if (ny.is_real() && ny.is_negative()) cut -= 4; if (nxy.is_real() && nxy.is_negative()) cut += 4; return evalf(I/4*Pi)*((csgn(-imag(nx))+1)*(csgn(-imag(ny))+1)*(csgn(imag(nxy))+1)- (csgn(imag(nx))+1)*(csgn(imag(ny))+1)*(csgn(-imag(nxy))+1)+cut); } return eta(x,y).hold(); }
ex operator()(const ex & e) { return evalf(e, level); }