Commit 6e3c471f authored by Yuri Chornoivan's avatar Yuri Chornoivan

Implement third derivative and loosen the mesh a bit to calculate the fourth....

Implement third derivative and loosen the mesh a bit to calculate the fourth. This should allow to calculate extrema for second derivative right.

BUG: 304574
parent d0391299
......@@ -643,13 +643,14 @@ bool Function::copyFrom( const Function & function )
{
COPY_AND_CHECK( f1 ); // 1
COPY_AND_CHECK( f2 ); // 2
COPY_AND_CHECK( integral ); // 3
COPY_AND_CHECK( f3 ); // 3
COPY_AND_CHECK( integral ); // 4
}
COPY_AND_CHECK( dmin ); // 4,1
COPY_AND_CHECK( dmax ); // 5,2
COPY_AND_CHECK( usecustomxmin ); // 6,3
COPY_AND_CHECK( usecustomxmax ); // 7,4
COPY_AND_CHECK( m_parameters ); // 8,5
COPY_AND_CHECK( dmin ); // 5,1
COPY_AND_CHECK( dmax ); // 6,2
COPY_AND_CHECK( usecustomxmin ); // 7,3
COPY_AND_CHECK( usecustomxmax ); // 8,4
COPY_AND_CHECK( m_parameters ); // 9,5
// handle equations separately
for ( int i = 0; i < eq.size(); ++i )
......@@ -685,10 +686,10 @@ PlotAppearance & Function::plotAppearance( PMode plot )
return f0;
case Function::Derivative1:
return f1;
case Function::Derivative2:
return f2;
case Function::Derivative3:
return f3;
case Function::Integral:
return integral;
}
......@@ -708,6 +709,8 @@ PlotAppearance Function::plotAppearance( PMode plot ) const
return f1;
case Function::Derivative2:
return f2;
case Function::Derivative3:
return f3;
case Function::Integral:
return integral;
}
......@@ -1110,6 +1113,10 @@ void Plot::differentiate()
break;
case Function::Derivative2:
plotMode = Function::Derivative3;
break;
case Function::Derivative3:
qWarning() << "Can't handle this yet!\n";
break;
}
......@@ -1135,6 +1142,10 @@ void Plot::integrate()
case Function::Derivative2:
plotMode = Function::Derivative1;
break;
case Function::Derivative3:
plotMode = Function::Derivative2;
break;
}
}
......@@ -1175,6 +1186,8 @@ int Plot::derivativeNumber( ) const
return 1;
case Function::Derivative2:
return 2;
case Function::Derivative3:
return 3;
}
qWarning() << "Unknown derivative number.\n";
......
......@@ -430,6 +430,7 @@ class Function
Derivative0,
Derivative1,
Derivative2,
Derivative3,
Integral
};
......@@ -575,6 +576,7 @@ class Function
PlotAppearance f0; ///< The actual function - the "zero'th derivative"
PlotAppearance f1; ///< First derivative
PlotAppearance f2; ///< Second derivative
PlotAppearance f3; ///< Third derivative
PlotAppearance integral; ///< integral
};
......
......@@ -2520,7 +2520,7 @@ bool View::findRoot( double * x, const Plot & plot, RootAccuracy accuracy )
Equation * eq = plot.function()->eq[0];
DifferentialState * state = plot.state();
double h = qMin( m_xmax-m_xmin, m_ymax-m_ymin ) * 1e-5;
double h = qMin( m_xmax-m_xmin, m_ymax-m_ymin ) * 1e-4;
double f = value( plot, 0, *x, false );
int k;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment