[kde-edu]: Re: Review Request: KAlgebra: avoid the calculation of derivatives for draw tangents
Aleix Pol
aleixpol at kde.org
Mon Jan 3 23:06:36 CET 2011
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/6268/#review9497
-----------------------------------------------------------
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)
- Aleix
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/350abb22/attachment.htm
More information about the kde-edu
mailing list