简体   繁体   中英

Matlab - Symbolically Solving Inequalities

So, I'm trying to establish some new stability criteria for my simulations, and this involves a lot of convoluted inequalities. I've worked through the math a few times by hand, and it's very laborous; so, I wanted to figure out a way to automate the process (as I'm trying to find the best integration scheme from a stability perspective). Is there anyway to solve inequalities symbolically in Matlab? Here's what I'm trying to solve. In the following expression, x refers to the gradient of a force function with respect to x , and t is the time step. In general, x < 0 and t > 0 :

-(t*x + (2*t^3*x + t^2*x^2 - 2*t*x + 4*t + 1)^(1/2) + 1)/(x*t^2 - 2) < 1

Based on what I've looked at online, this seems to be possible in MuPAD, but using the following code does not give me any valid results:

solve(-(t*x + (2*t^3*x + t^2*x^2 - 2*t*x + 4*t + 1)^(1/2) + 1)/(x*t^2 - 2) < 1, t)

Any idea what I can do to make this work and automate the process?

First, since Wolfram Alpha gives you an answer (that I presume you've checked for correctness), I assume you want to use Matlab to solve other similar problems. However, this is a very non-trivial inequality due to the roots of the polynomials. I haven't been able to get Matlab/MuPAD to do anything with it. As I stated, regular Matlab can solve inequalities and systems of equalities in many cases, eg, in R2013b

syms x real;
solve(x^3-1>1,x)

Even Mathematica 9 has trouble (the Reduce function can be used instead of it's Solve , but the output is not easy to use).

You can, however, solve for the real roots where x < 0 and t > 0 via

syms x t real;
assume(x<0);
assume(t>0);
f = -(t*x+sqrt(2*t^3*x+t^2*x^2-2*t*x+4*t+1)+1)/(x*t^2-2);
s = solve(f==1,t)

which returns:

s =

-(x + (x*(x - 2))^(1/2))/x

This simplifies to sqrt((x-2)/x)-1 . Thus t > sqrt((x-2)/x)-1 , one of the bounds provided by Wolfram Alpha. (The other more complicated bound is always less than zero and actually is the condition that ensures that t is real.)

But, do you even need to be solving this problem symbolically? Do you need explicit expressions for the various intervals in terms of all x ? If not, this type of problem is probably better suited numeric approaches – either via root solving (eg, fzero ) or minimization (eg, fmincon ).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM