Skip to content

Commit 008b591

Browse files
Update README.md
1 parent 598271f commit 008b591

File tree

1 file changed

+40
-1
lines changed

1 file changed

+40
-1
lines changed

README.md

Lines changed: 40 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,43 @@
55
[![Build Status](https://github.com/RafaelArutjunjan/DerivableFunctions.jl/workflows/CI/badge.svg)](https://github.com/RafaelArutjunjan/DerivableFunctions.jl/actions)
66

77

8-
This package provides a front-end for differentiation operations in Julia that allows for code which is agnostic with respect to many of the available automatic and symbolic differentiation tools available in Julia. Moreover, the differentiation operators provided by **DerivableFunctions.jl** are also overloaded to allow for passthrough of symbolic variables. That is, if symbolic types such as `Symbolics.Num` are detected, the differentiation functors automatically switch to symbolic differentiation.
8+
This package provides a front-end for differentiation operations in Julia that allows for code which is agnostic with respect to many of the available automatic and symbolic differentiation tools available in Julia. Moreover, the differentiation operators provided by **DerivableFunctions.jl** are also overloaded to allow for passthrough of symbolic variables. That is, if symbolic types such as `Symbolics.Num` are detected, the differentiation operators automatically switch to symbolic differentiation.
9+
10+
```julia
11+
julia> D = DFunction(x->[exp(x[1]^2 - x[2]), log(sin(x[2]))])
12+
(::DerivableFunction) (generic function with 1 method)
13+
14+
julia> EvalF(D,[1,2])
15+
2-element Vector{Float64}:
16+
0.36787944117144233
17+
-0.09508303609516061
18+
19+
julia> EvaldF(D,[1,2])
20+
2×2 Matrix{Float64}:
21+
0.735759 -0.367879
22+
0.0 -0.457658
23+
24+
julia> EvalddF(D,[1,2])
25+
2×2×2 Array{Float64, 3}:
26+
[:, :, 1] =
27+
2.20728 -0.735759
28+
0.0 0.0
29+
30+
[:, :, 2] =
31+
-0.735759 0.367879
32+
0.0 -1.20945
33+
34+
julia> using Symbolics; @variables z[1:2]
35+
1-element Vector{Symbolics.Arr{Num, 1}}:
36+
z[1:2]
37+
38+
julia> EvalddF(D, z)
39+
2×2×2 Array{Num, 3}:
40+
[:, :, 1] =
41+
2exp(z[1]^2 - z[2]) + 4(z[1]^2)*exp(z[1]^2 - z[2]) -2exp(z[1]^2 - z[2])*z[1]
42+
0 0
43+
44+
[:, :, 2] =
45+
-2exp(z[1]^2 - z[2])*z[1] exp(z[1]^2 - z[2])
46+
0 (-(cos(z[2])^2)) / (sin(z[2])^2) + (-sin(z[2])) / sin(z[2])
47+
```

0 commit comments

Comments
 (0)