Hacker News new | past | comments | ask | show | jobs | submit login

From "STEM formulas" https://news.ycombinator.com/item?id=36839748 :

> latex2sympy parses LaTeX and generates SymPy symbolic CAS Python code (w/ ANTLR) and is now merged in SymPy core but you must install ANTLR before because it's an optional dependency. Then, sympy.lambdify will compile a symbolic expression for use with TODO JAX, TensorFlow, PyTorch,.

  mamba install -c conda-forge sympy antlr # pytorch tensorflow jax  # jupyterlab jupyter_console
https://news.ycombinator.com/item?id=36159017 : sympy.utilities.lambdify.lambdify() , sympytorch, sympy2jax



But then add tests! Tests for LaTeX equations that had never been executable as code.

There are a number of ways to generate tests for functions and methods with and without parameter and return types.

Property-based testing is one way to auto-generate test cases.

Property testing: https://en.wikipedia.org/wiki/Property_testing

awesome-python-testing#property-based-testing: https://github.com/cleder/awesome-python-testing#property-ba...

https://github.com/HypothesisWorks/hypothesis :

> Hypothesis is a family of testing libraries which let you write tests parametrized by a source of examples. A Hypothesis implementation then generates simple and comprehensible examples that make your tests fail. This simplifies writing your tests and makes them more powerful at the same time, by letting software automate the boring bits and do them to a higher standard than a human would, freeing you to focus on the higher level test logic.

> This sort of testing is often called "property-based testing", and the most widely known implementation of the concept is the Haskell library QuickCheck, but Hypothesis differs significantly from QuickCheck and is designed to fit idiomatically and easily into existing styles of testing that you are used to, with absolutely no familiarity with Haskell or functional programming needed.

Fuzzing is another way to auto-generate tests and test cases; by testing combinations of function parameters as a traversal through a combinatorial graph.

Fuzzing: https://en.wikipedia.org/wiki/Fuzzing

Google/atheris is based on libFuzzer: https://github.com/google/atheris

Clusterfuzz supports libFuzzer and APFL: https://google.github.io/clusterfuzz/setting-up-fuzzing/libf...




Join us for AI Startup School this June 16-17 in San Francisco!

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: