(adsbygoogle = window.adsbygoogle || []).push({}); 1. The problem statement, all variables and given/known data

So I was giving a problem to "calculate" the number of flops in class today..

Now, I read the examples in the text book, and they are hard enough to understand...I am hoping that some one here can push me onto the right track

2. Relevant equations

find the flop count for the following sequence of commands:

a=0;

..for p=1:n

....for q=p:n

......for r=q:n

........a=a+1;

......end

....end

..end

What will be the value of a after the commands are executed ?

3. The attempt at a solution

I am not looking for a number, but a summation formula interms of n.

I am given that it has to be in the form

sum(i,n) i = n(1-n)/2

and

sum(i,n) i^2 = n(1-n)(2n-a)/6

So far, all I can see is that their must be n + n + n = 3n flops...

I have no idea how to calculate a.

Can somebody help me please?

**Physics Forums | Science Articles, Homework Help, Discussion**

Dismiss Notice

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Matlab - floating point operation counts (flop count)

Loading...

Similar Threads for Matlab floating point |
---|

MATLAB MATLAB: forces acting on an object |

MATLAB Matlab histogram |

MATLAB Sovling Bernoulli's differential equation in matlab? |

MATLAB Matlab-like software |

MATLAB Matlab data into bins |

**Physics Forums | Science Articles, Homework Help, Discussion**