Thank you very much for all your comments!

I experienced that it is much easier onlin in "Wolfram alfa" or "dcode".

Best, Jan

7 views (last 30 days)

Show older comments

Jan GimpelHenning
on 19 Sep 2018

Dear all, I'm using the solve function to determine a function out of several conditions (location of maxima,fixed points, etc.). I thought about using the solve function but struggle with using equations and inequations simultaneously.

syms x_1 x_2 x_3 x_4 x_max

eqns= [3* x_1 * (x_max)^2 + 2 * x_2 * x_max + x_3 ==0 , ...

1/4 * 100^4 * x_1 + 1/3 * 100^3 * x_2 + 1/2 * 100^2 * x_3 + 100 * x_4 == 1, ...

5^3 * x_1 + 5^2 * x_2 + 5 *x_3 + x_4 ==0 , ...

100^3 * x_1 + 100^2 * x_2 + 100 * x_3 + x_4 > 2.3 ];

S =solve(eqns, [x_1 x_2 x_3 x_4 x_max]);

I now would like to insert any x_max value to receive specific values for every parameter. How can I implement this, or first: How can I solve these functions? Does anyone has an idea?

Best, Jan

Jan GimpelHenning
on 21 Sep 2018

Walter Roberson
on 21 Sep 2018

KSSV
on 19 Sep 2018

How about this approach?

A = rand(10,1) ; % your x_max values

x = zeros(4,length(A)) ;

for i = 1:length(A)

x_max = A(i) ;

A = [3*(x_max)^2 2*x_max 1 0 ;

1/4*100^4 1/3*100^3 1/2 * 100^2 100 ;

5^3 5^2 5 1 ;

100^3 100^2 100 1 ] ;

b = [0 ; 1 ; 0 ; 2.3 ];

x(:,i) = A\b ;

end

Bruno Luong
on 19 Sep 2018

If you fix x_max and replace the last inequality by the equation

100^3 * x_1 + 100^2 * x_2 + 100 * x_3 + x_4 = 3 % (or any rhs > 2.3) (eqt4bis)

you'll get linear system of 4 unknown and 4 equations. Generally it gives a unique solution (using "\" operator).

So for each x_max, you'll get infinity solutions (x_1, ...x_4) by changing RHS of (eqt4bis) continuously from 2.3 to infinity.

Walter Roberson
on 19 Sep 2018

Convert to an equality.

syms x_1 x_2 x_3 x_4 x_max real

syms delta

assume(delta>0);

eqns= [3* x_1 * (x_max)^2 + 2 * x_2 * x_max + x_3 == 0, ...

1/4 * 100^4 * x_1 + 1/3 * 100^3 * x_2 + 1/2 * 100^2 * x_3 + 100 * x_4 == 1, ...

5^3 * x_1 + 5^2 * x_2 + 5 *x_3 + x_4 == 0, ...

100^3 * x_1 + 100^2 * x_2 + 100 * x_3 + x_4 == 2.3 + delta ];

S = solve(eqns, [x_1 x_2 x_3 x_4 x_max]);

x_1, x_2, and x_4 will come out in terms of delta, with x_3 and x_max coming out 0.

You can then make delta positive and arbitrarily close to 0 or as large and positive as you want

>> subs([S.x_1 S.x_2 S.x_3 S.x_4 S.x_max], delta, 10)

ans =

[ 697378134818815959/14008751663786663333750, -42103925179940864/11207001331029330667, 0, 9828603160166400041/112070013310293306670, 0]

>> subs(eqns, [x_1 x_2 x_3 x_4 x_max], ans)

ans =

[ 0 == 0, 1 == 1, 0 == 0, 123/10 == delta + 23/10]

The last of those expressions shows you that the value that would be calculated by the left side of the inequality would be 123/10, which is greater than 23/10 on the right hand side of the inequality, with the difference being the 10 that was substituted for delta

Alex Sha
on 11 Oct 2019

There are too many numerical solutions：

1：

x_1: 0.0219289963140093

x_2: -1.20176285580936

x_3: -33.4147964294915

x_4: 194.37692900344

x_max: -10.7432904127419

2：

x_1: 0.0314801209421686

x_2: -4.09612586532522

x_3: 126.339211496887

x_4: -533.227925969075

x_max: 20.0613135430092

3：

x_1: 0.101969454491413

x_2: -11.5043706885438

x_3: 279.570790819788

x_4: -1122.99086869677

x_max: 59.9768924098454

....

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

Start Hunting!