[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Octave-bug-tracker] [bug #42037] Missing function integral
From: |
Avinoam Kalma |
Subject: |
[Octave-bug-tracker] [bug #42037] Missing function integral |
Date: |
Thu, 31 Aug 2017 11:32:19 -0400 (EDT) |
User-agent: |
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/60.0.3112.113 Safari/537.36 |
Follow-up Comment #8, bug #42037 (project octave):
Thanks for implementing integral.
I have checked integral function on Win-7
All test pass:
>> test integral
PASSES 31 out of 31 tests
Coding style:
1. In the test code, some of the keywords are given with double quotes
("RelTol") and some with single quotes ('AbsTol')
2. Missing some spaces after commas.
Using Matlab examples - Is it legal? What about copyright issues?
Problem with Inf:
>> fun = @(x) 1./x
fun =
@(x) 1 ./ x
>> a = integral (fun, 0, 1)
warning: quadgk: non finite integrand encountered
warning: called from
quadgk at line 341 column 7
integral at line 87 column 7
warning: quadgk: Error tolerance not met. Estimated error 2.41923
warning: called from
quadgk at line 397 column 5
integral at line 87 column 7
a = 38.5083785045586
Matlab result:
>> fun = @(x) 1./x
fun =
function_handle with value:
@(x)1./x
>> a = integral (fun, 0, 1)
Warning: Infinite or Not-a-Number value encountered.
> In integralCalc/iterateScalarValued (line 349)
In integralCalc/vadapt (line 132)
In integralCalc (line 75)
In integral (line 88)
a =
Inf
38 is not Inf. Probably the problem is in quadgk and not in integral
What about a simple demo, like:
fun = @(x) cos (x);
integ = @(x) integral (fun, 0, x);
z = [0:0.01:2*pi];
w = arrayfun (integ, z);
plot (z, cos(z), z, w);
title ("integral demo");
h = legend ("f(x) = cos (x)", "integral of f(x)");
legend (h, "location", "southwest");
axis ("tight");
grid on
_______________________________________________________
Reply to this item at:
<http://savannah.gnu.org/bugs/?42037>
_______________________________________________
Message sent via/by Savannah
http://savannah.gnu.org/
- [Octave-bug-tracker] [bug #42037] Missing function integral,
Avinoam Kalma <=