A C - MATLAB Cody - MATLAB Central

A C

208
Rank
21
Badges
6676
Score
1 – 50 of 669

A C submitted a Comment to Problem 42935. Sums of cubes and squares of sums

Can someone point me in the right direction? n = 1e5; y_correct = uint64(500010000050000); I get 500010000050005. I do not know how to go beyond double precision. function y = cubesLessSquare(n) % Formula N = (((sum((1:n).^3)*2 - sum(1:n)^2)*2/n)) % double to char C = sprintf('%f',N) % char to vector Y = C - '0' % take out the dot and the numbers after the dot Dot = find(Y<0) Y([Dot:end]) = [] % join the the numbers Z = sprintf('%d',Y) % make to double y = str2num(Z) end

on 16 Jan 2021

A C submitted Solution 4572593 to Problem 553. How to multiply?

on 11 Jan 2021

A C submitted Solution 4572083 to Problem 563. How to add?

on 10 Jan 2021

A C submitted a Comment to Problem 44309. Pi Digit Probability

% I used Machin's Formula: pi = 4[4arctan(1/5) - arctan(1/239)] because it was used for speed. But it will not go no more than 16 digits. How can I go beyond 16 digits? function [PI] = pidigit(N,n) A = 0; F = 10^300; % Machin's Formula: pi = 4[4arctan(1/5) - arctan(1/239)] x1 = 1/5; x2 = 1/239; for K = 0:1000000000 A1 = 4*((-1)^K*x1^(2*K+1)/(2*K+1)); A2 = (-1)^K*x2^(2*K+1)/(2*K+1); A = A + 4*(A1 - A2)*F; end E = abs(pi*F-A)/(pi*F); PI = sprintf('%.f',A) -'0'; sum(PI(1:N-1) == n) sum(PI(1:N-1) == n)/(N-1) end

on 10 Jan 2021

A C submitted Solution 4562043 to Problem 44652. Draw a 'X'!

on 8 Jan 2021

A C submitted Solution 4561923 to Problem 44679. Draw 'E'

on 8 Jan 2021

A C submitted Solution 4561873 to Problem 44686. Draw 'J'

on 8 Jan 2021

A C submitted Solution 4561808 to Problem 44672. Draw 'C'.

on 8 Jan 2021

A C submitted Solution 4561743 to Problem 44681. Draw 'H'

on 8 Jan 2021

A C submitted Solution 4561088 to Problem 44656. Draw a 'N'!

on 8 Jan 2021

A C submitted Solution 4557978 to Problem 44685. Draw 'B'

on 8 Jan 2021

A C received Community Group Solver badge for Basics - Cell Arrays

on 6 Jan 2021

A C submitted a Comment to Problem 340. Find last non-zero in a given dimension

What is the 3 and 4 dimension in matrix? How is it used?

on 6 Jan 2021

A C submitted a Comment to Solution 4532748

when the code is rewritten as y = [y {s(S:Ind(E))}];, it includes the spaces. But, when the code is rewritten y =[y cellstr(s(S:Ind(E)))] it leaves the spaces out. Why does it do that?

on 3 Jan 2021

1 – 50 of 669
Go to top of page