Commit 4f5736ab authored by Jakob Gabriel's avatar Jakob Gabriel
Browse files

changes quantity.Discrete.name property to string

parent 71ed0af0
......@@ -136,16 +136,16 @@ classdef Backstepping < handle & matlab.mixin.Copyable
% init data
if ~isempty(obj.kernel) && isempty(obj.kernelInverse)
knownKernelWithSign = obj.signOfIntegralTerm * obj.kernel;
newKernelName = [obj.kernel(1).name, '_{I}'];
newKernelName = obj.kernel(1).name + "_{I}";
elseif isempty(obj.kernel) && ~isempty(obj.kernelInverse)
knownKernelWithSign = obj.signOfIntegralTermInverse * obj.kernelInverse;
newKernelName = strrep(obj.kernelInverse(1).name, '_{I}', '');
newKernelName = strrep(newKernelName, '_I', '');
newKernelName = strrep(obj.kernelInverse(1).name, "_{I}", "");
newKernelName = strrep(newKernelName, "_I", "");
else
myError = verifyInversion(obj);
error('both kernels are already known');
error("both kernels are already known");
end
newKernel = quantity.Discrete(knownKernelWithSign);
......@@ -158,8 +158,9 @@ classdef Backstepping < handle & matlab.mixin.Copyable
end
% successive approximation
progress = misc.ProgressBar('name', ['Successive Calculation of inverse ', ...
'of ', knownKernelWithSign(1).name, ': '], ...
progress = misc.ProgressBar('name', ...
"Successive Calculation of inverse " + ...
"of " + knownKernelWithSign(1).name + ": ", ...
'steps', 50, 'terminalValue', 50, 'printAbsolutProgress', true);
progress.start();
for it = 1 : progress.steps
......@@ -231,15 +232,18 @@ classdef Backstepping < handle & matlab.mixin.Copyable
'grid must be homogenious');
% calculate gradient numerically
quantityDomain = [quantity.Domain("z", myGrid), quantity.Domain("zeta", myGrid)];
[K_dzetaMat, K_dzMat] = numeric.gradient_on_2d_triangular_domain(...
thisKernel.on({myGrid, myGrid}, {'z', 'zeta'}), spacing, domain);
thisKernel.on(quantityDomain ), spacing, domain);
% create quantities as output parameters
K_dzeta = quantity.Discrete(K_dzetaMat, 'grid', {myGrid, myGrid}, ...
'gridName', {'z', 'zeta'}, 'name', ['d_{zeta}', thisKernel(1).name]);
K_dzeta = quantity.Discrete(K_dzetaMat, ...
'domain', quantityDomain , ...
'name', "d_{zeta}" + thisKernel(1).name);
K_dz = quantity.Discrete(K_dzMat, 'grid', {myGrid, myGrid}, ...
'gridName', {'z', 'zeta'}, 'name', ['d_{z}', thisKernel(1).name]);
K_dz = quantity.Discrete(K_dzMat, ...
'domain', quantityDomain , ...
'name', "d_z" + thisKernel(1).name);
end % gradient()
function domainSelector = get.domainSelector(obj)
......
......@@ -42,7 +42,7 @@ classdef ProgressBar < handle
properties
% Name of the procedure for which the progress should be shown.
% This is the text that is shown in front of the progress value.
name = '...';
name (1, 1) string = "...";
% Current progress state of the procedure as absolute value.
progress = 0;
......@@ -154,7 +154,7 @@ classdef ProgressBar < handle
end
elseif ~obj.silent
obj.reversemsg = '';
fprintf([obj.name ' ']);
fprintf(obj(1).name + " ");
obj.show();
end
end
......
......@@ -25,6 +25,8 @@ if isobject(a) && isobject(b)
result = true;
elseif ~isequal(size(a), size(b))
result = false;
elseif isstring(a) && ~all(isequal(a, b))
result = false;
else
props = union(properties(a), properties(b));
for jt = 1:length(props)
......
......@@ -15,7 +15,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
figureID double = 1;
% Name of this object
name char;
name (1,1) string;
% domain
domain;
......@@ -131,7 +131,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
%% set further properties
[obj.domain] = deal(myDomain);
[obj.name] = deal(myParser.Results.name);
obj.setName(myParser.Results.name);
[obj.figureID] = deal(myParser.Results.figureID);
%% reshape object from vector to matrix
......@@ -187,7 +187,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
headers = cell(1, numel(obj) + 1);
headers{1} = obj(1).gridName{1};
for i= 1:numel(obj) %TODO use easier to read headers
headers{i+1} = [obj(i).name '' num2str(i)];
headers{i+1} = obj(i).name + "" + num2str(i);
end
exportData = export.dd(...
'M', [obj.grid{:}, obj.valueDiscrete], ...
......@@ -230,6 +230,10 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
function obj = setName(obj, newName)
% Function to set all names of all elements of the quantity obj to newName.
% if ischar(newName)
% warning("Depricated: use string and not char for name-property!")
% newName = string(newName);
% end
[obj.name] = deal(newName);
end % setName()
end
......@@ -333,7 +337,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% *) build a new valueDiscrete on the correct grid.
obj_hat = quantity.Discrete( newValues, ...
'name', [obj.name '°' g.name], ...
'name', obj.name + "°" + g.name, ...
'size', size(obj), ...
'domain', tmpDomain.join);
......@@ -769,7 +773,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% solution(it) = objInverseTemp.on(rhs(it));
% end
% solution = reshape(solution, size(obj));
end
end % solveAlgebraic()
function inverse = invert(obj, gridName)
% inverse solves the function representet by the quantity for
......@@ -787,10 +791,10 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
assert(numel(obj(1).gridName) == 1);
assert(isequal(size(obj), [1, 1]));
inverse = quantity.Discrete(repmat(obj(1).grid{obj(1).domain.gridIndex(gridName)}(:), [1, size(obj)]), ...
'size', size(obj), 'domain', quantity.Domain([obj(1).name], obj.on()), ...
'size', size(obj), ...
'domain', quantity.Domain([obj(1).name], obj.on()), ...
'name', gridName);
end
end % invert()
function solution = solveDVariableEqualQuantity(obj, varargin)
% solves the first order ODE
......@@ -856,7 +860,8 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
reshape(odeSolution, [myGridSize, size(obj)]), ...
'domain', [quantity.Domain(myParser.Results.newGridName, variableGrid), ...
quantity.Domain('ic', myParser.Results.initialValueGrid)], ...
'size', size(obj), 'name', ['solve(', obj(1).name, ')']);
'size', size(obj), ...
'name', "solve(" + obj(1).name + ")");
end % solveDVariableEqualQuantity()
function solution = subs(obj, gridName2Replace, values)
......@@ -913,7 +918,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% replaced. If there are more cell-elements in those inputs
% then subs() is called again for the remaining pairs
% (gridName2Replace{2:end}, values{2:end}).
if ischar(values{1})
if ischar(values{1}) || isstring(values{1})
% if values{1} is a char-array, then the gridName is
% replaced
if any(strcmp(values{1}, gridName2Replace(2:end)))
......@@ -971,7 +976,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% the resulting quantity looses that spatial grid and
% gridName
newDomain = obj(1).domain;
newDomain = newDomain(~strcmp({newDomain.name}, gridName2Replace{1}));
newDomain = newDomain(~strcmp(gridName2Replace{1}, [newDomain.name]));
% newGrid is the similar to the original grid, but the
% grid of gridName2Replace is removed.
newGridSize = newDomain.gridLength();
......@@ -1281,8 +1286,8 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
bMat = flip(bMat, gridIdx(it));
end
b = quantity.Discrete(bMat, ...
'grid', a(1).grid, 'gridName', a(1).gridName, ...
'name', ['flip(', a(1).name, ')']);
'domain', a(1).domain, ...
'name', "flip(" + a(1).name + ")");
end % flipGrid()
function newObj = changeGrid(obj, gridNew, gridNameNew)
......@@ -1421,16 +1426,16 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
function s = sum(obj, dim)
s = quantity.Discrete(sum(obj.on(), obj.nargin + dim), ...
'grid', obj(1).grid, 'gridName', obj(1).gridName, ...
'name', ['sum(', obj(1).name, ')']);
end
'domain', obj(1).domain, ...
'name', "sum(" + obj(1).name + ")");
end % sum()
function y = sqrt(x)
% quadratic root for scalar and diagonal quantities
y = quantity.Discrete(sqrt(x.on()), ...
'size', size(x), 'grid', x(1).grid, 'gridName', x(1).gridName, ...
'name', ['sqrt(', x(1).name, ')']);
end
'size', size(x), 'domain', x(1).domain, ...
'name', "sqrt(" + x(1).name + ")");
end % sqrt()
function y = sqrtm(x)
......@@ -1450,12 +1455,12 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
yUnmuted(:,:,k) = sqrt(xPermuted(:,:,k));
end
y = quantity.Discrete(permute(yUnmuted, permuteBack), ...
'size', size(x), 'grid', x(1).grid, 'gridName', x(1).gridName, ...
'name', ['sqrt(', x(1).name, ')']);
'size', size(x), 'domain', x(1).domain, ...
'name', "sqrtm(" + x(1).name + ")");
else
error('sqrtm() is only implemented for quadratic matrices');
end
end
end % sqrtm()
function P = mpower(a, p)
% a^p implemented by multiplication
......@@ -1464,10 +1469,11 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
for k = 1:(p-1)
P = P * a;
end
end
end % mpower()
function s = num2str(obj)
s = obj.name;
end
end % num2str()
function P = mtimes(a, b)
% TODO rewrite the selection of the special cases! the
% if-then-cosntruct is pretty ugly!
......@@ -1487,12 +1493,12 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
if numel(b) == 1
% simple multiplication in scalar case
P = quantity.Discrete(a.on() * b, 'size', size(a),...
'grid', a(1).grid, 'gridName', a(1).gridName, ...
'name', [a(1).name, num2str(b)]);
'domain', a(1).domain, ...
'name', a(1).name + num2str(b));
return
else
b = quantity.Discrete(b, 'size', size(b), 'grid', {}, ...
'gridName', {}, 'name', '');
b = quantity.Discrete(b, 'size', size(b), ...
'domain', quantity.Domain.empty());
end
end
......@@ -1504,7 +1510,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
if isnumeric(P)
return
else
P.setName(['c ', b(1).name]);
P.setName("c " + b(1).name);
return
end
end
......@@ -1515,7 +1521,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% instead. Thus we have to exchange both tranposed values
% transpose the result in the end.
P = (b' * a')';
P.setName([a(1).name, ' ', b(1).name]);
P.setName(a(1).name + " " + b(1).name);
return
elseif a.isConstant() && b.isConstant()
P = a.on() * b.on();
......@@ -1551,7 +1557,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% multiple dimensions of the input are correctly arranged.
[idx, permuteGrid] = computePermutationVectors(a, b);
parameters.name = [a(1).name, ' ', b(1).name];
parameters.name = a(1).name + " " + b(1).name;
parameters.figureID = a(1).figureID;
domainA = a(1).domain;
......@@ -1610,7 +1616,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% use ./ for scalar case
y = quantity.Discrete(1 ./ objDiscreteOriginal, ...
'domain', obj(1).domain, ...
'name', ['(', obj(1).name, ')^{-1}']);
'name', "(" + obj(1).name + ")^{-1}");
else
% reshape and permute objDiscrete such that only on for
% loop is needed.
......@@ -1624,27 +1630,28 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
y = quantity.Discrete(reshape(invDiscrete, size(objDiscreteOriginal)),...
'domain', obj(1).domain, ...
'name', ['{(', obj(1).name, ')}^{-1}']);
'name', "{(" + obj(1).name + ")}^{-1}");
end
end % inv()
function objT = transpose(obj)
objT = builtin('transpose', copy(obj));
[objT.name] = deal(['{', obj(1).name, '}^{T}']);
objT.setName("{" + obj(1).name + "}^{T}");
end % transpose(obj)
function objCt = ctranspose(obj)
objT = obj.';
objCtMat = conj(objT.on());
objCt = quantity.Discrete(objCtMat, 'grid', obj(1).grid, ...
'gridName', obj(1).gridName, 'name', ['{', obj(1).name, '}^{H}']);
objCt = quantity.Discrete(objCtMat, ...
'domain', obj(1).domain, ...
'name', "{" + obj(1).name + "}^{H}");
end % ctranspose(obj)
function y = exp(obj)
% exp() is the exponential function using obj as the exponent.
y = quantity.Discrete(exp(obj.on()), ...
'name', ['exp(', obj(1).name, ')'], ...
'grid', obj(1).grid, 'gridName', obj(1).gridName, ...
'domain', obj(1).domain, ...
'name', "exp(" + obj(1).name + ")", ...
'size', size(obj));
end % exp()
......@@ -1667,7 +1674,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
else
xNorm = sqrtm( int(obj.' * optArg.weight * obj, integralGridName) );
if isa(xNorm, 'quantity.Discrete')
xNorm = xNorm.setName(['||', obj(1).name, '||_{L2}']);
xNorm = xNorm.setName("||" + obj(1).name + "||_{L2}");
end
end
end % l2norm()
......@@ -1682,7 +1689,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
myParser.addParameter('weight', eye(size(obj, 1)));
myParser.parse(varargin{:});
xNorm = sqrtm(obj.' * myParser.Results.weight * obj);
xNorm.setName(['||', obj(1).name, '||_{2}']);
xNorm.setName("||" + obj(1).name + "||_{2}");
end % quadraticNorm()
function y = expm(x)
......@@ -1703,8 +1710,8 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
yUnmuted(:,:,k) = expm(xPermuted(:,:,k));
end
y = quantity.Discrete(permute(yUnmuted, permuteBack), ...
'size', size(x), 'grid', x(1).grid, 'gridName', x(1).gridName, ...
'name', ['expm(', x(1).name, ')']);
'size', size(x), 'domain', x(1).domain, ...
'name', "expm(" + x(1).name + ")");
end
end
......@@ -1725,7 +1732,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
function x = rdivide(A, B)
if isnumeric(A)
x = quantity.Discrete( A ./ B.on(), 'size', size(B), ...
'domain', B(1).domain, 'name', ['1 ./ ' B(1).name]);
'domain', B(1).domain, 'name', "1 ./ " + B(1).name);
else
error('Not yet implemented')
end
......@@ -1932,9 +1939,9 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
myParser = misc.Parser;
myParser.addRequired('domain', @(d) obj(1).domain.gridIndex(d) ~= 0);
myParser.addRequired('lowerBound', ...
@(l) isnumeric(l) || ischar(l) );
@(l) isnumeric(l) || ischar(l) || isstring(l));
myParser.addRequired('upperBound', ...
@(l) isnumeric(l) || ischar(l) );
@(l) isnumeric(l) || ischar(l) || isstring(l));
myParser.parse(domain, lowerBound, upperBound)
% get grid
......@@ -1944,15 +1951,14 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% integrate
F = numeric.cumtrapz_fast_nDim(myGrid{intGridIdx}, ...
obj.on(), intGridIdx);
result = quantity.Discrete(F, 'grid', myGrid, ...
'gridName', obj(1).gridName);
result = quantity.Discrete(F, 'domain', obj(1).domain);
% int_lowerBound^upperBound f(.) =
% F(upperBound) - F(lowerBound)
result = result.subs( {domain}, upperBound) ...
- result.subs({domain}, lowerBound);
result = result.subs(domain, upperBound) ...
- result.subs(domain, lowerBound);
if isa(result, 'quantity.Discrete')
result.setName(deal(['int(', obj(1).name, ')']));
result.setName("int(" + obj(1).name + ")");
end
end
......@@ -1968,15 +1974,15 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% for support of numeric inputs:
if ~isa(A, 'quantity.Discrete')
if isnumeric(A)
A = quantity.Discrete(A, 'name', 'c', 'domain', quantity.Domain.empty());
A = quantity.Discrete(A, 'name', "c", 'domain', quantity.Domain.empty());
else
error('Not yet implemented')
end
elseif ~isa(B, 'quantity.Discrete')
if isnumeric(B)
B = quantity.Discrete(B, 'name', 'c', 'domain', quantity.Domain.empty());
B = quantity.Discrete(B, 'name', "c", 'domain', quantity.Domain.empty());
else
B = quantity.Discrete(B, 'name', 'c', 'gridName', A(1).gridName, 'grid', A.grid);
B = quantity.Discrete(B, 'name', "c", 'domain', A(1).domain);
end
end
......@@ -1989,19 +1995,19 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
% create result object
C = quantity.Discrete(aDiscrete + bDiscrete, ...
'domain', joinedDomain, ...
'name', [A(1).name, '+', B(1).name]);
'name', A(1).name + "+" + B(1).name);
end
function C = minus(A, B)
% minus uses plus()
C = A + (-B);
if isnumeric(A)
[C.name] = deal(['c-', B(1).name]);
[C.name] = deal("c-" + B(1).name);
elseif isnumeric(B)
[C.name] = deal([A(1).name, '-c']);
[C.name] = deal(A(1).name + "-c");
else
[C.name] = deal([A(1).name, '-', B(1).name]);
[C.name] = deal(A(1).name + "-" + B(1).name);
end
end
......@@ -2014,7 +2020,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
function C = uminus(A)
% unitary plus: C = -A
C = (-1) * A;
[C.name] = deal(['-', A(1).name]);
[C.name] = deal("-" + A(1).name);
end
function [P, supremum] = relativeErrorSupremum(A, B)
......@@ -2091,23 +2097,23 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
else
absQuantity = quantity.Discrete(abs(obj.on()), ...
'domain', obj(1).domain, ...
'size', size(obj), 'name', ['|', obj(1).name, '|']);
'size', size(obj), 'name', "|" + obj(1).name + "|");
end
end % abs()
function y = real(obj)
% real() returns the real part of the obj.
y = quantity.Discrete(real(obj.on()), ...
'name', ['real(', obj(1).name, ')'], ...
'grid', obj(1).grid, 'gridName', obj(1).gridName, ...
'name', "real(" + obj(1).name + ")", ...
'domain', obj(1).domain, ...
'size', size(obj));
end % real()
function y = imag(obj)
% real() returns the imaginary part of the obj.
y = quantity.Discrete(imag(obj.on()), ...
'name', ['imag(', obj(1).name, ')'], ...
'grid', obj(1).grid, 'gridName', obj(1).gridName, ...
'name', "imag(" + obj(1).name + ")", ...
'domain', obj(1).domain, ...
'size', size(obj));
end % imag()
......@@ -2270,7 +2276,7 @@ classdef (InferiorClasses = {?quantity.Symbolic}) Discrete ...
gridJoinedLength = newDomain.gridLength;
% get the index of obj.grid in the joined grid
[idx, logicalIdx] = newDomain.gridIndex({obj(1).domain.name});
[idx, logicalIdx] = newDomain.gridIndex([obj(1).domain.name]);
% evaluate the
valDiscrete = obj.on( newDomain(logicalIdx) );
oldDim = ndims(valDiscrete);
......
......@@ -115,7 +115,7 @@ classdef Function < quantity.Discrete
mObj(k).valueDiscrete = - obj(k).valueDiscrete;
end
[mObj.name] = deal(['-' obj.name]);
mObj.setName("-" + obj(1).name);
end
function p = inner(A, B)
......
......@@ -178,13 +178,11 @@ classdef Symbolic < quantity.Function
% Cast of a quantity.Symbolic object into a quantity.Discrete
% object.
myParser = misc.Parser();
myParser.addParameter('grid', obj(1).grid);
myParser.addParameter('gridName', obj(1).gridName);
myParser.addParameter('domain', obj(1).domain);
myParser.addParameter('name', obj(1).name);
myParser.parse(varargin{:});
assert(isequal(myParser.Results.gridName, obj(1).gridName))
Q = quantity.Discrete(obj.on(), ...
'grid', myParser.Results.grid, 'gridName', myParser.Results.gridName, ...
'domain', myParser.Results.domain, ...
'name', myParser.Results.name);
end
function f = function_handle(obj)
......@@ -192,15 +190,12 @@ classdef Symbolic < quantity.Function
end
function F = quantity.Function(obj, varargin)
myParser = misc.Parser();
myParser.addParameter('grid', obj(1).grid);
myParser.addParameter('gridName', obj(1).gridName);
myParser.addParameter('domain', obj(1).domain);
myParser.addParameter('name', obj(1).name);
myParser.parse(varargin{:});
assert(isequal(myParser.Results.gridName, obj(1).gridName))
for k = 1:numel(obj)
F(k) = quantity.Function(obj(k).function_handle(), ...
'grid', myParser.Results.grid, ...
'gridName', myParser.Results.gridName, ...
'domain', myParser.Results.domain, ...
'name', myParser.Results.name);
end
......@@ -500,7 +495,7 @@ classdef Symbolic < quantity.Function
solution = quantity.Symbolic(symbolicSolution, ...
'gridName', {myParser.Results.newGridName, 'ic'}, ...
'grid', {myParser.Results.variableGrid, myParser.Results.initialValueGrid}, ...
'name', ['solve(', obj(1).name, ')']);
'name', "solve(" + obj(1).name + ")");
end % solveDVariableEqualQuantity()
function sym = sym(obj)
......@@ -518,14 +513,14 @@ classdef Symbolic < quantity.Function
% quadratic root for scalar and diagonal symbolic quantities
y = quantity.Symbolic(sqrt(x.sym()), ...
'domain', x(1).domain, ...
'name', ['sqrt(', x(1).name, ')']);
'name', "sqrt(" + x(1).name + ")");
end % sqrt()
function y = sqrtm(x)
% quadratic root for matrices of symbolic quantities
y = quantity.Symbolic(sqrtm(x.sym()), ...
'domain', x(1).domain, ...
'name', ['sqrtm(', x(1).name, ')']);
'name', "sqrtm(" + x(1).name + ")");
end % sqrtm()
function b = flipGrid(a, myGridName)
......@@ -540,7 +535,7 @@ classdef Symbolic < quantity.Function
end
b = quantity.Symbolic(subs(a.sym, variableOld, variableNew), ...
'domain', a(1).domain, ...
'name', ['flip(', a(1).name, ')']);
'name', "flip(" + a(1).name + ")");
end % flipGrid()
function thisVariable = gridName2variable(obj, thisGridName)
......@@ -569,8 +564,8 @@ classdef Symbolic < quantity.Function
function mObj = uminus(obj)
% unitary minus: C = -A
mObj = quantity.Symbolic(-obj.sym, 'grid', obj(1).grid, ...
'domain', obj(1).domain, 'name', ['-', obj(1).name]);
mObj = quantity.Symbolic(-obj.sym, ...
'domain', obj(1).domain, 'name', "-" + obj(1).name);
end % uminus()
function mObj = uplus(obj)
% unitary plus: C = +A
......@@ -589,13 +584,13 @@ classdef Symbolic < quantity.Function
if isnumeric(B)
C = quantity.Symbolic(A.sym() * B, ...
'domain', A(1).domain, ...
'name', [A(1).name, ' c']);
'name', A(1).name + " c");
return
end
if isnumeric(A)
C = quantity.Symbolic(A * B.sym(), ...
'domain', B(1).domain, ...