From f673ca6cdd3431de0f3364a6b9c60bce59b26d76 Mon Sep 17 00:00:00 2001 From: Aron T Date: Sat, 28 Sep 2024 13:04:36 +0300 Subject: [PATCH] polar projection --- src/linear_algebra_transform.jl | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/linear_algebra_transform.jl b/src/linear_algebra_transform.jl index 6ee1fc0..c419de6 100644 --- a/src/linear_algebra_transform.jl +++ b/src/linear_algebra_transform.jl @@ -1,22 +1,33 @@ using Symbolics include("./linear_algebra_basic.jl") -@variables u v """ function projection_matrix_symbolic() -> Matrix 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() + @variables u v [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() -> Matrix +Create symbolic matrix for projection on [cos θ, sin θ] +""" function projection_matrix_symbolic_polar() + @variables u v θ simplify.(substitute.(projection_matrix_symbolic(),(Dict(u => cos(θ), v => sin(θ)),))) end """ function projection_matrix(x::Vector) -> Matrix -value of Matrix with an actual x +value of Matrix with an actual vector x """ function projection_matrix(x::Vector) Symbolics.value.(substitute.(projection_matrix_symbolic(), (Dict(u =>x[1], v=> x[2]), ))) end +""" + function projection_matrix_polar(θ::Number) -> Matrix +value of Matrix with an actual value for the angle of the vector +""" +function projection_matrix_polar(n::Number) + Symbolics.value.(substitute.(projection_matrix_symbolic_polar(), θ => deg2rad(n),)) +end