Commit 5ee5a6e5 authored by Ferdinand Fischer's avatar Ferdinand Fischer
Browse files

Fixed quantity.Symbolic/int

parent acbe8f5d
......@@ -745,35 +745,6 @@ classdef Symbolic < quantity.Function
'domain', obj(1).domain);
end % expm()
function C = int(obj, z, a, b)
% from help sym/int:
% "int(S,v,a,b) is the definite integral of S with respect to v
% from a to b."
if nargin == 2
grdIdx = obj(1).domain.gridIndex(z);
a = obj(1).grid{grdIdx}(1);
b = obj(1).grid{grdIdx}(end);
end
if nargin == 3
b = a;
a = z;
z = num2cell( obj(1).variable );
end
if nargin == 1
assert(obj.nargin == 1, 'Not Implemented')
z = obj(1).grid{1};
a = z(1);
b = obj.variable;
z = num2cell( obj(1).variable );
end
C = obj.cumInt(z, a, b);
end % int()
function C = cumInt(obj, domain, lowerBound, upperBound)
% CUMINT cumulative integration
% result = cumInt(obj, domain, lowerBound, upperBound)
......
......@@ -132,6 +132,18 @@ fFlipped2 = f.flipGrid({'z', 'zeta'});
tc.verifyEqual(fReference2.on, fFlipped2.on, 'AbsTol', 10*eps);
end % testFlipGrid();
function testInt(testCase)
t = sym('t');
T = quantity.Domain.defaultDomain(10, 't');
f = quantity.Symbolic(sin(t), 'domain', T);
F = int(f);
testCase.verifyEqual(F, double( int( sin(t), t, 0, 1 ) ), 'AbsTol', 6e-17);
end
function testCumInt(testCase)
tGrid = linspace(pi, 1.1*pi, 51)';
sGrid = tGrid;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment