[kde-edu]: Re: Review Request: KAlgebra: avoid the calculation of derivatives for draw tangents
Percy Camilo Triveño Aucahuasi
percy.camilo.ta at gmail.com
Tue Jan 4 00:54:22 CET 2011
> On 2011-01-03 22:06:38, Aleix Pol wrote:
> > Regarding explicit plots, as I said to you I think it's good to stick with symbolic derivation because it highlights the missing features. Note that the printed slope is just visual sugar but not any extracted information.
> > That leads to my next point: it makes no sense to add the new interface to function.h, the slope should be given 1 point, not an interval. You're extracting it from the last mouse position, that's not what we are providing semantically.
> >
> > If the only way to provide a slope for implicit plots is to draw a line across the two closer points, that should be done in functionimplicit.cpp exclusively. (you can get the last position received by saving it in ::calc, for instance)
As you say, the same idea behind the patch could be apply only on functionimpl*, what I'm saying is that is not necesary to have a high and complex way to do this "visual suguar", if we can do this with less operations, fastter and more robust, then there is no need to stick to the idea to calculate the derivatives and employ numerical methods instead a couple of operactiones.
Please note that with polar and parametric curves will be more difficult to draw a tangent line using derivatives, it would be more easy and fast through a geometrically approach ... this isn't an improvement only for implicit curves, but all the plane curves.
If is need it, I can try to port the same patch on functionimpl*, in any case isn't a matter of where to place this code, we can work on this subject ;)
Percy
- Percy Camilo
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/6268/#review9497
-----------------------------------------------------------
On 2011-01-03 21:14:26, Percy Camilo Triveño Aucahuasi wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> http://svn.reviewboard.kde.org/r/6268/
> -----------------------------------------------------------
>
> (Updated 2011-01-03 21:14:26)
>
>
> Review request for KDE-Edu, Aleix Pol and Percy Camilo Triveño Aucahuasi.
>
>
> Summary
> -------
>
> Currently KAlgebra needs to calculate the derivative of the function for draw its tangent line, this calculation is done each time the mouse is moving inside the 2d area. The drawbacks for this method are:
>
> - KAlgebra can't draw the tangent on any case, becouse the parser doesn't know how to calculate the derivative for all types of functions and operators.
> - The derivative of many functions can't be calculated becouse the function could have a singular point or may be non-smooth.
> - This approach need to use numerical methods, so the complexity (and time) for such a simple task like draw the tangent, is the combination of 2 opperations: calculate the derivative and apply a numerical method to find the tangent ... if the derivative fails then the numerical method will fail.
> - Fails for implicit curves.
>
> This patch made possible to calculate the line tangent by a simple geometric method, the pros over the current state are:
>
> - It works on any case, even if the parser can't obtain/evaluate the derivative.
> - Doesn't need numerical methods.
> - The complexity and the time would be: two subtractions and one division ...
> - It works for implicit curves or even if the function have a singular point or isn't smooth.
>
> This patch doesn't add new features but improves the behaviour and scope of KAlgebra ;)
>
> Cheers,
> Percy ;)
>
>
> Diffs
> -----
>
> /trunk/KDE/kdeedu/kalgebra/analitzagui/function.h 1211228
> /trunk/KDE/kdeedu/kalgebra/analitzagui/function.cpp 1211228
> /trunk/KDE/kdeedu/kalgebra/analitzagui/functionimpl.h 1211228
> /trunk/KDE/kdeedu/kalgebra/analitzagui/functionimpl.cpp 1211228
> /trunk/KDE/kdeedu/kalgebra/analitzagui/functionsmodel.h 1211228
> /trunk/KDE/kdeedu/kalgebra/analitzagui/functionsmodel.cpp 1211228
> /trunk/KDE/kdeedu/kalgebra/analitzagui/graph2d.h 1211228
> /trunk/KDE/kdeedu/kalgebra/analitzagui/graph2d.cpp 1211228
>
> Diff: http://svn.reviewboard.kde.org/r/6268/diff
>
>
> Testing
> -------
>
> (x, y)->x-y^sin(y)
> power(x, sin(x))
>
>
> Screenshots
> -----------
>
> implicitcurve
> http://svn.reviewboard.kde.org/r/6268/s/601/
>
>
> Thanks,
>
> Percy Camilo
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kde-edu/attachments/20110103/72d79eec/attachment.html
More information about the kde-edu
mailing list