Qalculate / libqalculate

Qalculate! library and CLI
https://qalculate.github.io/
GNU General Public License v2.0
1.81k stars 146 forks source link

use qthsh code to integrate value #688

Open BenderBlog opened 1 month ago

BenderBlog commented 1 month ago

I believe it is a "unexpected behaviour":

> integrate(1/sqrt(1-x^2))

  integrate(1 / sqrt(1 − x²)) = −i × ln(i × √(1 − x²) − x) + C

> integrate(1/sqrt(1-x^2),-1,1)

  warning: Unable to integrate the expression.
  integrate(1 / sqrt(1 − x²), −1, 1) = ∫(1 / √(1 − x²), −1, 1)

Since its answer is pi, I believe the author could use this code to give an numeric answer, rather a "Unable to integrate" false...

I tried to port it to another calculator, kalker, and it works pretty well. Ref. here here.

hanna-kn commented 1 month ago

It is a safe-guard against invalid results which fails. integrate(1/sqrt(1-x^2),-0.9999999,0.9999999) works properly. I will investigate this closer.