Cody

# Problem 635. Angle between Two Vectors

Solution 3323673

Submitted on 22 Oct 2020
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
a = [1 0]; b = [0 1]; expected=pi/2; theta = solve_included_vector_angle(a,b) assert(0.99*expected-.001<=theta && theta<=expected*1.01+.001 ) % Is there a better way to allow tolerances?

Error in solution: Line: 2 Column: 42 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

2   Fail
a = [1 1 0]; b = [1 1 2^0.5]; expected=pi/4; theta = solve_included_vector_angle(a,b) assert(0.99*expected-.001<=theta && theta<=expected*1.01+.001 )

Error in solution: Line: 2 Column: 42 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

3   Fail
a = [2 2]; b = [0 1]; expected=pi/4; theta = solve_included_vector_angle(a,b) assert(0.99*expected-.001<=theta && theta<=expected*1.01+.001 )

Error in solution: Line: 2 Column: 42 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

4   Fail
a = [-1 1]; b = [4 0]; expected=0.75*pi; theta = solve_included_vector_angle(a,b) assert(0.99*expected-.001<=theta && theta<=expected*1.01+.001 )

Error in solution: Line: 2 Column: 42 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

5   Fail
a = [-1 2 3]; b = [1 2 4]; expected=0.161*pi; theta = solve_included_vector_angle(a,b) assert(0.99*expected-.001<=theta && theta<=expected*1.01+.001 )

Error in solution: Line: 2 Column: 42 Invalid expression. When calling a function or indexing a variable, use parentheses. Otherwise, check for mismatched delimiters.

### Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
{"ft_lang_label":"__label__en","ft_lang_prob":0.5655388,"math_prob":0.90983516,"size":1154,"snap":"2020-45-2020-50","text_gpt3_token_len":387,"char_repetition_ratio":0.14956522,"word_repetition_ratio":0.13043478,"special_character_ratio":0.41594455,"punctuation_ratio":0.188,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.97972983,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2020-11-26T07:12:26Z\",\"WARC-Record-ID\":\"<urn:uuid:af1b0a26-6e6b-4e23-a24e-ae02c6d42d51>\",\"Content-Length\":\"82463\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:5b710f62-ba48-458f-ba3a-36e48e6ec4dd>\",\"WARC-Concurrent-To\":\"<urn:uuid:4d6bc5ad-ee11-4992-aa3f-053159604de6>\",\"WARC-IP-Address\":\"184.24.72.83\",\"WARC-Target-URI\":\"https://se.mathworks.com/matlabcentral/cody/problems/635-angle-between-two-vectors/solutions/3323673\",\"WARC-Payload-Digest\":\"sha1:SMV73FHR2T6PWNYPVGUD76E32AVERO7B\",\"WARC-Block-Digest\":\"sha1:AHNVZJD5CZEE654GEEMJHBFSPS7LKFIO\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2020/CC-MAIN-2020-50/CC-MAIN-2020-50_segments_1606141186761.30_warc_CC-MAIN-20201126055652-20201126085652-00198.warc.gz\"}"}