Physics Derivation Graph navigation Sign in

operators syntax: macros instead of abstract syntax trees

Published 2020-05-09T16:01:00.004Z by Physics Derivation Graph

Currently the JSON file has a set of named operators with the attributes "argument count", "latex", "scope". The "argument count" is a non-negative integer and the "scope" is a list with elements like real, complex, vector, matrix. integer.

What's missing is the AST structure that defines where the arguments go with respect to the operator. For example,
x + y
is valid while
x y +
is not.

cos x
is valid while
x cos
is not.

While I can state these concepts I don't know how to formalize the notation.
For example, a definite integral takes 4 arguments in a specific location:
int_x^y f(z) dz

I could express operators using a latex macro

\usepackage[dvipdfmx,colorlinks=true,pdfkeywords={physics derivation graph}]{hyperref}
\newcommand\addition[2]{ #1 + #2}
\newcommand\subtraction[2]{ #1 - #2}
\newcommand\divisionSameLine[2]{ #1 / #2 }
\newcommand\divisionFrac[2]{ \frac{ #1}{ #2} }
\newcommand\integralDefinite[4]{ \int_{ #1}^{ #2} #3 #4}
\newcommand\addXtobothsides[3]{Add $#1$ to both sides of Eq.~\ref{eq:#2}; yields Eq.~\ref{eq:#3}.}
\title{Lorentz transformation}
This is the abstract





Compile to PDF using

latex runthis.tex 
latex runthis.tex 
dvipdfmx runme.dvi