ResearchForge / Calculators
Linear Algebra·distance-to-subspace

Distance To Subspace

Determine the distance from a vector to a subspace defined by an orthogonal basis, using the projection calculated previously.

Math animationLinear Algebra · distance-to-subspace
✓ 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],"projected_y":[0.5,0.5,0,0.5]}0.8660250.8660254037844386
2{"vector_y":[2,2,1,1],"projected_y":[1,1,0.5,0.5]}1.5811391.5811388300841898
APIDeveloper APICall this calculator from codeexpand ↓
Endpoint
POST/api/calculators/linear-algebra/distance-to-subspace/compute
Inputs (2)
  • vector_yvectordefault [1,1,0,0]
  • projected_yvectordefault [0.5,0.5,0,0.5]
Example
curl -sX POST http://localhost:3001/api/calculators/linear-algebra/distance-to-subspace/compute \
  -H "Content-Type: application/json" \
  -d '{"inputs":{"vector_y":[1,1,0,0],"projected_y":[0.5,0.5,0,0.5]}}'
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 distance-to-subspace computation; problem text paraphrased.

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