Reputation: 13
I am trying to expand log expression with octave like that:
expand(log(x^2))
to get 2 * log(x)
but that doesn't work That works with matlab when making:
expand(log(x^2),'IgnoreAnalyticConstraints',true)
but octave doesn't recognise it.
Any idea how to make it with octave?
Upvotes: 1
Views: 76
Reputation: 22245
You need to specify that x is a positive variable first.
pkg load symbolic
x = sym('x', 'positive' );
expand( log( x ^ 2 ) ) % ans = (sym) 2⋅log(x)
Upvotes: 1