Is exp() a Documented Function in the Symbolic Math Toolbox?

2 views (last 30 days)
Paul
Paul on 27 May 2022
Commented: Paul on 27 May 2022
I can't find it.
  3 Comments
Sam Chak
Sam Chak on 27 May 2022
Yes, it's strange. Even symbolic log(X) is documented.
syms x
y = cos(x)
x = pi;
subs(y)
ans =
-1
syms x
y = exp(x)
x = pi;
subs(y)
ans =
exp(pi)

Sign in to comment.

Answers (3)

Steven Lord
Steven Lord on 27 May 2022
There is no separate documentation page for the exp method for sym objects, this is true. Not all methods of classes have documentation pages, and I believe this is especially true if the methods have very similar or the same behavior as the versions of the functions for double and single precision data. In fact if you look at the list of function reference pages for exp that appear on the first page of a search, the only three that show up are the double/single precision version in MATLAB, the quaternion version in a number of different toolboxes, and the fints version in Financial Toolbox (which is discouraged because fints is discouraged, with timetable being the recommended replacement.) There are more than just those three overloads.
which -all exp
built-in (/MATLAB/toolbox/matlab/elfun/@double/exp) % double method built-in (/MATLAB/toolbox/matlab/elfun/@single/exp) % Shadowed single method exp is a built-in method % Shadowed matlab.unittest.Verbosity method exp is a built-in method % Shadowed matlab.unittest.internal.fixtures.FolderScope method /MATLAB/toolbox/coder/half/@bfloat16/exp.p % Shadowed bfloat16 method /MATLAB/toolbox/control/ctrlmodels/@zpk/exp.m % Shadowed zpk method /MATLAB/toolbox/control/ctrlmodels/@tf/exp.m % Shadowed tf method /MATLAB/toolbox/finance/ftseries/@fints/exp.m % Shadowed fints method /MATLAB/toolbox/nnet/deep/@dlarray/exp.m % Shadowed dlarray method /MATLAB/toolbox/parallel/gpu/@gpuArray/exp.m % Shadowed gpuArray method /MATLAB/toolbox/parallel/parallel/@codistributed/exp.m % Shadowed codistributed method /MATLAB/toolbox/symbolic/symbolic/@sym/exp.m % Shadowed sym method
If you want to see the operations defined for sym objects you can ask MATLAB what methods are defined for that class. Note that this doesn't list all the operations you can perform on sym objects, as some MATLAB functions will operate on instances of a class as long as all the operations the function uses work on that class. For example the var function is not overloaded for sym but because all of the functions var.m uses work for sym you can compute the var of a symbolic vector.
which -all var % No sym overload
/MATLAB/toolbox/matlab/datafun/var.m /MATLAB/toolbox/matlab/timeseries/@timeseries/var.m % Shadowed timeseries method /MATLAB/toolbox/matlab/bigdata/@tall/var.m % Shadowed tall method /MATLAB/toolbox/finance/ftseries/@fints/var.m % Shadowed fints method /MATLAB/toolbox/parallel/gpu/@gpuArray/var.m % Shadowed gpuArray method /MATLAB/toolbox/parallel/parallel/@codistributed/var.m % Shadowed codistributed method
var(1:5)
ans = 2.5000
var(sym(1:5)) % But it works
ans = 
methods sym
Methods for class sym: abs compose erfinv hypot laplacian permute sinint acos cond euler ifourier latex piecewise sinpi acosd conj eval igamma lcm pinv size acosh cos exp ihtrans ldivide plus solve acot cosd expand ilaplace le pochhammer sort acotd cosh expint imag legendreP poles sqrt acoth coshint expm in length poly sqrtm acsc cosint ezcontour incidenceMatrix lhs poly2sym ssinint acscd cospi ezcontourf inline limit polylog string acsch cot ezmesh int linsolve polynomialDegree subexpr adjoint cotd ezmeshc int16 log polynomialReduce subs airy coth ezplot int32 log10 potential sum all csc ezplot3 int64 log2 power svd and cscd ezpolar int8 logical powermod sym angle csch ezsurf integrateByParts logint pretty sym2cell any ctranspose ezsurfc inv logm prevprime sym2poly argnames cumprod factor isAlways lt prod symFunType asec cumsum factorIntegerPower isLowIndexDAE lu psi symType asecd curl factorial isSymType mapSymType qr symprod asech daeFunction fibonacci isempty massMatrixForm quorem symsum asin dawson find isequal mathml rad2deg symvar asind dec2bin findDecoupledBlocks isequaln matlabFunction rank tan asinh dec2hex findSymType isfinite matlabFunctionBlock rat tand assume decic finverse isinf max rdivide tanh assumeAlso deg2rad fix ismember meijerG real taylor atan delete floor ismissing min rectangularPulse texlabel atan2 det formula isnan minpoly reduceDAEIndex times atan2d diag fortran isolate minus reduceDAEToODE toeplitz atand diff fourier isprime mixedUnits reduceDifferentialOrder transpose atanh dilog frac isreal mldivide reduceRedundancies triangularPulse bernoulli dirac fresnelc isscalar mod release tril bernstein disp fresnels iztrans mpower rem triu bernsteinMatrix display full jacobiAM mrdivide reshape uint16 besselh divergence functionalDerivative jacobiCD mtimes resultant uint32 besseli divisors funm jacobiCN mustBeInteger rhs uint64 besselj double gamma jacobiCS mustBePositive root uint8 besselk ei gammaln jacobiDC nchoosek round uminus bessely eig gbasis jacobiDN ndims rref unique beta eliminate gcd jacobiDS ne rsums uplus cat ellipj ge jacobiNC nextprime saveobj vectorPotential ccode ellipke gegenbauerC jacobiND nnz sec vertcat ceil ellipticCE gradient jacobiNS nonzeros secd vpa changeIntegrationVariable ellipticCK gt jacobiP norm sech vpaintegral char ellipticCPi half jacobiSC not series vpasolve charpoly ellipticE harmonic jacobiSD nthroot sign vpasum chebyshevT ellipticF has jacobiSN null signIm whittakerM chebyshevU ellipticK hasSymType jacobiZeta numden simplify whittakerW checkUnits ellipticNome heaviside jacobian numel simplifyFraction wrightOmega children ellipticPi hermiteH jordan odeFunction simscapeEquation xor chol eq hessian kron or sin zeta coeffs equationsToMatrix horner kroneckerDelta orth sinc ztrans collect erf horzcat kummerU pade sind colon erfc htrans laguerreL partfrac single colspace erfcinv hurwitzZeta lambertw pdeCoefficients sinh combine erfi hypergeom laplace perms sinhint Static methods: cast eye loadobj ones empty inf nan zeros Call "methods('handle')" for methods of sym inherited from handle.
  1 Comment
Paul
Paul on 27 May 2022
Thanks for the comprehensive answer. Any idea why symbolic log() has a doc page and exp() does not?
The more I think about it, the more suprised I am that sym exp() is not in the doc. For me, when I'm trying to learn how to use a toolbox, I go to the doc and start clicking around, particularly on the "Functions" at the top of a page, and when I do expect to see a comprehensive list of applicable functions, organized by group, etc. I would never use methods() at the command line.
I realize that there will always be functions like var(), but that's a different situation IMO.

Sign in to comment.


Image Analyst
Image Analyst on 27 May 2022
Type
which -all exp
to find out.
  1 Comment
Paul
Paul on 27 May 2022
which() only indicates that an item is found, not whether or not it's documented.
But I've also run across the opposite. For example, the function eul2rotm() can be found in the doc in multiple toolboxes:
But which() only returns one instance:
which eul2rotm -all
/MATLAB/toolbox/shared/robotics/robotutils/eul2rotm.m

Sign in to comment.


Walter Roberson
Walter Roberson on 27 May 2022
There is no doc for it.
help sym/exp
gives very brief help (nearly useless)
  1 Comment
Paul
Paul on 27 May 2022
"very brief" is being kind. exp(sym) not being documented is ... odd. I mean of all the implemented functions I would think exp() would be one of the least likely to be not documented.
BTW, I stumbled on this using the new @doc thing here to generate a link to the symbolic version of exp() and was flummoxed when it didn't show up on the list.

Sign in to comment.

Products


Release

R2021b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!