
Hilbert: A Latex-like math-oriented programming language - atmosx
http://hilbert-lang.org
======
clintonc
The information on the pretty website is spare. However, there are a few
issues which give me pause.

The integral example already given is one. One must wonder what is going on
"under the hood" to give such a result. My hypothesis is that Riemann sums are
what's going on, and that the integral uses 0 as a sample point. An
interesting point is that this is one of the unit tests.
[https://github.com/gogotanaka/Hilbert/blob/master/test/inter...](https://github.com/gogotanaka/Hilbert/blob/master/test/interpreter/test_integral.rb#L9)

Another is the example of lim[x->0] 1/x => oo. This is not true; the limit
does not exist. If one said lim[x->0+] => oo there would be a better case.
Also a unit test.
[https://github.com/gogotanaka/Hilbert/blob/master/test/inter...](https://github.com/gogotanaka/Hilbert/blob/master/test/interpreter/test_limit.rb#L11)

(1 2 3; 4 5 6) * (1 2 3) => (14 32) is not how matrix multiplication is
normally done. ( (1 2 3) would need to be (1; 2; 3).)

All in all, the grammar seems to be quite irregular; it seems to be the result
of a sequence of wanting to solve one very particular kind of problem (take a
limit, differentiate a function, take a sum) and cludging it into the parser.

[https://github.com/gogotanaka/Hilbert/blob/master/lib/hilber...](https://github.com/gogotanaka/Hilbert/blob/master/lib/hilbert/world.rb#L50)
has seven exclamation marks in a row. That's amusing... I don't know anything
about Ruby, but I feel that it must be a joke.

~~~
pfortuny
On the limit issue: you are assuming the x is real. In the complex domain inf
has no sign and the limit is pretty correct. But yes, this depends on
assumptions.

~~~
jackmaney
This is a possible loophole, yes. However, if the repo author intended to work
with functions of a complex variable, then why aren't the integrals in the
README contour integrals?

------
fdej

        S(log(x)dx)[0..1]
        => - oo
    

It's not very convincing when one of your examples is mathematically wrong
(the integral should be -1).

~~~
perlgeek
Also writing infinity as oo is questionable, IMHO. Use Inf or Infinity or ∞.

~~~
chestervonwinch
I believe this notation might be borrowed from SymPy, a symbolic math lib for
python --- not that this justifies it; I don't quite care for it much either.

------
jackmaney
It would appear as though the repo owner is no longer accepting new issues
(the "Submit new Issue" button is greyed out). So, in lieu of submitting a new
issue, here is the issue that I would have opened (in Markdown):

Looking through the README, the first thing that made me balk was the fact
that the limit of `1/x` as `x->0` is __not __infinity. The limit doesn 't
exist! However:

* The limit as x goes to zero _from the right_ of `1/x` is infinity, and

* The limit as x goes to zero _from the left_ of `1/x` is negative infinity.

So, to quickly determine whether or not this was just a documentation issue, I
installed Hilbert ([and eventually
succeeded]([https://github.com/gogotanaka/Hilbert/pull/68](https://github.com/gogotanaka/Hilbert/pull/68)
)) and tried to discover the syntax for one-sided limits:

``` Enjoy! -> lim[x->0+] 1/x

Enjoy! -> ```

Hmmm...no output. Okay. Does any output work?

``` Enjoy! -> 3+2

5

Enjoy! -> ```

Okay, good, we at least have that much... Hmmm...

``` Enjoy! -> lim[x->0^+] 1/x

Enjoy! -> ```

Nope, that's not it, either. Poking at the source code, [it doesn't seem as
though one-sided limits are
implemented]([https://github.com/gogotanaka/Hilbert/blob/1750822d0577e69ab...](https://github.com/gogotanaka/Hilbert/blob/1750822d0577e69ab3784d635402cf87474e6f9f/lib/hilbert/lexer/main_lexer.rb#L25)
).

Well, okay, how about a simpler limit?

``` Enjoy! -> lim[x->0] x+2

Enjoy! -> ```

Uhhh...okay, how about some differentiation?

``` Enjoy! -> d/dx(cos(x))

I'm so sorry, something wrong. Please feel free to report this.

Enjoy! -> ```

This error message is of no use, and I have no idea what's going on, but this
language appears to be broken.

~~~
fmoralesc
I think you need to call `postulate zfc_analysis`. With that, I get:

    
    
        Enjoy! -> lim[x->0] 1/x
        oo
        Enjoy! -> d/dx(cos(x))
        - sin( x )
        Enjoy! -> lim[x->0] x+2
        2.0

~~~
jackmaney
W...why would that not automatically be called?

------
marktangotango
Fortress[1] had stylesheets that allowed rendering mathematical formula. Never
gained much traction needless to say:

>> Fortress is being designed from the outset to have multiple syntactic
stylesheets. Source code can be rendered as ASCII text, in Unicode, or as a
prettied image. This would allow for support of mathematical symbols and other
symbols in the rendered output for easier reading.

[1]
[http://en.wikipedia.org/wiki/Fortress_%28programming_languag...](http://en.wikipedia.org/wiki/Fortress_%28programming_language%29)

------
chris_wot
Ummmm... what is TURE?

~~~
roryokane
I made a pull request that fixes that typo:
[https://github.com/gogotanaka/Hilbert/pull/58](https://github.com/gogotanaka/Hilbert/pull/58)

~~~
tpaksoy
You along with 7 others it seems. They didn't even bother checking whether a
PR was already filed for it.

------
moomin
If you really want to program mathematics, look at Coq, Agda or Idris.

~~~
tel
Well, there's a significant difference there. Hilbert seems aimed at
computational mathematics more in line with Mathematica rather than the
logical foundational work occurring in Coq/Agda/Idris.

~~~
moomin
It'd be nice to achieve both... you wouldn't get some of the silly errors
documented elsewhere in the thread.

Admittedly, that's way more ambitious than anything anyone's actually
implemented, ever...

