help-octave
[Top][All Lists]
Advanced

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

Re: Evaluating a series


From: Nicholas Jankowski
Subject: Re: Evaluating a series
Date: Thu, 9 Aug 2012 09:01:58 -0400

On Thu, Aug 9, 2012 at 8:46 AM, Andy Buckle <address@hidden> wrote:
>
>
> On 9 August 2012 13:38, Jordi Gutiérrez Hermoso <address@hidden> wrote:
>>
>> On 9 August 2012 08:26, Nicholas Jankowski <address@hidden> wrote:
>> > On Thu, Aug 9, 2012 at 3:22 AM,  <address@hidden> wrote:
>> >> Please assist me to do this:
>> >> Evaluate the series
>> >>
>> >> 1-1/3+1/5-1/7+1/9-...+1/1001
>> >>
>> >
>> > While there may be more elegant ways to do this, you're basically
>> > trying to repeat an addition operation of items with changing value.
>>
>> e.g.
>>
>>     sum(1./(1:4:1001) - 1./(3:4:1001))
>>
>> ?
>>
>> - Jordi G. H.
>> _______________________________________________
>> Help-octave mailing list
>> address@hidden
>> https://mailman.cae.wisc.edu/listinfo/help-octave
>
>
>>sum(1./(1:4:1001) - 1./(3:4:1001))
> error: operator -: nonconformant arguments (op1 is 1x251, op2 is 1x250)
> error: evaluating argument list element number 1
>>sum(1./(1:4:1001)) - sum(1./(3:4:1001))
> ans =  0.78590
>
> --
> /* andy buckle */

50 points from Gryffindor: for doing the kid's homework for him
instead of leading him to actually learning to use the program.


reply via email to

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