MATLAB: Questions about vpasolve about finding multiple solutions for nonpolynomial equation

MATLABmultiple solutions for nonpolynomial equationrandomvapsolve

The following example show that the "vapsolve" can find multiple solutions for nonpolynomial equation.
syms x
f = x-tan(x);
for n = 1:3
vpasolve(f,x,'random',true)
end
But I want to limit the range of variables, so I changed previous codes like this:
syms x
f = x-tan(x);
for n = 1:3
vpasolve(f,x,[0 100],'random',true)
end
The results always produce the same results. How to solve this problem?

Best Answer

_ = vpasolve(_,'Random',Random) uses a random starting point for finding solutions when 'Random' is set to true. Use this input to avoid returning the same solution repeatedly for nonpolynomial equations. If you specify starting points for all variables, setting 'Random' to true has no effect.
I tested with
assume(x>=0&x<=100)
with that in effect, some negative x values were found and some x values greater than 100 were found, but the range was much less than if the assume was not in effect.
Related Question