mirror of
https://github.com/Brandon-Rozek/website.git
synced 2024-12-23 14:02:07 +00:00
2 KiB
2 KiB
id | title | date | author | layout | guid | permalink | medium_post | mf2_syndicate-to | mf2_cite | tumblr_post_id | mf2_syndication | format | kind | ||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
2115 | Simplifying Expressions with Octave | 2017-03-09T02:09:58+00:00 | Brandon Rozek | post | https://brandonrozek.com/?p=2115 | /2017/03/simplifying-expressions-octave/ |
|
|
|
|
|
aside |
|
Octave is a high level programming language intended for numerical computations. One of the cool features of this is that with symbolic expressions, you can then simplify mathematical expressions.
Setup
First install Octave and the symbolic package using the website or your package manager of choice.
Then in octave type in the following code
pkg load symbolic
Usage
For every variable not defined earlier in your expression, make sure to declare it as a symbolic data type
syms x y
Then make an expression
expr = y + sin(x)^2 + cos(x)^2
You can then ask Octave to simplify the expression for you
simp_expr = simplify(expr)
Displaying it shows it as
(sym) y + 1
Which is indeed a simplification using a trig identity 🙂