On Friday, October 10, 2014 3:44:53 PM UTC, Erik Schnetter wrote: > > > What do you mean by "constructor for symbolic manipulation"? Julia > does support symbolic manipulation; this is e.g. used in macros, and > there is a class "Expr" that holds unevaluated expressions. However, > there are no built-in functions in Julia e.g. for differentiation or > simplification of such expressions as you would find in a computer > algebra system. >
I am not quite sure if quotes are good for symbolic manipulation anyways. I mean, if you are just working on formulas with scalar variables, they are OK. But what if you introduce vectors and matrices in your expression tree? For scalars :(a*b) and :(b*a) are equivalent, but generally not for matrices. In Wolfram Mathematica they use two distinct operators to overcome this problem, Times[ ] for the ordinary (commutative) product, Dot[ ] for the matrix multiplication (non-commutative). Julia overloads the common operators (:+, :*, :^, etc...) based on the type of their arguments, but once you get the quote :(a*b) you lose the information about the types of *a* and *b*, so how can you apply simplification operations if you don't know what the mathematical correspondence of *:** is? Wolfram Mathematica basically defines three attributes on the expression nodes: - OneIdentity: meaning that the node is an identity if it has just one parameter (e.g. :(+(a)) ===> :a ) - Flat: meaning that the node is associative (e.g. :(a+(b+c)) ===> :(+(a, b, c)) ) - Orderless: meaning that the order of the children of a node does not matter, i.e. the operator is commutative wrt its arguments (e.g. :(a+b) == :(b+a) ) The first two are easy to apply to Julia's quotes, the *Orderless* attribute is a more serious problem.