5 ms·
Hilbert: A Latex-like math-oriented programming language
- fdej 12y agoS(log(x)dx)[0..1] => - oo It's not very convincing when one of your examples is mathematically wrong (the integral should be -1).
- roryokane 12y agoLink to confirm that the integral should be -1: http://www.wolframalpha.com/input/?i=integral+of+%28log%28x%29+dx%29+from+0+to+1 http://www.wolframalpha.com/input/?i=integral+of+%28log%28x%... Edit: GitHub Issue filed at https://github.com/gogotanaka/Hilbert/issues/60 https://github.com/gogotanaka/Hilbert/issues/60.
- deleted 12y ago[deleted]
- perlgeek 12y agoAlso writing infinity as oo is questionable, IMHO. Use Inf or Infinity or ∞.
- chestervonwinch 12y agoI 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.
- rnhmjoj 12y agoIt's wrong even in the tests: https://github.com/gogotanaka/Hilbert/blob/master/test/interpreter/test_integral.rb https://github.com/gogotanaka/Hilbert/blob/master/test/inter...
- chris_wot 12y agoUmmmm... what is TURE?
- roryokane 12y agoI made a pull request that fixes that typo: https://github.com/gogotanaka/Hilbert/pull/58 https://github.com/gogotanaka/Hilbert/pull/58
- tpaksoy 12y agoYou along with 7 others it seems. They didn't even bother checking whether a PR was already filed for it.
- unwind 12y agoIt's a first name in Sweden, which sometimes makes me smile when doing that particular typo. Something about suddenly SCREAMING someone's name right in the middle of the code feels like a (harmless, virtual) version of Tourette's. :) Of course no disrespect meant to people who actually suffer from that.
- clintonc 12y agoThe 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/interpreter/test_integral.rb#L9 https://github.com/gogotanaka/Hilbert/blob/master/test/inter... 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/interpreter/test_limit.rb#L11 https://github.com/gogotanaka/Hilbert/blob/master/test/inter... (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/hilbert/world.rb#L50 https://github.com/gogotanaka/Hilbert/blob/master/lib/hilber... 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.
- gus_massa 12y agolim[x->0] 1/x => oo This is one of the grey areas of the mathematical notation. When you are teaching this, you should confirm that the other teachers are using the same notation. I usually use oo as "I don't care about the sign infinity", so with the notation I use this is correct. For the positive infinity I use +oo and for the negative infinity I use -oo. So lim[x->0+] => +oo lim[x->0-] => -oo Nevertheless, I don't know if the difference between oo, +oo and -oo is implemented in this language.
- jackmaney 12y agoCan you point to a single reference anywhere dealing with calculus on the reals that is lazy enough to use infinity as "meh, I don't care if it's positive or negative infinity"? Even one? I've never seen it, and I've taught calculus to college students for nine years.
- moomin 12y agoIf you really want to program mathematics, look at Coq, Agda or Idris.
- tel 12y agoWell, 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 12y agoIt'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...
- marktangotango 12y agoFortress[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_language%29 http://en.wikipedia.org/wiki/Fortress_%28programming_languag...
- jackmaney 12y agoIt 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/1750822d0577e69ab3784d635402cf87474e6f9f/lib/hilbert/lexer/main_lexer.rb#L25 https://github.com/gogotanaka/Hilbert/blob/1750822d0577e69ab... ). 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 12y agoI 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 12y agoW...why would that not automatically be called?
- roryokane 12y ago> It would appear as though the repo owner is no longer accepting new issues (the "Submit new Issue" button is greyed out). The button on https://github.com/gogotanaka/Hilbert/issues/new https://github.com/gogotanaka/Hilbert/issues/new is enabled for me now, and was enabled yesterday too. I think you forgot to fill in the title of the issue as well as the body – the button stays grayed out if you don’t have a title. I posted that issue for you at https://github.com/gogotanaka/Hilbert/issues/69 https://github.com/gogotanaka/Hilbert/issues/69.