Info
Questa domanda è chiusa. Riaprila per modificarla o per rispondere.
solving a "stiff algebraic equation"
2 visualizzazioni (ultimi 30 giorni)
Mostra commenti meno recenti
Hello everyone,
I have a question of great practical importance for me, but I would like to ask it on a bit more of a theoretical mode, because I feel I lack the basic knowledge on it.
I have to solve an algebraic equation. At some points in the function that I have to define, I stumble upon a term that looks somewhat like :
exp( (A-exp(x))*B )
where B >> 1 (let's say B=10^6). Let's assume here that A is 1 and x is the unknown parameter I want to solve for.
Here is the problem that I encounter : there is very very few flexibility on the acceptable values of x for matlab.
Let's say we have an initial guess corresponding to a value of 1.1 for exp(x). Then (1-exp(x))*B = 10^5, which is way beyond what matlab can handle (realmax = 1.8e308). Matlab understands the term as an infinite value, which, as you can guess, leads to many problems for further solving. Actually, a homebrew implementation of Halley's method shows me that the value of this term switches directly from 0 to inf as (A-exp(x))*B switches sign during iterations ! This is an indication that abs((A-exp(x))*B) is simply too big unless x is very close to ln(A)
In fact, A-exp(x) has to be very small for matlab to handle the thing. Which means that the search interval should be very very small and x always very close to ln(A). The solution in genral has no reason to be ln(A) (there are many other terms in the eqution apart from this problematic one).
Any algorithm that fidgets around a little bit too much will end up having troubles of inf values. I have tried several, with different reformulations of my equations, but in the end, it seems it always come down to this problem. If I try to reformulate with log functions for example, the thing in the log turns out to be very sensible too, and become very easily negative as the algorithm tries different values of x, causing similar problems.
My first question is : how do we describe this particular kind of sensible numerical problems with algebraic equations ? Surely, this is nothing new, and many people more clever than I am have worked on this kind of issue before, so I would like to look into it with the right keywords. The closest idea that I could think of, would be the "stiffness" of ODEs, but here I am working with a purely algebraic system.
Second : what kind of workaround could I try? Of course, the naive one would be to just increase the realmax value of matlab, which should help get my way around these annoying inf values. But I don't think it's possible, and probably not a good idea to do it anyway with numbers in the order of exp(10^6~7). And even if I could do that, I suppose anyway that having a term suddenly switching from 0 to exp(10^6) is a surprise that would be very poorly appreciated by most solvers...
Otherwise, I thought of trying to set bounds for x so that it doesn't go insane. But this turns out to have the same kind problems with a lot of log( -...), very similar to the actual solving. Which makes sense because finding such a precise search interval for x would pretty much mean solving the equation for me :D
Is there some built-in functions made for these kind of problems, or some famous algorithms that I could try to implement ?
Thanks in advance. I hope the question is not too general, but I wanted to keep that way at first to improve my global understanding of the problem
0 Commenti
Risposte (0)
Questa domanda è chiusa.
Vedere anche
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!