[kde-edu]: Review Request: KAlgebra: avoid the calculation of derivatives for draw tangents

Percy Camilo Triveño Aucahuasi percy.camilo.ta at gmail.com
Mon Jan 3 22:14:26 CET 2011


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://svn.reviewboard.kde.org/r/6268/
-----------------------------------------------------------

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/d9acea24/attachment.htm 


More information about the kde-edu mailing list