Skip to content

Commit

Permalink
Merge branch 'main' into 20240906study
Browse files Browse the repository at this point in the history
  • Loading branch information
AronT-TLV committed Sep 21, 2024
2 parents 5298508 + 1ae305b commit 0eac935
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
17 changes: 4 additions & 13 deletions src/linear_algebra.jl → src/linear_algebra_basic.jl
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,11 @@ end

"""
function reflection(v::Vector, w::Vector) -> Vector
The projection P from 'w' onto 'v' is the midpoint of the reflection of w around v
The midpoint of the segment from `v` to the reflection of `v` is the projection P from 'v' to the line along 'w'
"""
function reflection(v::Vector, w::Vector)
P = orthproj(v,w)
(2 * P ) - X
function reflection(v::Vector,w::Vector)
P = orthproj(w,v)
(2 * P ) - w
end

"""
Expand Down Expand Up @@ -280,12 +280,3 @@ function intersection_2_implicit_lines(a₁::Number, b₁::Number, c₁::Number,
A\b
end

"""
function matrix_orthproj_basis(v::Vector) -> Matrix
Compute matrix of orthogonal projection of basis vectors on line along vector v
"""
function matrix_orthproj_basis(v::Vector)
e₁ =[1,0]
e₂ = [0,1]
[permutedims(orthproj(v, e₁)); permutedims(orthproj(v, e₂))]
end
22 changes: 22 additions & 0 deletions src/linear_algebra_transform.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
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()
[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

0 comments on commit 0eac935

Please sign in to comment.