During Sage Days 9 I worked on three different projects. I finished two of them but I will only talk about one of them here.
The first one was to improve the rendering of plots in Sage. I implemented a better algorithm to insert additional points to the linear approximation of curves.
In all of the examples below, text looking like this:
|
|
|
|
|
|
|
|
If you have points A and B which are part of the sampled points on the curve, the approximation would be the line in green. The current algorithm would compute the difference between the y-coordinates of A and B. If it exceeds a certain threshold (which is 0.1 by default), then it adds the point C. It then repeats this procedure with C and B but not A and C. Otherwise it just proceeds to B and the next point. After having added some fixed number of points in this way (by default 10000), it just stops adding any more points.
|
|
If you have points A and B which are part of the sampled points on the curve, the approximation would be the line in green. The new algorithm would compute the point C and the y-coordinate difference between C and D. If it exceeds a certain threshold (which depends on the interval of x and the number of points), then it adds the point D. It then repeats recursivly this procedure with A, D and D, B. Otherwise it just proceeds to B and the next point. After having descended a certain number of recursion levels (5 by default) it stops recursing.
|
|
|
|
This means that if you start at a singularity, you still get an idea of the plot aspect. But since we used so little points this plot still looks bad. If we increase the adaptive_recursion factor, then it looks really good.
|