Re: replace integration by summation [message #84942 is a reply to message #84941] |
Wed, 19 June 2013 06:02   |
Mats Löfdahl
Messages: 263 Registered: January 2012
|
Senior Member |
|
|
Den onsdagen den 19:e juni 2013 kl. 14:55:37 UTC+2 skrev fd_...@mail.com:
> On Wednesday, 19 June 2013 13:08:17 UTC+1, Paul van Delst wrote:
>
>> Hmm... an all-zero result is typically an indication of user error (it's pretty difficult to get a bunch of numbers to add up to zero). What about if, instead of A2= INT_TABULATED(t[0:i], A1[0:i]) you do A2= INT_TABULATED(t, A1) ? What do you get? In your original post you don't use bounds in the TOTAL() example, so may as well do the same in the INT_TABULATED() one.
>
>
>
>> I actually have a loop
>
> For i=1,n-1 do begin
>
> A1[i]= INT_TABULATED(t[0:i], A2[0:i])
>
> endfor
>
>
>
> When I use A2= INT_TABULATED(t, A1) I got a single value. I need an array that is why I used
>
> A1 = (t[1]-t[0])*total(A2,/cumulative)
>
>
>
> I am actually try to avoid the loop and replace it by something else. For this reason I used the A1 = (t[1]-t[0])*total(A2,/cumulative).
You are switching between calculating A1 as a sum/integral of A2 and A2 as a sum/integral of A1. Is there maybe a typo in your code?
|
|
|