MATLAB Answers

New to Matlab - need help with rearranging equation

1 view (last 30 days)
Philip Porter
Philip Porter on 16 Oct 2020
Answered: Jesús Zambrano on 16 Oct 2020
I have the following equation that I would like to rearrange so that "q" is the subject
w = (0-((p*10)-1000*q^(n-1))/((x-1)*q^(n-1)+((1-q^n)/(1-q))))*((c/100) + 1)
Can this be done in Matlab?
I have tired the following:
syms p q n x c w
eqn=((0-((0*10)-1000*q^(n-1))/((x-1)*q^(n-1)+((1-q^n)/(1-q))))*((c/100) + 1)-w==0)
eqn = rewrite(eqn,'log');
solq = solve(eqn, q, 'IgnoreAnalyticConstraints',1)
However this returns an error:
Warning: Unable to find explicit solution. For options, see help.

  0 Comments

Sign in to comment.

Answers (2)

John D'Errico
John D'Errico on 16 Oct 2020
Edited: John D'Errico on 16 Oct 2020
There was NO error returned. It was a WARNING, that while you want to find a solution, none could be found. There are many things in life we may want, but just wanting is not enough to insure something will exist.
In fact, it is pretty easy to show that for general unknown values of the parameters, especially n, no explicit solution interms of radicals will exist as an algebraic expression.
So no, MATLAB cannot solve that problem. But then, neither can any other tool. You cannot solve what is impossible to solve. In fact, it is amazingly easy to write an expression for which no solution can exist. You just did.
If you KNOW numerical values for all of the parameters, thus p,n,x,c,w, then you can supply them, and use a numerical solver. This would be either vpasolve or fzero, although fsolve could also be used. fzero or vpasolve would be better choices.

  0 Comments

Sign in to comment.


Jesús Zambrano
Jesús Zambrano on 16 Oct 2020
Hi Philip,
You are right with your approach. I'm afraid there is not explicit solution of this equation for 'q'.

  0 Comments

Sign in to comment.

Products


Release

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by