Cody

Solution 1966853

Submitted on 8 Oct 2019
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
x = 1; [c,s] = infinite_series(x); c_correct = -0.3800580037051224; s_correct = 0.3845865774434312; assert(abs(c-c_correct)<50*eps & abs(s-s_correct)<50*eps)

ans = -0.380058003705094 0.384586577443407

Assertion failed.

2   Fail
x = exp(1); [c,s] = infinite_series(x); c_correct = 0.2832904461013926; s_correct = -0.2693088098978689; assert(abs(c-c_correct)<50*eps & abs(s-s_correct)<50*eps)

ans = 0.283290446101318 -0.269308809897821

Assertion failed.

3   Fail
x = sqrt(3); [c,s] = infinite_series(x); c_correct = -0.3675627321761342; s_correct = -0.2464611942058812; assert(abs(c-c_correct)<50*eps & abs(s-s_correct)<50*eps)

ans = -0.367562732176056 -0.246461194205923

Assertion failed.

4   Fail
x = 0.001; [c,s] = infinite_series(x); c_correct = 0.9984257500575904; s_correct = 0.0079069688545917; assert(abs(c-c_correct)<50*eps & abs(s-s_correct)<50*eps)

ans = 0.998425750014930 0.007906968900170

Assertion failed.

5   Fail
x = pi/4; [c,s] = infinite_series(x); c_correct = -0.2042534159513846; s_correct = 0.5511304391316155; assert(abs(c-c_correct)<50*eps & abs(s-s_correct)<50*eps)

ans = -0.204253415951320 0.551130439131601

Assertion failed.

6   Fail
x = 0.0263; [c,s] = infinite_series(x); c_correct = 0.9574346130196565; s_correct = 0.1214323234202421; assert(abs(c-c_correct)<50*eps & abs(s-s_correct)<50*eps)

ans = 0.957434613021278 0.121432323418378

Assertion failed.

7   Fail
x = 6.273; [c,s] = infinite_series(x); c_correct = 0.9837633160098646; s_correct = -0.0568212139709541; assert(abs(c-c_correct)<50*eps & abs(s-s_correct)<50*eps)

ans = 0.983763316015177 -0.056821213968014

Assertion failed.

8   Fail
x = 31/7; [c,s] = infinite_series(x); c_correct = -0.2961416175321223; s_correct = 0.3148962998550185; assert(abs(c-c_correct)<50*eps & abs(s-s_correct)<50*eps)

ans = -0.296141617532065 0.314896299855067

Assertion failed.