ResearchForge / Calculators
Linear Algebra·orthogonal-projection

Orthogonal Projection

Calculate the orthogonal projection of a given vector onto a specified subspace defined by an orthogonal basis. Additionally, determine the distance from the vector to the subspace.

Math animationLinear Algebra · orthogonal-projection
✓ All 2 test cases pass.

Inputs

Test cases

These cases run live in your browser every time the page loads. If any fail, the calculator is broken — file an issue.

#InputsExpectedGotStatus
1{"vector_y":[1,1,0,0],"basis_u1":[1,0,1,0],"basis_u2":[0,1,0,1]}0.5,0.5,0.5,0.50.5,0.5,0.5,0.5
2{"vector_y":[2,2,1,1],"basis_u1":[1,0,1,0],"basis_u2":[0,1,0,1]}1.5,1.5,1.5,1.51.5,1.5,1.5,1.5
APIDeveloper APICall this calculator from codeexpand ↓
Endpoint
POST/api/calculators/linear-algebra/orthogonal-projection/compute
Inputs (3)
  • vector_yvectordefault [1,1,0,0]
  • basis_u1vectordefault [1,0,1,0]
  • basis_u2vectordefault [0,1,0,1]
Example
curl -sX POST http://localhost:3001/api/calculators/linear-algebra/orthogonal-projection/compute \
  -H "Content-Type: application/json" \
  -d '{"inputs":{"vector_y":[1,1,0,0],"basis_u1":[1,0,1,0],"basis_u2":[0,1,0,1]}}'
Try it live
Edit the body below, then click Call API.
Request body
Response
(click Call API to see the response)
full API docs →

Source: Pattern from: combinepdf.pdf. Reproduces a standard orthogonal-projection computation; problem text paraphrased.

AI disclosure: Calculator code generated by openai/gpt-4o-mini-2024-07-18; verified by 2 test cases.