help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Evaluate the following series:


From: Primoz PETERLIN
Subject: Re: Evaluate the following series:
Date: Sun, 12 Aug 2012 09:19:20 +0200

2012/8/12 Ted Harding <address@hidden>:
> On 12-Aug-2012 06:45:43 address@hidden wrote:
>> 1^2+2^2+3^2+...+100^2.
>>
>> Could this be correct, I'm getting sum=50005000?
>> Sent from my BlackBerry® wireless device
>
> 50005000 is correct for 1 + 2 + 3 + ... + (100^2), i.e. sum((1:(100^2)),
> but not for 1^2 + 2^2 + 3^2 + ... + 100^2, which is 338350.
>
> You evaluated sum((1:(100^2)) instead of sum((1:100)^2).

... or, to be consistent with Octave syntax, sum((1:100).^2) :)

--Primoz


reply via email to

[Prev in Thread] Current Thread [Next in Thread]