Predefined variables k, z? Ans Help

조회 수: 6 (최근 30일)
Jennifer . 2012년 12월 7일
Below is my Matlab code that I entered, and the response I got.
>> clear
>> syms x a
>> Func=(.45*cos(x/a)/((sin(x/a))^6))*(5/8*(1-cos(x/a))-(5/48*(1-cos(3*x/a)))+(1/80*(1-cos(5*x/a))))+.09
ans =
-a*(2*pi*k + i*log(z))
What in the world are k and z? When I input k I receive an error saying Undefined, z... undefined.
Please help.
Thank you,

답변 (3개)

Roger Stafford
Roger Stafford 2012년 12월 8일
The expression in your 'Func' is identically equal to
and therefore c = cos(x/a) is one of the three roots of the cubic equation
6*c^3+18*c^2+17*c+3 = 0.
This gives the six roots of a*acos(c) and -a*acos(c):
a*( 2.6773079709553582 - 1.0064927801893431*i)
a*( 2.6773079709553582 + 1.0064927801893431*i)
a*( 1.7996177555153143)
a*(-2.6773079709553582 + 1.0064927801893431*i)
a*(-2.6773079709553582 - 1.0064927801893431*i)
plus any integral multiple of 2*pi*a.
I have no idea what the z represents in the solution you describe.
Roger Stafford

Matt Fig
Matt Fig 2012년 12월 7일
편집: Matt Fig 님. 2012년 12월 7일
k is a integer constant: Any integer k gives another solution. This is common with periodic functions. z is probably any complex number, but I am guessing here as I do not get this same solution.
Something doesn't look right about that solution. What version of MATLAB are you using?

Walter Roberson
Walter Roberson 2012년 12월 7일
The "k" probably stands for "an arbitrary integer", but the log(z) has no obvious purpose there, not unless a RootOf() showed up somewhere and you for some reason edited it out.
If we convert the 0.45 and 0.09 to rational values, one version of the analytic solutions are:
(arctan(2^(1/2)*((36+2*322^(1/2))^2*(1+i*3^(1/2))-(36+2*322^(1/2))^(2/3)*(24*322^(1/2)+8*(36+2*322^(1/2))^(2/3)+428-(24*i)*966^(1/2)+24*(36+2*322^(1/2))^(1/3)-(428*i)*3^(1/2)+(24*i)*(36+2*322^(1/2))^(1/3)*3^(1/2)))^(1/2)*(36+2*322^(1/2))^(1/3)/(432+24*322^(1/2)), (1/12)*(-1+i*3^(1/2))*(36+2*322^(1/2))^(1/3)-((1/6)*i)*3^(1/2)/(36+2*322^(1/2))^(1/3)-(1/6)/(36+2*322^(1/2))^(1/3)-1)+2*pi*Z)*a
(arctan(-2^(1/2)*((36+2*322^(1/2))^2*(1+i*3^(1/2))-(36+2*322^(1/2))^(2/3)*(24*322^(1/2)+8*(36+2*322^(1/2))^(2/3)+428-(24*i)*966^(1/2)+24*(36+2*322^(1/2))^(1/3)-(428*i)*3^(1/2)+(24*i)*(36+2*322^(1/2))^(1/3)*3^(1/2)))^(1/2)*(36+2*322^(1/2))^(1/3)/(432+24*322^(1/2)), (1/12)*(-1+i*3^(1/2))*(36+2*322^(1/2))^(1/3)-((1/6)*i)*3^(1/2)/(36+2*322^(1/2))^(1/3)-(1/6)/(36+2*322^(1/2))^(1/3)-1)+2*pi*Z)*a
(arctan((-2*(36+2*322^(1/2))^2*(-1+i*3^(1/2))+2*(36+2*322^(1/2))^(2/3)*(-24*322^(1/2)-8*(36+2*322^(1/2))^(2/3)-428-(24*i)*966^(1/2)-24*(36+2*322^(1/2))^(1/3)-(428*i)*3^(1/2)+(24*i)*(36+2*322^(1/2))^(1/3)*3^(1/2)))^(1/2)*(36+2*322^(1/2))^(1/3)/(432+24*322^(1/2)), (1/12)*(-1-i*3^(1/2))*(36+2*322^(1/2))^(1/3)+((1/6)*i)*3^(1/2)/(36+2*322^(1/2))^(1/3)-(1/6)/(36+2*322^(1/2))^(1/3)-1)+2*pi*Z)*a
(arctan(-(-2*(36+2*322^(1/2))^2*(-1+i*3^(1/2))+2*(36+2*322^(1/2))^(2/3)*(-24*322^(1/2)-8*(36+2*322^(1/2))^(2/3)-428-(24*i)*966^(1/2)-24*(36+2*322^(1/2))^(1/3)-(428*i)*3^(1/2)+(24*i)*(36+2*322^(1/2))^(1/3)*3^(1/2)))^(1/2)*(36+2*322^(1/2))^(1/3)/(432+24*322^(1/2)), (1/12)*(-1-i*3^(1/2))*(36+2*322^(1/2))^(1/3)+((1/6)*i)*3^(1/2)/(36+2*322^(1/2))^(1/3)-(1/6)/(36+2*322^(1/2))^(1/3)-1)+2*pi*Z)*a
In the above, Z stands for any arbitrary integer (including 0 and negative values)
Each of these analytic solutions can be converted from arctan() form to ln() form because arctan(a,b) = -i*ln((b+i*a)/(b^2+a^2)^(1/2))
So possibly what you are seeing is the Symbolic Toolbox answering in ln form, and trying to present the information more compactly... but forgetting to print out the full information. That sometimes happens because of the communications between the MuPAD engine and MATLAB.
  댓글 수: 3
Walter Roberson
Walter Roberson 2012년 12월 8일
Matt, when you solve() a expression that has floating point values, using Symbolic Toolbox, then the first thing it does is convert the floating point values to rationals. (This does not apply to sym() constructed with the decimal flag.) The Maple equivalent is to convert(expression,rational) . If you do not do that in Maple, you get "floating point pollution" (that is, at each stage, rationals and floating point are automatically combined to give floating point values with only Digits working precision.)
The "k" in the MuPAD output suggested that it was trying to give the generalized output. The Maple form of that is to solve() with AllSolutions as an option.
The large output I gave was Maple, converting each of the two floating point values to rational, and solving with AllSolutions; but then afterwards I edited to MuPAD output form (e.g., Pi -> pi, I -> i, _Z1 -> Z)

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

Community Treasure Hunt

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

Start Hunting!

Translated by