# Help

8 messages
Open this post in threaded view
|

## Help

 How do I use octave to evaluate the following,  1^2 + 2^2 +3^2 +...+100^2 _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: Help

 On 18 February 2012 10:40, Appau Joseph <[hidden email]> wrote: > How do I use octave to evaluate the following,  1^2 + 2^2 +3^2 +...+100^2 sumsq(1:100) HTH, - Jordi G. H. _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: Help

 In reply to this post by joseph appau On Sat, Feb 18, 2012 at 10:40 AM, Appau Joseph wrote: How do I use octave to evaluate the following,  1^2 + 2^2 +3^2 +...+100^2 _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave there are many ways: this is one waya=1:100;b=a.^2;c=sum(b) _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: Help

 In reply to this post by joseph appau On Sat, Feb 18, 2012 at 10:40 AM, Appau Joseph wrote: How do I use octave to evaluate the following,  1^2 + 2^2 +3^2 +...+100^2 s = 0;for i = 1:100,  s = s + i^2;endforor you could vectorize the loop and get:s = sum((1:100).^2); _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave
Open this post in threaded view
|

## Re: Help

 Another variation offered to give further insight into what octave does (rather than indulging in gratuitous competitive spirit). Honest. (1:100)*(1:100)' OK. Maybe it would be more honest to say "as well as" However good you think Octave is, it's much, much better.
Open this post in threaded view
|

## Re: Help

 Sent from my iPad On Feb 18, 2012, at 10:17 AM, pathematica <[hidden email]> wrote: > Another variation offered to give further insight into what octave does > (rather than indulging in gratuitous competitive spirit). Honest. > > (1:100)*(1:100)' > > OK. Maybe it would be more honest to say "as well as" > > ----- > However good you think Octave is, it's much, much better. If we are showing off, how about 100*101*201/6 (sum(n^2)) = n*(n+1)*(2*n+1)/6) _______________________________________________ Help-octave mailing list [hidden email] https://mailman.cae.wisc.edu/listinfo/help-octave