JuliaSymbolics / SymbolicUtils.jl

Symbolic expressions, rewriting and simplification
https://docs.sciml.ai/SymbolicUtils/stable/
Other
524 stars 99 forks source link

Add more trig identities #560

Open derikk opened 8 months ago

derikk commented 8 months ago

Now we can have simplify(1 - sin(x)^2) == cos(x)^2 instead of just simplify(sin(x)^2 - 1) == -(cos(x)^2).

Also fixed @acrule(tan(~x)^2 + -1*sec(~x)^2 => one(~x)) by adding a minus sign.

github-actions[bot] commented 8 months ago

Benchmark Results

master 940469be643d9b... t[master]/t[940469be643d9b...]
overhead/acrule/a+2 1.2 ± 0.29 μs 1.2 ± 0.032 μs 1
overhead/acrule/a+2+b 1.19 ± 0.3 μs 1.18 ± 0.025 μs 1.01
overhead/acrule/a+b 0.433 ± 0.0094 μs 0.426 ± 0.013 μs 1.02
overhead/acrule/noop:Int 0.0317 ± 0.0008 μs 0.0321 ± 0.0007 μs 0.988
overhead/acrule/noop:Sym 0.0614 ± 0.01 μs 0.0553 ± 0.0087 μs 1.11
overhead/rule/noop:Int 0.055 ± 0.0021 μs 0.0534 ± 0.0027 μs 1.03
overhead/rule/noop:Sym 0.0684 ± 0.003 μs 0.0691 ± 0.0025 μs 0.991
overhead/rule/noop:Term 0.0686 ± 0.0046 μs 0.0685 ± 0.0019 μs 1
overhead/ruleset/noop:Int 0.199 ± 0.0026 μs 0.2 ± 0.0047 μs 0.998
overhead/ruleset/noop:Sym 0.225 ± 0.0066 μs 0.227 ± 0.0059 μs 0.992
overhead/ruleset/noop:Term 4.99 ± 0.29 μs 5.04 ± 0.3 μs 0.99
overhead/simplify/noop:Int 0.265 ± 0.0089 μs 0.277 ± 0.014 μs 0.957
overhead/simplify/noop:Sym 0.289 ± 0.0041 μs 0.288 ± 0.0045 μs 1
overhead/simplify/noop:Term 0.0506 ± 0.0046 ms 0.0527 ± 0.0047 ms 0.96
overhead/simplify/randterm (+, *):serial 0.182 ± 0.0017 s 0.184 ± 0.0014 s 0.988
overhead/simplify/randterm (+, *):thread 0.126 ± 0.017 s 0.126 ± 0.015 s 0.999
overhead/simplify/randterm (/, *):serial 0.32 ± 0.01 ms 0.326 ± 0.011 ms 0.982
overhead/simplify/randterm (/, *):thread 0.364 ± 0.012 ms 0.371 ± 0.012 ms 0.981
overhead/substitute/a 0.0837 ± 0.0018 ms 0.0828 ± 0.002 ms 1.01
overhead/substitute/a,b 0.0746 ± 0.0048 ms 0.0721 ± 0.0017 ms 1.03
overhead/substitute/a,b,c 25.6 ± 0.9 μs 25.2 ± 0.6 μs 1.02
polyform/easy_iszero 0.044 ± 0.0039 ms 0.0442 ± 0.0043 ms 0.995
polyform/isone 3.7 ± 0.1 ns 3.6 ± 0.1 ns 1.03
polyform/iszero 2.75 ± 0.04 ms 2.76 ± 0.038 ms 0.997
polyform/simplify_fractions 3.73 ± 0.042 ms 3.72 ± 0.045 ms 1
time_to_load 6.27 ± 0.055 s 6.23 ± 0.039 s 1.01

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR. Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).