Can someone recommend some reading or direct tips on writing long/complicated math expressions in Julia code?
What to do if something is too long to fit on one line?
What to do if something has too many parentheses to be readable? Is there a way to get larger parentheses (like in latex) or use or delimiters like brackets?
Are there good ways to substitute a variable for a complex and frequently repeated expression? obviously, this can be done if the expression is just constant, but if there are variables inside the expression it gets tricky.
I’m not gonna give examples because I’m asking for general tips on this sort of thing or if there is a style guide to read. Thanks
Most of these points can probably be addressed by splitting your expression into multiple smaller functions. Different sized delimeters would be a feature of your text editor/IDE (though I haven’t heard of an editor with that option). I like rainbow delimeters, which colors each matching pair.
As for long expressions, you can break lines anywhere that Julia won’t think the expression is complete. So
x = x^2 + x + 1
is equivalent to
x = x^2 +
x +
1
but
x = x^2
+ x
+ 1
will be interpreted as three separate expressions.