4 ms·
A DSL for Implementing Math Functions
- pavpanchekha 2y agoOne of the authors, happy to answer questions!
- deleted 2y ago[deleted]
- gerdesj 2y agoMy first impression is ... why not format your maths? You don't write: "asin(x) = pi/2 - 2 asin(sqrt((1-x)/2))" on a blackboard. I'm a bit slow at the best of times but translating maths from computer code to abstract concepts is not easy for me. Yes, I can mentally substitute pi for pi but please put a pi on the page (it looks like a ... pi) ... Π Whilst you are at it an arcsine is sin^-1 (or an arcsine). "asin" doesn't cut it 8)
- pavpanchekha 2y agoThe blog post (a summary of a research paper) is targeted at PL researchers, and the mathematical notation would probably not add clarity.
- tzs 2y ago> Yes, I can mentally substitute pi for pi but please put a pi on the page (it looks like a ... pi) ... Π Uhm...Π is an upper case pi, which is the symbol for the product operator. For the symbol for the mathematical constant you want lower case pi, π. That's an easy mistake to make on HN because HN asks for Verdana for the body of the page and for some unfathomable reason the designer of Verdana decided to make lower case pi just be a smaller version of upper case pi, so if you don't notice that you entered the product symbol instead of the symbol for the constant while in the comment editor there is a good chance you won't notice when you do a final proofread of the posted comment. For reference here is the Greek alphabet, upper and lower case, in a code block which renders in something other than Verdana followed by the same thing not in a code block to show what Verdana does to Greek letters: Α α, Β β, Γ γ, Δ δ, Ε ε, Ζ ζ, Η η, Θ θ, Ι ι, Κ κ, Λ λ, Μ μ, Ν ν, Ξ ξ, Ο ο, Π π, Ρ ρ, Σ σ/ς, Τ τ, Υ υ, Φ φ, Χ χ, Ψ ψ, Ω ω Α α, Β β, Γ γ, Δ δ, Ε ε, Ζ ζ, Η η, Θ θ, Ι ι, Κ κ, Λ λ, Μ μ, Ν ν, Ξ ξ, Ο ο, Π π, Ρ ρ, Σ σ/ς, Τ τ, Υ υ, Φ φ, Χ χ, Ψ ψ, Ω ω Besides pi I'm not pleased by Verdana's lower case alpha, iota, nu, tau, chi, or psi but none of those are as annoying as its pi.
- AdieuToLogic 2y agoI have what may be an obvious question; by "A DSL for Implementing Math Functions", is it specifically a Python one? From the article: Note that the syntax here looks like Python. It actually is Python; MegaLibm is a DSL embedded in Python making heavy use of operator overloading.
- pavpanchekha 2y agoYou write programs in the DSL in Python code; the actual executed library functions are in C.
- AdieuToLogic 2y agoDanke :-)
- saboot 2y agoCan this be used to help design math functions for FPGA designs, using VHDL or Verilog?
- pavpanchekha 2y agoNot immediately but it would be cool to integrate this with tools like flopoco that address that more directly.
- porker 2y agoThis looks a cool project and it's a shame to see the code already has broken dependencies. Was funding the reason this project wasn't carried on, or was it designed to be a PhD project only?
- pavpanchekha 2y agoIn general it's hard to carry on projects after the main author leaves. The plan is to fold many of the capabilities into Herbie over time.
- js8 2y agoI have an idea, we could call it FORTRAN, as in "formula translator", get it? Seriously though, creating DSLs is the essence of (understandable) programming. You create abstractions away from machine code towards your problem domain. Every program, thus, is more or less a DSL for what it can do.
- endgame 2y agoReminds me a bit of "Let's Program a Calculus Student": https://iagoleal.com/posts/calculus-symbolic/ https://iagoleal.com/posts/calculus-symbolic/