|
From: njh <nj...@nj...> - 2008-05-18 19:18:58
|
On Sun, 18 May 2008, Maximilian Albert wrote:
> Hi,
>
> shouldn't valueAndDerivatives() and derivative() do a similar job? The
> following two pieces of code [1] behave very differently for me:
Out of curiosity, do you get the right result when the 2 becomes a 3? If
so I think the bug is actually in
double SBasis::valueAndDerivative(double t, double &der) const {
The problem is that the approach used for the general case in
SBasis::valueAndDerivatives (iteratively computing the derivative sbasis
and evaluating at the point) is correct, but relatively slow (involving
lots of mallocing, e.g) where as the approach in
SBasis::valueAndDerivative tried to evaluate the derivative 'for free' by
tacking onto the calcs for the pointAt. But apparently it is wrong :(
There is a general n derivatives algorithm for polynomials, and I see no
strong reason that it wouldn't work for sbasis; but nobody ever did it...
I'll sit down and try and work it out now, but no promises.
njh
|