"Eliminate" command.
조회 수: 6 (최근 30일)
이전 댓글 표시
Hey everyone, im having trouble again. I cant seem to get the "eliminate" command to work. My code is here:
syms a b p x L R y
F = [p/2,0];
xpara = [x sqrt(2*p*x)];
eqn1 = a*F(1,1)+b == 0;
eqn2 = a*x+b == xpara(1,2);
eqns = [eqn1 eqn2];
%L - lambda.
eqns = [a*F(1,1)+b == 0, subs(a*x+b,x,L) == subs(xpara(1,2),x,L)];
S=solve(eqns,[a b],'ReturnConditions',true);
S.a;
S.b;
sirge =simplify(S.a*x+S.b);
loikepunktx = solve(sirge==-xpara(1,2),x,'ReturnConditions',true);
%sirge võrrand
loikepunktx.x=loikepunktx.x(2,1);
loikepunktx.x;
sirge1 = simplify(S.a * loikepunktx.x + S.b);
sirge1;
LP = [loikepunktx.x, sirge1];
%Center = KP
KP = subs(simplify((xpara + LP)/2),x,L);
%ok so far
xpara;
KP;
%raadius
R = simplify(subs(sqrt((xpara(1,1)-KP(1,1))^2+(xpara(1,2)-KP(1,2))^2),x,L));
%raadius ok
%mähisjoon
Parv = ((x - KP(1,1))^2 + (y - KP(1,2))^2 - R^2);
%parv ok
Tuletis = simplify(diff(Parv,L));
%tuletis ok
eqn=[Parv==0; Tuletis==0]
eemaldus = eliminate(eqn,L)
And the eliminate gives me an error:

But my goal is to get this:
All works im wolframalpha and i can check the outcomes there but Matlab just does not want to be friendly with me.
댓글 수: 0
답변 (1개)
Walter Roberson
2021년 5월 30일
Both of your equations contain sqrt(L*p) and so are not rational expressions of polynomials in your variable L.
Provided that you know that L is positive, then what you can do is:
syms a b p x L R y
F = [p/2,0];
xpara = [x sqrt(2*p*x)];
eqn1 = a*F(1,1)+b == 0;
eqn2 = a*x+b == xpara(1,2);
eqns = [eqn1 eqn2];
%L - lambda.
eqns = [a*F(1,1)+b == 0, subs(a*x+b,x,L) == subs(xpara(1,2),x,L)];
S=solve(eqns,[a b],'ReturnConditions',true);
S.a;
S.b;
sirge =simplify(S.a*x+S.b);
loikepunktx = solve(sirge==-xpara(1,2),x,'ReturnConditions',true);
%sirge võrrand
loikepunktx.x=loikepunktx.x(2,1);
loikepunktx.x;
sirge1 = simplify(S.a * loikepunktx.x + S.b);
sirge1;
LP = [loikepunktx.x, sirge1];
%Center = KP
KP = subs(simplify((xpara + LP)/2),x,L);
%ok so far
xpara;
KP;
%raadius
R = simplify(subs(sqrt((xpara(1,1)-KP(1,1))^2+(xpara(1,2)-KP(1,2))^2),x,L));
%raadius ok
%mähisjoon
Parv = ((x - KP(1,1))^2 + (y - KP(1,2))^2 - R^2);
%parv ok
Tuletis = simplify(diff(Parv,L));
%tuletis ok
eqn=[Parv==0; Tuletis==0]
syms sqL positive
eqn2 = simplify(subs(eqn, L, sqL^2))
eemaldus = eliminate(eqn2, sqL)
At the moment I do not understand how it comes up with a solution involving up to p^104, and I am concerned that that might be the result of an approximation rather than a complete solution.
댓글 수: 2
Paul
2021년 5월 30일
If I understand the eliminate() function, it returns an expression that is equal to zero.
eqn3 = eemaldus == 0;
simplify(eqn3)
So really only an expresion in p^6 it would appear.
Walter Roberson
2021년 5월 30일
Good point -- it must be possible to factor out an expression in p.
I would be concerned that doing so might be losing theoretical roots such as p being 92'nd roots of -2*x... but I doubt those are really roots anyhow.
참고 항목
카테고리
Help Center 및 File Exchange에서 Spline Postprocessing에 대해 자세히 알아보기
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!

