Commit a0043b6e authored by Ferdinand Fischer's avatar Ferdinand Fischer
Browse files

quantity.Symbolic/flipDomain uses now the upper bound of the domain to flip

parent 0b4c33a7
......@@ -402,14 +402,16 @@ classdef Symbolic < quantity.Function
'name', "sqrtm(" + x(1).name + ")");
end % sqrtm()
function b = flipDomain(obj, flipDomainName, optArgs)
function b = flipDomain(obj, flipDomainName)
arguments
obj
flipDomainName string;
optArgs.upper = 1;
end
flippedDomainName = optArgs.upper - sym( flipDomainName );
idx = obj(1).domain.index( flipDomainName );
for k = 1:numel(flipDomainName)
flippedDomainName(k) = obj(1).domain(idx(k)).upper - sym( flipDomainName(k) );
end
b = quantity.Symbolic(subs(obj.sym, num2cell( flipDomainName ), ...
num2cell( flippedDomainName ) ), obj(1).domain, ...
......
......@@ -356,7 +356,7 @@ tc.verifyEqual(qSymbolic(1,2).on(), qSymbolicTransp(2,1).on());
tc.verifyEqual(qSymbolic(2,1).on(), qSymbolicTransp(1,2).on());
end % testTranspose
function testFlipGrid(tc)
function testFlipDomain(tc)
syms z zeta
myGrid = linspace(0, 1, 11);
......@@ -374,6 +374,8 @@ fReference2 = quantity.Symbolic([1+(1-z)+(1-zeta); 2*(1-zeta)+sin(1-z)] + zeros(
myDomain);
fFlipped2 = f.flipDomain(["z", "zeta"]);
tc.verifyEqual(fReference2.on, fFlipped2.on, "AbsTol", 10*eps);
end % testFlipGrid();
function testInt(testCase)
......
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