Cody

Problem 47003. Combine complex conjugates first when computing the product of vector

Solution 3356823

Submitted on 24 Oct 2020 by Nikolaos Nikolaou
  • Size: 21
  • This is the leading solution.
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   Pass
v = [ -376565273.869706 + 0i -3419197614.44981 + 1946408802.27484i -3419197614.44981 - 1946408802.27484i -3789372834.14304 + 4660481826.64665i -3789372834.14304 - 4660481826.64665i -4853975182.33591 + 6452212202.13479i -4853975182.33591 - 6452212202.13479i]; p_correct = -1.371038915265445082201028823e+67; assert(isequal(cprod(v),p_correct))

ans = -1.371038915265445e+67

2   Pass
v = [ -58018582009.6862 + 0i 11881642421.73 - 18022157170.9685i 11881642421.73 + 18022157170.9685i 18374324855.4044 + 0i -226405216.604407 + 0i -1337454510.20606 + 0i]; p_correct = -1.50419234807407836028190728e+59; assert(isequal(cprod(v),p_correct))

ans = -1.504192348074078e+59

3   Pass
v = [ -23997509903.8279 - 34319602612.5819i -42177350631.5315 - 30973682805.5245i -2413378757.94399 + 0i -42177350631.5315 + 30973682805.5245i -21219271177.3494 - 14563317472.4674i -21219271177.3494 + 14563317472.4674i -23997509903.8279 + 34319602612.5819i]; p_correct = -7.67629000421934e+72; assert(abs(cprod(v)-p_correct)/abs(p_correct)<1e-6) assert(imag(cprod(v))==0)

ans = -7.676290004219341e+72 ans = -7.676290004219341e+72

Suggested Problems

Community Treasure Hunt

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

Start Hunting!