determine how many terms in the series 3k2 where k = 0,1,2,3, .... are required for the sum of the terms, not to exceed 2000. What is the sum for this number of terms?
1 view (last 30 days)
Show older comments
I'm learning matlab and i want to know how to solve this problem ... if anyone can help ?
determine how many terms in the series 3k2 where k = 0,1,2,3, .... are required for the sum of the terms, not to exceed 2000. What is the sum for this number of terms?
0 Comments
Answers (1)
David Hill
on 31 Mar 2022
k=0:20;
y=3*k.^2;%not sure what 3k2 means
c=find(cumsum(y)<2000,1,'last');%number of terms
2 Comments
Image Analyst
on 31 Mar 2022
Looks good to me (same as what I would have done), so you can thank him by clicking the "Accept this answer" to award him "reputation points", unless you want to wait for more answers (but I doubt you'll get any better responses). You could also do it with a for loop and "break" but most people would do it vectorized like David did it.
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!