rabauke / harbour-babbage

Scientific calculator for Sailfish OS
BSD 3-Clause "New" or "Revised" License
4 stars 1 forks source link

add graphing, D3js #6

Open poetaster opened 1 year ago

poetaster commented 1 year ago

I've recently looked at adding graphing to babbage. In https://github.com/poetaster/matrixcalc which is merely a noarch release of https://openrepos.net/content/fruct/matrix-calculator there are a number of functions which use a plotter based on D3js that draw plots using the canvas.

This works quite well but is limited in that case to functions for plotting being declared for each case instead of abstracted. I was looking at some methods ( a simple case being https://pavpanchekha.com/blog/plotting-d3.html) and wanted to ask how you might go about this? I'll take a crack at it and, should I get a 'more or less' generic method running.

rabauke commented 1 year ago

Thanks for drawing my attention to matrix calc. I did consider to add plotting functionalities to Babbage. Though, I think implementing a robust and flexible plotting feature is rather non-trivial. There are many edge cases to consider, e.g., poles and discontinuities. Thus, due to the lack of time and due to the complexity of the task I did not actually tried to implement graphing for Babbage but it might be reconsidered in the future.

poetaster commented 1 year ago

Thanks for drawing my attention to matrix calc. I did consider to add plotting functionalities to Babbage. Though, I think implementing a robust and flexible plotting feature is rather non-trivial. There are many edge cases to consider, e.g., poles and discontinuities. Thus, due to the lack of time and due to the complexity of the task I did not actually tried to implement graphing for Babbage but it might be reconsidered in the future.

I'll see if I can implement a view for the limited cases which are 'simple', ie. functions like sin. Perhaps if I make an initial attempt you may be able to evaluate it. Thanks!

poetaster commented 1 year ago

Just a note that I've built a sort of plotting prototype which simplifies the use of d3 and demonstrates directly graphing function strings in 'cartesian', 'parametric' and 'polar' form. It's partly derived from matrixcalc, although the actual function evaltuation is not. It's part of my effort to integrate plotting in other math apps. https://github.com/poetaster/Plotter