Can Mathlab solve this
x1^2 +2.x1 - 2.x2^2 -5.x2 =5
2.x1^2 -3.x1 +x2^2 +3.x2 =19

댓글 수: 2

Walter Roberson
Walter Roberson 2013년 9월 3일
You know that has four solutions, right?
Walter Roberson
Walter Roberson 2013년 9월 3일
Please read the guide to tags and retag this question.

댓글을 달려면 로그인하십시오.

답변 (4개)

Thomas
Thomas 2013년 9월 3일
편집: Thomas 2013년 9월 3일

0 개 추천

Yes, look in the symbolic math toolbox http://www.mathworks.com/help/symbolic/solve.html
Go to the bottom of the page for examples
Shashank Prasanna
Shashank Prasanna 2013년 9월 3일

0 개 추천

You can solve a system of nonlinear equations using FSOLVE:
This will yield numerical solutions for x1 and x2

댓글 수: 3

Walter Roberson
Walter Roberson 2013년 9월 3일
Note: fsolve() will only find one solution at a time.
rob
rob 2013년 9월 3일
fsolve is all numerical not algabraic
Correct, fsolve() is numeric not algebraic. However can you really make use of the algebraic solutions? For example one of the four solutions to the above system has x1 be
-349/140 + (1/5040) * (4860 * (112706532 + 2940 * 1239703701^(1/2))^(1/3) - 6 * (112706532 + 2940 * 1239703701^(1/2))^(2/3) - 754344) / (112706532 + 2940 * 1239703701^(1/2))^(1/3) - (1/90720) * ((4860 * (112706532 + 2940 * 1239703701^(1/2))^(1/3) - 6 * (112706532 + 2940 * 1239703701^(1/2))^(2/3) - 754344)/(112706532 + 2940 * 1239703701^(1/2))^(1/3))^(1/2) * 6^(1/2) * 36^(1/2) * 2^(1/2) * (((810* (112706532 + 2940 * 1239703701^(1/2))^(1/3) + 18^(1/3) * ((9392211 + 245 * 1239703701^(1/2))^2)^(1/3) + 62862) * ((4860 * (112706532 + 2940 * 1239703701^(1/2))^(1/3) - 6 * (112706532 + 2940 * 1239703701^(1/2))^(2/3) - 754344) / (112706532 + 2940 * 1239703701^(1/2))^(1/3))^(1/2) + 1764 * (112706532 + 2940 * 1239703701^(1/2))^(1/3)) * 18^(1/3) * ((112706532 + 2940 * 1239703701^(1/2))^(1/3) / (810 * (112706532 + 2940 * 1239703701^(1/2))^(1/3) - (112706532 + 2940 * 1239703701^(1/2))^(2/3) - 125724))^(1/2) * ((9392211 + 245 * 1239703701^(1/2))^2)^(1/3) * 6^(1/2) / (9392211 + 245 * 1239703701^(1/2)))^(1/2) + (1/30240) * (1620 * (112706532 + 2940 * 1239703701^(1/2))^(1/3) * ((4860 * (112706532 + 2940 * 1239703701^(1/2))^(1/3) - 6 * (112706532 + 2940 * 1239703701^(1/2))^(2/3) - 754344) / (112706532 + 2940 * 1239703701^(1/2))^(1/3))^(1/2) + 2 * ((4860 * (112706532 + 2940 * 1239703701^(1/2))^(1/3) - 6 * (112706532 + 2940 * 1239703701^(1/2))^(2/3) - 754344) / (112706532 + 2940 * 1239703701^(1/2))^(1/3))^(1/2) * 18^(1/3) * ((9392211 + 245 * 1239703701^(1/2))^2)^(1/3) + 125724 * ((4860 * (112706532 + 2940 * 1239703701^(1/2))^(1/3) - 6 * (112706532 + 2940 * 1239703701^(1/2))^(2/3) - 754344) / (112706532 + 2940 * 1239703701^(1/2))^(1/3))^(1/2) + 3528 * (112706532 + 2940 * 1239703701^(1/2))^(1/3)) * 6^(1/2) * ((112706532 + 2940 * 1239703701^(1/2))^(1/3) / (810 * (112706532 + 2940 * 1239703701^(1/2))^(1/3) - (112706532 + 2940 * 1239703701^(1/2))^(2/3) - 125724))^(1/2) * 18^(1/3) * ((9392211 + 245 * 1239703701^(1/2))^2)^(1/3) / (9392211 + 245 * 1239703701^(1/2))
Would your work seriously be affected if all those 112706532 where 112706533 instead? (That would make a difference in the 6th decimal place.)

댓글을 달려면 로그인하십시오.

Roger Stafford
Roger Stafford 2013년 9월 3일

0 개 추천

It is useful to know how to solve such equations by hand rather than always depending on matlab. The trick is to eliminate either the x1^2 term or the x2^2 term by combining the equations appropriately. If we double the second equation and then add the equations, we get
5*x1^2-4*x1+x2 = 43
which can be solved for x2
x2 = -5*x1^2+4*x1+43
You can then substitute this value of x2 into either one of the original equations and get a fourth degree polynomial equation in x1. The four roots of this can be obtained with matlab's 'roots' program (we need matlab after all) and then corresponding values of x2 from these with the above equation.

댓글 수: 7

Walter Roberson
Walter Roberson 2013년 9월 3일
roots() will give numeric answers in decimal form that approximate the solutions.
MATLAB's symbolic toolbox will not expand symbolic solutions to quartics by default but it can be made to do it.
rob
rob 2013년 9월 3일
Is this working for a 3 by 3 or 4 by 4 to THus x1 x2 x3 x4
Walter Roberson
Walter Roberson 2013년 9월 3일
Possibly, under some restrictions on the combinations of coefficients. In the general case, if you have any power 5 or higher then algebraic solutions can usually not be found. With lower powers it would depend in part on the cross-product terms as to whether there is an algebraic solution or not.
rob
rob 2013년 9월 3일
And for a 1000 by 1000 What i am asking is really is there a algabraic way to solve it
Walter Roberson
Walter Roberson 2013년 9월 3일
You have not defined "it" sufficiently for an answer.
In your example, each variable appears only in the first or second degree, and never in the third degree or higher, and never any fractional or negative exponent. The constant multipliers and the value equated to are all rational and integer in your example. Your example also has no cross-products, no occurrence of x1^n * x2^m for n, m > 0. Effectively, each of your entries is the sum of exactly two quadratic equations with integer coefficients.
in the 3 x 3 and larger versions, which (if any) of those conditions is modified? Is each entry in the 1000 x 1000 still the sum of exactly two quadratic equations in integer coefficients?
rob
rob 2013년 9월 4일
I dont understand exactly I think lineair dependence is solvable like a +b +c =3 2a +2b - c =5 -a +b -3c = 9
but i was investigating only where the a b and c have a quadratic So a thousend by a thousend has a thousend unkowns of a and a^2 for all i know this is unsolvable and only in fsolve with numerical math.
Walter Roberson
Walter Roberson 2013년 9월 4일
편집: Walter Roberson 2013년 9월 4일
Suppose you had
a = b^2 + d
b = c^2
c = d^2
then a = d^8 + d, and that has no closed-form solution for d in terms of a. Therefore the generalized 3 x 3 or larger is not always resolvable to algebraic solutions. However, if the forms of the equations are constrained, so that one was not working with the generalized form, then it might be possible to find algebraic solutions; that would vary with the exact constraints.

댓글을 달려면 로그인하십시오.

Edwin
Edwin 2022년 9월 17일

0 개 추천

solve('6/(1-x^2) =5/(1+x) - 3/(1-x)')
Check for incorrect argument data type or missing argument in call to function 'solve'.

댓글 수: 1

syms x
solve(6/(1-x^2) == 5/(1+x) - 3/(1-x))
ans = 
Historically, solve() used to support character vectors like you show, but that changed around R2017b or so.

댓글을 달려면 로그인하십시오.

카테고리

도움말 센터File Exchange에서 Quadratic Programming and Cone Programming에 대해 자세히 알아보기

질문:

rob
2013년 9월 3일

댓글:

2022년 9월 17일

Community Treasure Hunt

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

Start Hunting!

Translated by