ghollisjr / cl-ana

Free (GPL) Common Lisp data analysis library with emphasis on modularity and conceptual clarity.
GNU General Public License v3.0
197 stars 18 forks source link

problem in drawing log function #41

Open wxie2017 opened 3 years ago

wxie2017 commented 3 years ago

Hi, Thanks for making this tool.

I find that

(cl-ana::draw #'log)

output a straight line, which is not correct.

Please check the attached pdf. draw-log.pdf

ghollisjr commented 3 years ago

Hey sorry for the delay! This is unfortunately something I'm not sure how to handle in a reasonable way. Gnuplot understands how to automatically adjust function sampling given special functions like logarithms which have holes in their domain, but for Gnuplot to know what you're trying to plot, you have to use the text version.

E.g., if you do

(cl-ana::draw "log(x)")

then Gnuplot will know to not include 0 in the domain. However, whenever you want to manually draw a function which has holes in its domain, you will have to manually control the domain. In this case, something like

(cl-ana::draw (line #'log :sampling (list :low 1d-5 :high 3d0 :nsamples 1000)))

would do the trick.

ghollisjr commented 3 years ago

I might be able to fix this by adding a filter step before sending data to Gnuplot so that Lisp isn't sending NaNs or infinities.

wxie2017 commented 3 years ago

Thank you, Gary.

The workaround is good. I will follow that.

On 2021/1/15 下午11:49, Gary Hollis wrote:

I might be able to fix this by adding a filter step before sending data to Gnuplot so that Lisp isn't sending NaNs or infinities.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ghollisjr/cl-ana/issues/41#issuecomment-761020750, or unsubscribe https://github.com/notifications/unsubscribe-auth/AHJFY5OVZEOEDMHB3C3AQ5TS2BPZJANCNFSM4V3JRPBA.