-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
10 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,22 @@ | ||
using Symbolics | ||
include("./linear_algebra_basic.jl") | ||
|
||
@variables u v | ||
""" | ||
function projection_matrix_symbolic() -> Matrix | ||
Create matrix for projection on [u, v] using E₁ = [1,0] and E₂ =[0,1] | ||
Create symbolic matrix for projection on [u, v] using E₁ = [1,0] and E₂ =[0,1] to get first and second row | ||
""" | ||
function projection_matrix_symbolic() | ||
[orthproj([u, v], [1, 0])[1] orthproj([u, v], [1, 0])[2]; orthproj([u, v], [0, 1])[1] orthproj([u, v], [0, 1])[2]] | ||
[orthproj([u, v], [1, 0])[1] orthproj([u, v], [0, 1])[1]; orthproj([u, v], [1, 0])[2] orthproj([u, v], [0, 1])[2]] | ||
end | ||
|
||
function projection_matrix_symbolic_polar() | ||
simplify.(substitute.(projection_matrix_symbolic(),(Dict(u => cos(θ), v => sin(θ)),))) | ||
end | ||
""" | ||
function projection_matrix(x::Vector) -> Matrix | ||
value of Matrix with an actual x | ||
""" | ||
function projection_matrix(x::Vector) | ||
Symbolics.value.(substitute.(projection_matrix_symbolic(), (Dict(u =>x[1], v=> x[2]), ))) | ||
end | ||
|