Cody

Problem 450. What is the distance from point P(x,y) to the line Ax + By + C = 0?

Solution 265488

Submitted on 22 Jun 2013
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

Test Suite

Test Status Code Input and Output
1   Fail
%% test 1 x=2; y=2; A=2; B=2; C=-4; y_correct = 1.4142; assert(abs(normalLen(x,y,A,B,C)-y_correct)<=1e-4)

```Error: Undefined function or variable 'b'. ```

2   Fail
%% test 2 x=3; y=4; A=3; B=4; C=5; y_correct = 6; assert(normalLen(x,y,A,B,C)-y_correct==0)

```Error: Undefined function or variable 'b'. ```

3   Fail
%% test 3 x=4; y=5; A=3; B=4; C=5; y_correct = 7.4; display(normalLen(x,y,A,B,C)) assert(abs(normalLen(x,y,A,B,C)-y_correct)<1e-1)

```Error: Undefined function or variable 'b'. ```

4   Fail
%% test 4 x=0;y=12345;A=0;B=1;C=0; y_correct = 12345; display(normalLen(x,y,A,B,C)) assert(abs(normalLen(x,y,A,B,C)-y_correct)==0)

```Error: Undefined function or variable 'b'. ```

5   Fail
%% test 5 x=0;y=-12345;A=0;B=1;C=0; y_correct = 12345; display(normalLen(x,y,A,B,C)) assert(abs(normalLen(x,y,A,B,C)-y_correct)==0)

```Error: Undefined function or variable 'b'. ```
{"found_math": false, "script_math_tex": 0, "script_math_asciimath": 0, "math_annotations": 0, "math_alttext": 0, "mathml": 0, "mathjax_tag": 0, "mathjax_inline_tex": 0, "mathjax_display_tex": 0, "mathjax_asciimath": 0, "img_math": 0, "codecogs_latex": 0, "wp_latex": 0, "mimetex.cgi": 0, "/images/math/codecogs": 0, "mathtex.cgi": 0, "katex": 0, "math-container": 0, "wp-katex-eq": 0, "align": 0, "equation": 0, "x-ck12": 0, "texerror": 0}