How to solve a large equation with one variable
1 次查看(过去 30 天)
显示 更早的评论
Dear all, I need to solve a long equation. I need to read from the input files and get to know how many terms I have and the corresponding coefficients. Then I need to sum them up and set to a constant and solve it. I have tried solve, but got "Explicit solution could not be found." Can anyone help me?
The equation looks like: 10=0.01*1/(exp(129-2.5*10^5*x)/10) + 1))+ 0.02*1/(exp(150-2.5*10^5*x)/10) + 1))+ 0.02*1/(exp(200-2.5*10^5*x)/10) + 1))+ ...
Thanks a lot, Zhiting
2 个评论
Walter Roberson
2011-9-23
In your expression, you have "+1))" several times. In each of the cases, there is no match for either of the "))" which suggests that your equation does _not_ look like what you indicate.
Can you create a smaller example and show it here? It is difficult for us to suggest how to solve an unknown equation.
回答(1 个)
Walter Roberson
2011-9-24
Expressions of this form, and which have N terms, have N solutions, some of which are almost certain to be complex. All of the solutions will be complex if the sum of the numerators (0.01, 0.02 and so on) is not at least as large as the left hand side (10 in this example.)
The solution involves solving a polynomial of degree N; there is, as usual, no general analytic solution when N is 5 or more.
However, MuPad should automatically switch to solving numerically when it cannot find the analytic solution.
If all of the terms are of the form shown, then I see no good reason for MuPad to be unable to formulate the solution, other than perhaps running out of memory or perhaps ending up with a number too big to represent. I have observed, though, that MuPad looks to be weak on finding numeric solutions to polynomials of higher order.
4 个评论
Walter Roberson
2011-9-26
solve() attempts to generate analytical solutions, and according to the documentation if it cannot generate analytical solutions it should try numeric solutions -- though in such a case you would get a warning about explicit solutions not found. "explicit" is the same as "analytic" for the purposes of that warning.
Nominally, solve() should return (an approximation of) an answer if there is one, but that does of course depend upon solve()'s built-in mathematical knowledge. As a user of symbolic mathematics, I would _expect_ solve() to be able to at least resolve down to a RootOf() object if polynomials are involved (as they are for the equations you are working with); but unfortunately in reading about people's difficulties with solve() in MuPad, MuPad doesn't seem know how to deal with higher orders.
I have a mental glimmer about how you might be able to generalize the problem and thus work out the polynomial whose roots you need to find; if you had a generalized form like that, it should be possible to proceed using roots() instead of symbolic equations; roots() is the numeric roots finder.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!