
Security News
CISA’s 2025 SBOM Guidance Adds Hashes, Licenses, Tool Metadata, and Context
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
== Calculus
Calculus is utility library which allow to parse some subset of latex equations and store them in {Postfix notation}[http://en.wikipedia.org/wiki/Reverse_Polish_notation] It also allows translate it to {Abstract syntax tree}[http://en.wikipedia.org/wiki/Abstract_syntax_tree] and calculate (implemented for simple expressions).
Build status: {}[http://travis-ci.org/avsej/calculus]
== Installation
gem install calculus
== Examples
001:0> require 'calculus' true 002:0> exp = Calculus::Expression.new("2 + 3 * x") #<Expression:f46e77a9377ed2d5a9da768496a7e1c20be51bfe postfix_notation=[2, 3, "x", :mul, :plus] variables={"x"=>nil}> 003:0> exp.postfix_notation [2, 3, "x", :mul, :plus] 004:0> exp.abstract_syntax_tree [:plus, 2, [:mul, 3, "x"]] 005:0> exp.variables ["x"] 006:0> exp.unbound_variables ["x"] 007:0> exp["x"] = 5 5 008:0> exp.unbound_variables [] 009:0> exp.calculate 17
You can also render expression to PNG image if you have latex and dvipng installed.
010:0> Calculus::Expression.new("2 + 3 \cdot x").to_png "/tmp/d20110512-16457-dhxt71/f46e77a9377ed2d5a9da768496a7e1c20be51bfe.png"
{2 + 3 \cdot x}[http://files.avsej.net/exp1.png]
Also you can skip parser if you need only png generation 011:0> Calculus::Expression.new("\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x)\ e^{- 2\pi i x \xi}\,dx", :parse => false).to_png
{\hat{f}(\xi) = \int_{-\infty}^{\infty} f(x)\ e^{- 2\pi i x \xi},dx}[http://files.avsej.net/exp2.png]
Don't forget to cleanup file after using.
== Hacking
Just fork and pull request.
FAQs
Unknown package
We found that calculus demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
CISA’s 2025 draft SBOM guidance adds new fields like hashes, licenses, and tool metadata to make software inventories more actionable.
Security News
A clarification on our recent research investigating 60 malicious Ruby gems.
Security News
ESLint now supports parallel linting with a new --concurrency flag, delivering major speed gains and closing a 10-year-old feature request.