Closed jolyonb closed 6 years ago
Here's some of the replacements we want:
conj(...)
-> {:(...)^*:}
with option settrans(...)
-> {:(...)^T:}
adj(...)
-> {:(...)^dagger:}
ctrans(...)
-> {:(...)^dagger:}
cross(..., ...)
-> (...) times (...)
[a,b,c]
-> [[a],[b],[c]]
with option set if a, b, and c don't have square brackets in themfact(...)
and factorial(...)
-> factorialAsciiMath((...))
Here's the dagger symbol definition:
// Add the dagger symbol, used in Hermitian conjugate/adjoint
AM.newsymbol({input:"dagger", tag:"mi", output:"\u2020", tex:null, ttype:AM.TOKEN.CONST});
In all cases, single character entries should not have parentheses. That includes all entries in this list:
['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'alpha', 'beta', 'chi', 'delta', 'Delta', 'epsi', 'varepsilon', 'eta', 'gamma', 'Gamma', 'iota', 'kappa', 'lambda', 'Lambda', 'lamda', 'Lamda', 'mu', 'nu', 'omega', 'Omega', 'phi', 'varphi', 'Phi', 'pi', 'Pi', 'psi', 'Psi', 'rho', 'sigma', 'Sigma', 'tau', 'theta', 'vartheta', 'Theta', 'upsilon', 'xi', 'Xi', 'zeta']
Note that we should also let hat
or vec
prepend any item in this list.
After #116, the only features I don't have a good way to implement are the following two:
cross(..., ...)
-> (...) times (...)
[a,b,c]
-> [[a],[b],[c]]
with option set if a, b, and c don't have square brackets in themBoth of these need splitList
to work.
I'll work on splitList
. Another thing I have been thinking about is some minor validation. In particular, I think that the callback actions toreplaceFunctionCall
should verify that they have received the correct number of arguments.
This isn't an issue now (since with splitList
not implemented, args
is always a list of length 1). But once we have splitList
, our current implementation of factorial
would render fact(3, 4)
as 3!
(completely ignoring the 4). So I want to throw errors unless the correct number of arguments has been received. That way:
fact(5) ---> 5!
fact(5, 6) ---> fact(5, 6)
That sounds look a good idea.
Resolved by #116 and #118.
These are the new functions that we've introduced that don't have a corresponding function in AsciiMath:
trace
: needs AsciiMath definition (done in #111)trans
,ctrans
,adj
,cross
: needs preprocessingconj
: needs an option to write as(...)^*