

Simplifying symbolic expressions, including assumptions and additional options. Extract Numerators and Denominators of Rational Expressions. This could be due to complexity in the simplification process, or it could still be a safety concern, since I could at any point clear the assumption, and the equality would no longer hold. Several functions are available to manipulate expressions. The last Sage interact illustrates the circular function definitions of the six trigonometric functions. After the assumption is made that cos(x) ~= 0, MATLAB properly stated that tan(x) = sin(x)/cos(x) is true, yet it still didn't simplify the expression. The second result was surprising, though. % Place restriction on cos(x), and re-test MATLAB's behaviorĪs expected, it didn't simplify the function the first time because cos(x) may equal zero. % Define the function, and test MATLAB's behavior % Create the symbolic variable and remove all assumptions placed on it. Try sind, or atan2d for the degree versions of sin. Out of curiosity, I ran the following script: clc, clear MATLAB conveniently defines versions of the common trig functions which take and produce values in degrees. TRIG FUNCTIONS AND THEIR INVERSES Electrical engineers frequently use trigonometric functions, especially cosines, to represent signals. Therefore, at those values, tan(x) ~= sin(x)/cos(x). When x is in the set described above, it means cos(x) = 0, and sin(x)/cos(x) causes a division by zero error, whereas tan(x) approaches a value of inf. > tan (pi/4) ans 1.0000 You can use the functions deg2rad and rad2deg to convert between radians and degrees.

simplify(tan(x) = sin(x) / cos(x))īut instead, it returns ~x in Dom::ImageSet(pi*(k + 1/2), k, Z_) Trig Functions Like Excel, and most other programming environments, trig functions in MATLAB work with radians. On that note, I'd expect the line below to also return TRUE. Look at this simple example: simplify(x=x) % Returns symbolic "TRUE"

7.5 Trigonometric Functions & Their Inverses: cos, acos, sin 7.6 Setting Nothing, Zeros. The issue here can be shown if you try to simplify your equality. 7.4 Hyperbolic Functions & Their Inverses: cosh, sinh, tanh, etc. Most of the simplifications you want MATLAB to do will happen when you call simplify, but the one you've posted has a minor problem. The symbolic toolbox can do some incredible simplifications, including those that use trigonometric functions.
