How do I get powers of a trig function in Math.net?
Expr x = Expr.Variable("x");
Expr g = (2 * x).Sinh().Pow(2);
g.ToString()
gives the output: (sinh(2*x))^2
What I want is sinh^2(2*x)
How do I do that?
Edit:
As per Christoph's comment below this can be done in v0.21.0 which implements Expr.ToCustomString(true)
It does not currently support this notation. However, I see three options:
This is something I do not wish to do.
This is something we likely want to explore at some point, but this is a larger topic, and likely overkill for what you need.
This is something which we could implement.
Option 3 would save one set of parentheses in such expressions, which would lead to a more compact rendering, especially also for the LaTeX formatter where the result would be more readable. When building a visual expression from an expression, it would automatically pull positive integer powers to the applied function.
To my understanding your concern is only about how it is printed, so it seems to me this would solve your problem as well?