필터 지우기
필터 지우기

hi, find the value of x theoretically?

조회 수: 70 (최근 30일)
sumayyia
sumayyia 2024년 8월 15일 12:53
댓글: Sam Chak 2024년 8월 15일 21:28
find the value of x?
((log(1-exp(-x/s)^(n))-log(1-a^(1-exp(-x/s)^(n))))/(1-a))=1/2

답변 (3개)

John D'Errico
John D'Errico 2024년 8월 15일 13:19
편집: John D'Errico 2024년 8월 15일 21:01
Do you assume that every expression you can write down has an analytical, neatly written algebraic solution? Surely not.
Start by looking at what you have. A nice thing about using the symbolic TB here is it gives a pretty display. Far easier to read.
syms x s a n
((log(1-exp(-x/s)^(n))-log(1-a^(1-exp(-x/s)^(n))))/(1-a)) == 1/2
ans = 
Multiply by a-1. If a is 1, then you are hosed anyway, so that costs little. Take the exponential of both sides to get rid of the logs. Still doable using pencil and paper.
Next, recognize that x, s, and n ALWAYS appear in exactly the same way, as exp(-x/s)^n. Call that something. I'll use the name u. That leaves us with the "simpler" problem (since the difference of logs is the log of the ratio)...
syms u
simplerelation = (1-u)/(1-a^(1-u)) == exp((1-a)/2)
simplerelation = 
If that has no solution, then the original one would have no solution. But seriously, I don't expect that even this simple version has any solution. Not every problem you can write down will have a simple solution. I definitely recall a wise person having said that just recently.
solve(simplerelation,u)
Warning: Unable to find explicit solution. For options, see help.
ans = Empty sym: 0-by-1
If you know the value of a, then you might be able to use a numeric solver to find a solution. For example,
usol = vpasolve(subs(simplerelation,a,1.5))
usol = Empty sym: 0-by-1
usol = vpasolve(subs(simplerelation,a,0.5))
usol = 
1.329901409878640707645142972604
So for some values of a, a solution might or might not exist. Now you could recover the value of x from the transformation to u we did before. But this presumes a KNOWN value for a. Without that, you are stuck.
Sigh, is there abolutely nothing we can do beyond that point? Well, yes. We can plot it, to see when a solution might exist. fimplicit is a terribly useful tool at times.
fimplicit(simplerelation)
xlabel a
ylabel u
grid on
hold on
plot(0.5,1.3299,'ro')
hold off
And there we can see a singularity when a==1. Ignore that line. I've plotted the solution we did find, just to convince you I labeled the axes correctly.
What you should take from this is that while no simple algebraic solution seems to exist, you can still do something. But it kind of presumes you know the value of a. Finally, could we have even gone further? Well, yes. If we had a good approximation for the resulting curve, thus u(a), we could actually end up with an expression, for x(a), as then an algebraic function also of s and n. For example, you might decide to find a series approximation for u(a), or perhaps a Pade approximation would seem reasonable, given the singularity at a==1.
As such, we might do something like this:
avec = linspace(0,1,100);avec(end) = [];
uvec = zeros(size(avec));
uvec = zeros(size(avec));
for i = 1:numel(avec)
uvec(i) = double(vpasolve(subs(simplerelation,a,avec(i))));
end
plot(avec,uvec)
And then we can try to remove the known singularity at a==1, like this:
plot(avec,uvec.*(1-avec))
This makes the problem far more well-behaved, as you can see.
mdl = fit(avec',(uvec.*(1-avec))','rat33');
Warning: Start point not provided, choosing random start point.
plot(mdl,avec,uvec.*(1-avec))
How well does it work?
upred = @(A) mdl(A)./(1-A);
u_a = upred(0.5)
u_a = 1.3221
Which seems reasonably close. You can then expand the rational polynomial approximation, combined with n and s, to provide a complete, though only approximate solution to the original problem, valid over the region of support, here the half open interval [0,1). Again though, there simply is no theoretical solution, even though this would come as absolutely close to one as you could find.
We can do slightly better in trying to remove that essential singularity. This will allow us to use a lower order model, and still have a good approximation, or we can use the same rat33 approximation, and get a better fit.
mdl = fit(avec',(uvec.*(1-avec).^1.18)','rat33');
Warning: Start point not provided, choosing random start point.
plot(mdl,avec,uvec.*(1-avec).^1.18)
upred2 = @(A) mdl(A)./(1-A).^1.18;
u_a = upred2(0.5)
u_a = 1.3240
So here we would find the final formula for x, as a function of a, n, and s as:
% x = -log(nthroot(upred2(a),n))*s;
And that is about as much of an expression for x, as a function of the three parameters as we can find. We could expand that, substituting in the rational polynomial expansion buried in mdl and upred. It would be pretty messy looking, so I'll stop here. Anyway, while you can't have absolutely everything you want, this is about as close as mathematics can take you. Other methods of approximation at the end might also help. For example, we might try a polynomial series approximation, or even try using a tool like chebfun. The nice thing about the rational polynomial is it is quite concise for the quality of the fit that can be achieved.

Torsten
Torsten 2024년 8월 15일 13:03
이동: Torsten 2024년 8월 15일 13:05
Specify numerical values for s, a and n and use "fzero" to solve
f(x) = ((log(1-exp(-x/s)^(n))-log(1-a^(1-exp(-x/s)^(n))))/(1-a))-1/2 = 0
If you substitute
y = 1-exp(-x/s)^n
, you only need to specify "a" as a numerical value.

Star Strider
Star Strider 2024년 8월 15일 13:11
The symbolic approach will not work, however I left the symbolic code in (commented out) in case you want to experiment with it.
Try this —
% syms a n s x real
% Eqn = ((log(1-exp(-x/s)^(n))-log(1-a^(1-exp(-x/s)^(n))))/(1-a)) == 1/2
% x = isolate(Eqn, x)
%
% clear all
s = rand
s = 0.0838
a = rand
a = 0.7936
n = rand;
Eqn = @(x) ((log(1-exp(-x/s)^(n))-log(1-a^(1-exp(-x/s)^(n))))/(1-a)) - 1/2
Eqn = function_handle with value:
@(x)((log(1-exp(-x/s)^(n))-log(1-a^(1-exp(-x/s)^(n))))/(1-a))-1/2
x0 = rand
x0 = 0.2005
x_solved = fsolve(Eqn, x0)
Equation solved. fsolve completed because the vector of function values is near zero as measured by the value of the function tolerance, and the problem appears regular as measured by the gradient.
x_solved = -0.2722
Experiment with differnt functions and different initial parameter estimates
.
  댓글 수: 8
John D'Errico
John D'Errico 2024년 8월 15일 20:42
As I show in my answer, you can't have everything. But that does not mean you can do nothing either. You can remove two of the parameters from the problem, since they enter in trivially. Having done that, now you can resort to several schemes. For example, a rational polynomial approximation was the one I chose, but a simple series approximation would suffice too.
Sam Chak
Sam Chak 2024년 8월 15일 21:28
@sumayyia: i need x-value as an expression (not needed a numeric value of x)
I believe that you do not intend to publish the "solution x" in the academic journal.
It would be helpful if you could share your intended use for the mathematical expression of x, as this would help us understand the specific problem you are aiming to solve.

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

태그

Community Treasure Hunt

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

Start Hunting!

Translated by