필터 지우기
필터 지우기

solve() only gives one of infinitely many solutions.

조회 수: 3 (최근 30일)
Arthur
Arthur 2014년 11월 4일
댓글: Sean de Wolski 2014년 11월 4일
Hopefully the screenshot will make my question clear. From what I can tell by looking at the documentation for the solve() function, this application of solve is Supposed to give a parametrization for All solutions to x*y=1, but I only get one.
There are no additional assumptions on my variables x,y. Code in the screenshot was immediately preceded by clearing all variables.
Arthur

답변 (2개)

Zoltán Csáti
Zoltán Csáti 2014년 11월 4일
Your mistake is that you applied == instead of =. Do this one:
solution = solve('x*y=1','x','y');

Sean de Wolski
Sean de Wolski 2014년 11월 4일
The problem is that you're asking for a solution for both variables. Instead, solve for one at a time:
solve(x*y==1,x)
ans =
1/y
  댓글 수: 2
Arthur
Arthur 2014년 11월 4일
편집: Arthur 2014년 11월 4일
Thanks Sean, but what I'm hoping for is a parametrization of all solutions for the variables I list in terms of a new parameter. In the example I give, a solution would look like
x = z
y = 1/z
I'm not interested so much in solving x*y==1, but this was the simplest example I could find that expressed my problem. Furthermore, I assumed that since solve() gives ALL solutions when given a system of polynomials with only finitely many solution (e.g
V = solve(x^2 + x*y + y == 3,x^2 - 4*x + 3 == 0, x, y)
) that there might be some way of parameterizing All solutions in the case where there are infinitely many?
Sean de Wolski
Sean de Wolski 2014년 11월 4일
That's what it's doing: 1/y is the solution for all x given all y.
If you want to substitute in new values, use subs to do this.
subs(expr,old,new)

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

카테고리

Help CenterFile Exchange에서 Logical에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by