Evaluate:
1 1
∫ ∫ {x/y}{y/x} dxdy
0 0
where {n}= n - floor(n)
(In reply to
Just guessing by Steve Herman)
DECLARE FUNCTION frac# (x#)
DEFDBL A-Z
OPEN "intintil.txt" FOR OUTPUT AS #2
incr = .00001#: incr2 = incr * incr
FOR y = incr / 2 TO 1 STEP incr
FOR x = incr / 2 TO 1 - incr / 2 STEP incr
sum = sum + frac(x / y) * frac(y / x) * incr2
sum2 = sum2 + x * y * incr2
NEXT x
NEXT y
PRINT sum, sum2
PRINT #2, sum, sum2
FUNCTION frac (x)
frac = x - INT(x)
END FUNCTION
finds the integral asked for as .1775330530819235 while the guess integrates to .2499999999991424 which looks like it's 1/4.
|
Posted by Charlie
on 2013-03-02 14:49:35 |