Hi Dawn,
Ferret does not shift half a grid cell for this calculation. It
computes the definite integral as the discrete sum, F(x)* dx where dx
is computed from half a grid cell below to half a grid cell above the
coordinate point. This particular example is
1*1(1.5 - 0.5) + 2*2(2.5 - 1.5) + 3*3(3.5-2.5) = 14.0
When Ferret writes that x is from 0.5 to 3.5 this indicates that the
sum includes the grid cells from the start of box 1 at 0.5 to the end
of box 3 at 3.5 was used in the sum.
Take another example, where the boxes are not of size 1.
yes? define axis/x=1:5:2 xax
yes? let xx = x[gx=xax]
yes? let ff = xx* xx
yes? list ff[x=@iin]
VARIABLE : XX*XX
indef. integ. on X
SUBSET : 3 points (X)
1 / 1: 2.00
3 / 2: 20.00
5 / 3: 70.00
yes? list ff[x=@din]
VARIABLE : XX*XX
X : 0 to 6 (integrated)
70.00
Here are the box edges and coordinates
yes? list xboxlo[gx=xax], x[gx=xax], xboxhi[gx=xax]
X: 0 to 6
Column 1: XBOXLO is XBOXLO (axis XAX)
Column 2: X is X (axis XAX)
Column 3: XBOXHI is XBOXHI (axis XAX)
XBOXLO X XBOXHI
1 / 1: 0.000 1.000 2.000
3 / 2: 2.000 3.000 4.000
5 / 3: 4.000 5.000 6.000
So, ff[x=@din] = 1*1*(2 - 0) + 3*3*(4 - 2) + 5*5*(6 - 4) = 70
Or, if we had said, list ff[x=1:5@din], then Ferret would use half a
grid box on the first and last coordinates, or
ff[x=1:5@din] = 1*1*(2 - 1) + 3*3*(4 - 2) + 5*5*(5 - 4) = 44
yes? list ff[x=@din]
VARIABLE : XX*XX
X : 1 to 5 (integrated)
44.00
ferret ocean wrote:
hi, all
I'm not sure if anybody had ask this question, and I didn't find it
from Email archive in PMEL website. My question is about @din, which
give us an unaccurate value?
let one=x*x
list/i=1:3 one[i=@din]
then Ferret give us:
VARIABLE : X*X
X : 0.5 to 3.5 (integrated)
14.00
Actually, we know integrate x*x from 0.5 to 3.5 (shift 1/2 grid cell in
Ferret), is x^3/3 from 0.5 to 3.5, which means (3.5^3-0.5^3)/3=14.25
instead of 14.00.
why? the same for @iin, the results of each step is integer, no digit.
why?
Any help will be appreciated!
Dawn
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
|