Analytic solution not possible. Can i solve with curve fitting?

Hi everyone,
I have four variables:
syms a, b, k, t
I have also two equations:
tan(k)=cos(0.43)*cos(b)/(cos(0.43)*sin(b)*sin(a)+sin(0.43)*cos(a))
tan(t)*sin(k)=cos(0.43)*cos(b)/(cos(0.43)*sin(b)*cos(a)-sin(0.43)*sin(a))
I need to solve a and b with respect to k and t so that i have
a=f1(k,t)
and
b=f2(k,t)
solve() doesn't give an anlytical solution and gives a solution with RootOf. Is there any way to solve analytically?
If not how can i fit a curve for a and b where 0<k<2*pi and 0<t<pi/2
Any help is appreciated in advance.

10 Comments

The RootOf() is degree 4. You can ask for it to be written out explicitly by using the 'MaxDegree',4 option of solve.
a = arctan(-2503225587309111.*((abs(cos(t)*cos(k)*sin(t))*cos(k)*cos(t)-1.*signum(cos(t))*abs(sin(t)*cos(k))*cos(k)+signum(cos(k))*abs(sin(t)*cos(t))*cos(t))*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)-0.1440446168973502e17*cos(k)*(cos(t)+1.)*(cos(t)-1.)*((cos(t)^2-1.)*cos(k)^2-1.*cos(t)^2+.3475625318359482)*cos(t))/((5006451174618222.*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.3605761707315852e32*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.2979147873219948e32*cos(k)^2-0.6266138340959044e31)*cos(t)^2+0.6266138340959044e31*cos(k)^2)^(1/2)*sin(t)), (5006451174618222.*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.3605761707315852e32*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.2979147873219948e32*cos(k)^2-0.6266138340959044e31)*cos(t)^2+0.6266138340959044e31*cos(k)^2)^(1/2))
b = arctan(-0.3605761707315852e32*(-0.6942293447263117e-16*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(t))*abs(sin(t)*cos(k))+((cos(t)^2-1.)*cos(k)^2-1.*cos(t)^2+.1737812659179741)*cos(t))*sin(t)/((-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(k))*abs(sin(t)*cos(t))-2503225587309111.*cos(t)^2*cos(k)+2503225587309111.*cos(k)), 6004799503160661.*sin(t)^2*sin(k)*(5006451174618222.*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.3605761707315852e32*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.2979147873219948e32*cos(k)^2-0.6266138340959044e31)*cos(t)^2+0.6266138340959044e31*cos(k)^2)^(1/2)/((-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(k))*abs(sin(t)*cos(t))-2503225587309111.*cos(t)^2*cos(k)+2503225587309111.*cos(k)))
a = arctan(0.6942293447263117e-16*((abs(cos(t)*cos(k)*sin(t))*cos(k)*cos(t)-1.*signum(cos(t))*abs(sin(t)*cos(k))*cos(k)+signum(cos(k))*abs(sin(t)*cos(t))*cos(t))*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)-0.1440446168973502e17*cos(k)*(cos(t)+1.)*(cos(t)-1.)*((cos(t)^2-1.)*cos(k)^2-1.*cos(t)^2+.3475625318359482)*cos(t))/((5006451174618222.*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.3605761707315852e32*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.2979147873219948e32*cos(k)^2-0.6266138340959044e31)*cos(t)^2+0.6266138340959044e31*cos(k)^2)^(1/2)*sin(t)), -0.2773339119917620e-31*(5006451174618222.*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.3605761707315852e32*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.2979147873219948e32*cos(k)^2-0.6266138340959044e31)*cos(t)^2+0.6266138340959044e31*cos(k)^2)^(1/2))
b = arctan(-0.3605761707315852e32*(-0.6942293447263117e-16*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(t))*abs(sin(t)*cos(k))+((cos(t)^2-1.)*cos(k)^2-1.*cos(t)^2+.1737812659179741)*cos(t))*sin(t)/((-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(k))*abs(sin(t)*cos(t))-2503225587309111.*cos(t)^2*cos(k)+2503225587309111.*cos(k)), -6004799503160661.*sin(t)^2*sin(k)*(5006451174618222.*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.3605761707315852e32*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.2979147873219948e32*cos(k)^2-0.6266138340959044e31)*cos(t)^2+0.6266138340959044e31*cos(k)^2)^(1/2)/((-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(k))*abs(sin(t)*cos(t))-2503225587309111.*cos(t)^2*cos(k)+2503225587309111.*cos(k)))
a = arctan(2503225587309111.*((abs(cos(t)*cos(k)*sin(t))*cos(k)*cos(t)-1.*signum(cos(t))*abs(sin(t)*cos(k))*cos(k)+signum(cos(k))*abs(sin(t)*cos(t))*cos(t))*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)+0.1440446168973502e17*cos(k)*(cos(t)+1.)*(cos(t)-1.)*((cos(t)^2-1.)*cos(k)^2-1.*cos(t)^2+.3475625318359482)*cos(t))/((-0.1805206993498485e48*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.1300151748994533e64*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.1074209732168795e64*cos(k)^2-0.2259420168257380e63)*cos(t)^2+0.2259420168257380e63*cos(k)^2)^(1/2)*sin(t)), 0.2773339119917620e-31*(-0.1805206993498485e48*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.1300151748994533e64*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.1074209732168795e64*cos(k)^2-0.2259420168257380e63)*cos(t)^2+0.2259420168257380e63*cos(k)^2)^(1/2))
b = arctan(0.3605761707315852e32*(0.6942293447263117e-16*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(t))*abs(sin(t)*cos(k))+((cos(t)^2-1.)*cos(k)^2-1.*cos(t)^2+.1737812659179741)*cos(t))*sin(t)/((-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(k))*abs(sin(t)*cos(t))+2503225587309111.*cos(t)^2*cos(k)-2503225587309111.*cos(k)), -1.*sin(t)^2*sin(k)*(-0.1805206993498485e48*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.1300151748994533e64*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.1074209732168795e64*cos(k)^2-0.2259420168257380e63)*cos(t)^2+0.2259420168257380e63*cos(k)^2)^(1/2)/((-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(k))*abs(sin(t)*cos(t))+2503225587309111.*cos(t)^2*cos(k)-2503225587309111.*cos(k)))
a = arctan(-2503225587309111.*((abs(cos(t)*cos(k)*sin(t))*cos(k)*cos(t)-1.*signum(cos(t))*abs(sin(t)*cos(k))*cos(k)+signum(cos(k))*abs(sin(t)*cos(t))*cos(t))*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)+0.1440446168973502e17*cos(k)*(cos(t)+1.)*(cos(t)-1.)*((cos(t)^2-1.)*cos(k)^2-1.*cos(t)^2+.3475625318359482)*cos(t))/((-0.1805206993498485e48*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.1300151748994533e64*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.1074209732168795e64*cos(k)^2-0.2259420168257380e63)*cos(t)^2+0.2259420168257380e63*cos(k)^2)^(1/2)*sin(t)), -0.2773339119917620e-31*(-0.1805206993498485e48*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.1300151748994533e64*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.1074209732168795e64*cos(k)^2-0.2259420168257380e63)*cos(t)^2+0.2259420168257380e63*cos(k)^2)^(1/2))
b = arctan(0.3605761707315852e32*(0.6942293447263117e-16*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(t))*abs(sin(t)*cos(k))+((cos(t)^2-1.)*cos(k)^2-1.*cos(t)^2+.1737812659179741)*cos(t))*sin(t)/((-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(k))*abs(sin(t)*cos(t))+2503225587309111.*cos(t)^2*cos(k)-2503225587309111.*cos(k)), sin(t)^2*sin(k)*(-0.1805206993498485e48*(-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*abs(cos(t)*cos(k)*sin(t))-0.1300151748994533e64*(cos(k)-1.)*(cos(k)+1.)*cos(t)^4+(0.1074209732168795e64*cos(k)^2-0.2259420168257380e63)*cos(t)^2+0.2259420168257380e63*cos(k)^2)^(1/2)/((-0.3605761707315852e32*(cos(t)-1.)*(cos(t)+1.)*cos(k)^2+0.3605761707315852e32*cos(t)^2-0.6266138340959044e31)^(1/2)*signum(cos(k))*abs(sin(t)*cos(t))+2503225587309111.*cos(t)^2*cos(k)-2503225587309111.*cos(k)))
Obvious, eh?
Thank you very much Mr. Roberson. One last little question: What is the meaning of the dots in the solution? I made some research but still not sure.
If you are referring to the dots in 1. then those are normal numeric decimal points. The tool I used created a number of large rational values that were unreadable so I had it convert everything to floating point and it did so even for values such as 1
Without the messy large numbers:
a = arctan((cos(k)^4*cos(t)^4-cos(43/100)^2*cos(t)^2*cos(k)^2-cos(k)^2*cos(t)^4-2*cos(k)^4*cos(t)^2-2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)-cos(43/100)^2*cos(t)^2+cos(43/100)^2*cos(k)^2+2*cos(k)^2*cos(t)^2+cos(k)^4+cos(t)^2-cos(k)^2)^(1/2), ((-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(t)+sin(43/100)*sin(t)*cos(k))*(cos(k)^4*cos(t)^4-cos(43/100)^2*cos(t)^2*cos(k)^2-cos(k)^2*cos(t)^4-2*cos(k)^4*cos(t)^2-2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)-cos(43/100)^2*cos(t)^2+cos(43/100)^2*cos(k)^2+2*cos(k)^2*cos(t)^2+cos(k)^4+cos(t)^2-cos(k)^2)^(1/2)/(cos(k)*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*sin(t)-cos(t)*sin(43/100)))
b = arctan((-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2), sin(t)*(-2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)+((-cos(k)^2-1)*cos(t)^2+cos(k)^2)*cos(43/100)^2+(cos(k)^4-cos(k)^2)*cos(t)^4+(-2*cos(k)^4+2*cos(k)^2+1)*cos(t)^2+cos(k)^4-cos(k)^2)^(1/2)*sin(k)/(cos(k)*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*sin(t)-cos(t)*sin(43/100)))
a = arctan(-(-2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)+((-cos(k)^2-1)*cos(t)^2+cos(k)^2)*cos(43/100)^2+(cos(k)^4-cos(k)^2)*cos(t)^4+(-2*cos(k)^4+2*cos(k)^2+1)*cos(t)^2+cos(k)^4-cos(k)^2)^(1/2), ((-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(t)+sin(43/100)*sin(t)*cos(k))*(-2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)+((-cos(k)^2-1)*cos(t)^2+cos(k)^2)*cos(43/100)^2+(cos(k)^4-cos(k)^2)*cos(t)^4+(-2*cos(k)^4+2*cos(k)^2+1)*cos(t)^2+cos(k)^4-cos(k)^2)^(1/2)/(-cos(k)*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*sin(t)+cos(t)*sin(43/100)))
b = arctan((-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2), sin(t)*(-2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)+((-cos(k)^2-1)*cos(t)^2+cos(k)^2)*cos(43/100)^2+(cos(k)^4-cos(k)^2)*cos(t)^4+(-2*cos(k)^4+2*cos(k)^2+1)*cos(t)^2+cos(k)^4-cos(k)^2)^(1/2)*sin(k)/(-cos(k)*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*sin(t)+cos(t)*sin(43/100)))
a = arctan((cos(k)^4*cos(t)^4-cos(43/100)^2*cos(t)^2*cos(k)^2-cos(k)^2*cos(t)^4-2*cos(k)^4*cos(t)^2+2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)-cos(43/100)^2*cos(t)^2+cos(43/100)^2*cos(k)^2+2*cos(k)^2*cos(t)^2+cos(k)^4+cos(t)^2-cos(k)^2)^(1/2), -(-(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(t)+sin(43/100)*sin(t)*cos(k))*(cos(k)^4*cos(t)^4-cos(43/100)^2*cos(t)^2*cos(k)^2-cos(k)^2*cos(t)^4-2*cos(k)^4*cos(t)^2+2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)-cos(43/100)^2*cos(t)^2+cos(43/100)^2*cos(k)^2+2*cos(k)^2*cos(t)^2+cos(k)^4+cos(t)^2-cos(k)^2)^(1/2)/(cos(t)*sin(43/100)+cos(k)*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*sin(t)))
b = arctan(-(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2), -sin(t)*(2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)+((-cos(k)^2-1)*cos(t)^2+cos(k)^2)*cos(43/100)^2+(cos(k)^4-cos(k)^2)*cos(t)^4+(-2*cos(k)^4+2*cos(k)^2+1)*cos(t)^2+cos(k)^4-cos(k)^2)^(1/2)*sin(k)/(cos(t)*sin(43/100)+cos(k)*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*sin(t)))
a = arctan(-(2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)+((-cos(k)^2-1)*cos(t)^2+cos(k)^2)*cos(43/100)^2+(cos(k)^4-cos(k)^2)*cos(t)^4+(-2*cos(k)^4+2*cos(k)^2+1)*cos(t)^2+cos(k)^4-cos(k)^2)^(1/2), (-(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(t)+sin(43/100)*sin(t)*cos(k))*(2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)+((-cos(k)^2-1)*cos(t)^2+cos(k)^2)*cos(43/100)^2+(cos(k)^4-cos(k)^2)*cos(t)^4+(-2*cos(k)^4+2*cos(k)^2+1)*cos(t)^2+cos(k)^4-cos(k)^2)^(1/2)/(cos(t)*sin(43/100)+cos(k)*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*sin(t)))
b = arctan(-(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2), sin(t)*(2*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*cos(k)*sin(43/100)*sin(t)*cos(t)+((-cos(k)^2-1)*cos(t)^2+cos(k)^2)*cos(43/100)^2+(cos(k)^4-cos(k)^2)*cos(t)^4+(-2*cos(k)^4+2*cos(k)^2+1)*cos(t)^2+cos(k)^4-cos(k)^2)^(1/2)*sin(k)/(cos(t)*sin(43/100)+cos(k)*(-cos(k)^2*cos(t)^2+cos(43/100)^2+cos(t)^2+cos(k)^2-1)^(1/2)*sin(t)))
Mr Roberson I cannot thank you enough. Unfortunately I needed to update my equations. Sorry I didn't care for true equations at the beginnig because I was expecting only ideas not the exact solution :) Can you provide the functions that you used so I can try to solve myself. Here are the correct equations in case you want to implement them in your previous file and see the exact results:
tan(k)=(cos(0.4363)*cos(b)*sin(a)-sin(0.4363)*cos(a))/(cos(0.4363)*sin(b)) tan(t)*cos(k)=cos(0.4363)*sin(b)/(cos(0.4363)*cos(b)*cos(a)+sin(0.4363)*sin(a))
This one is taking a lot longer to resolve.
As you have a restricted range of values, it is plausible that you might be able to use a taylor or similar series to find a multinomial that fits well enough over the range. That might be good enough if a and b are restricted range and the goal of all of this is to create some kind of interpolating formula for hardware lookup table. But is it possible that what you need is just a decent starting estimate for a and b that you could then use with fsolve() to find the actual values?
Unfortunately this is not for a lookup table. Hardware will adjust a and b according to the input k and t values. So I need some kind of functional relation between them. It doesn't need to be analytical though. Any relation accurate enough is accepted. This could also be in a form like
a=f1(k,t) and b=f2(a,k,t)
Or maybe we can numerically approach to some form of equation. Forexample:
a=atan(c5*tan(k)^4*tan(t)^4+c4*tan(k)^3*tan(t)^3+c3*tan(k)^2*tan(t)^2+c2*tan(k)*tan(t)+c1)
Is that possible? By the way -1,1345≤a≤2,0071 and -pi/2≤b≤pi/2
Note that I've gone into the problem in a great deal of depth now in my answer. You need to recognize the relation you want to compute does not have one solution, nor is it at all clear how you would choose between the various solutions.
After Tayloring the equations for 4th order i get the following resutls:
- 0.1667*a^3 + 0.2332*a^2 - 0.5*a*b^2 + a - 1.0*k*b - 0.4663
0.5*a^2*t - 0.4663*a*t - 0.1667*b^3 + 0.5*b^2*t + b + 0.5*k^2*t - 0.3333*t^3 - 1.0*t
These are accurate enough for me. Can we solve these two equations for a and b?
Yes.
b = root([625000000000000, 5625000000000000*t, -11250000000000000, -(5625000000000000*(k^2+34*t^2*(1/3)+88860139/6250000))*t, 67500000000000000+22500000000000000*t^4+(-33750000000000000*k^2+1574775000000)*t^2, 225000000*t*(300000000*k^2+90000*k*t+1648944007*t^2+1565286672), -135000000000000000+7500000000000000*t^6+(-22500000000000000*k^2-184896500400000000)*t^4-283338000000000000*k*t^3+(16875000000000000*k^4+277344750600000000*k^2-3155625000000)*t^2, 225000000*t*(225000000*k^4*t^2-300000000*k^2*t^4+100000000*t^6-2700020997*k^2*t^2+13998*t^4-900000000*k^2-540000*k*t-3782978292*t^2-1995860016), -(101250000000000000*(4*t^4*(1/9)-(1/2500)*k*t^3+(-4*k^2*(1/3)-13860139/4687500)*t^2+((3/5000)*k^3-(50877746477/125000000000)*k)*t+k^4+13860139*k^2*(1/3125000)+9323/25000000))*t^2]);
a = 5000*(2333*b^3-6999*b^2*t-90000*b*k*t-6999*k^2*t+4666*t^3-13998*b-27969*t)/(25000000*b^3+150000000*b^2*t-75000000*k^2*t+50000000*t^3-150000000*b-332636337*t);
Note: this is a set of 9 answers, as root() is the roots of a polynomial of degree 9. Chances are high that some of the solutions will be complex valued.
Also note: I approximated your floating point values as rationals. In particular I approximated 0.1667 as 1/6 and 0.3333 as 1/3

Sign in to comment.

 Accepted Answer

No, you cannot "fit a curve" to this. At least not anything remotely useful, nor do you need to do so.
That a solution is generated using rootof is not bad actually. Just a statement that no analytical solution was found in the form of roots.
You can use vpa to resolve the rootof forms into numbers.
As an addendum, since this problem seems to be hanging around with no resolution.
Again, this is not the purpose of curve fitting, nor can it easily be used for that purpose. Lets see if we can understand SOME of the problems. To do that, I'll need to look in more depth at your problem.
syms a b k t
E(1) = tan(k)==cos(0.43)*cos(b)/(cos(0.43)*sin(b)*sin(a)+sin(0.43)*cos(a));
E(2) = tan(t)*sin(k)==cos(0.43)*cos(b)/(cos(0.43)*sin(b)*cos(a)-sin(0.43)*sin(a));
pretty(vpa(E(1),5))
0.90897 cos(b)
tan(k) == --------------------------------------
0.41687 cos(a) + 0.90897 sin(a) sin(b)
pretty(vpa(E(2),5))
0.90897 cos(b)
sin(k) tan(t) == - --------------------------------------
0.41687 sin(a) - 0.90897 cos(a) sin(b)
So there WILL be infinitely many solutions, if any solution exists. But if we restrict the domain of a and b to lie within [0,2*pi], can we do anything?
Even that is difficult, since there may STILL be multiple solutions.
Lets pick some arbitrary value of k and t, just to see what is happening. Remember that k and t should also be expected to live in ranges. So lets say that
k lives in the interval [-pi,pi]
t lives in the interval [-pi/2,pi/2]
Create a couple of functions.
fun1 = @(a,b) cos(0.43)*cos(b)./(cos(0.43)*sin(b).*sin(a)+sin(0.43)*cos(a));
fun2 = @(a,b) cos(0.43)*cos(b)./(cos(0.43)*sin(b).*cos(a)-sin(0.43)*sin(a));
And a gridded lattice for a and b.
[A,B] = meshgrid(linspace(0,2*pi,100));
f1AB = fun1(A,B);
f2AB = fun2(A,B);
Now, lets do some plots that will be HIGHLY informative.
contour(A,B,f1AB,[1 1]*tan(k),'b')
hold on
contour(A,B,f2AB,[1 1]*sin(k)*tan(t),'r')
grid on
xlabel 'A'
ylabel 'B'
So in blue, we see the solution locus for equation 1. All points on those curves in clue are the solutions of this problem for that equation.
Likewise, all points on those curves in red form the solution locus for equation 2. Any intersection of those curves is a solution to BOTH equations, and therefore an entirely valid solution to your problem.
This is only approximate, because contour was used to solve the problem, on a grid of limited size. But there are clearly something like 12 distinct solutions, where those curves cross.
Now, you MIGHT be able to decide that some of those solutions might be excluded, trying to find a fundamental solution of some sort. However, it is entirely possible that some other choices of t and k might have a different number of solutions. (By the way, I am quite confidant that I can find sets of k and t that have a different number of solutions.) Anyway, which of those solutions is somehow more fundamental than the others?
One thing I can tell you with certainty: CAN you use curve fitting to resolve this problem? NO WAY. PERIOD.
Worse, does there even exist a function g(k,t) that yields the "solution"? Again, this is a multi-valued function. It looks like there will be something like a dozen branches to that function, a dozen possible solutions. So no, you won't find some simple function, positively NOT using curve fitting.
If you were willing to use a table lookup with interpolation, you might consider spending the time to solve this problem for hundreds of values of k and t, isolating the specific pair for a and b that make you happy. Then create a table over a complete grid for k and t in the ranges I showed above. You might then try to use a tool like interp2 to interpolate. Even that approach can be fraught with problems, since you would need to be incredibly careful to find a consistent choice among the dozen (or more or less) solutions that may exist.
Other ideas might revolve around series approximations. But remember that since tan(k) and tan(t) can take on ANY values from -inf to inf, series approximations of any viability will be difficult as hell to find.
Don't think any of this will be easy to do.

9 Comments

Thank you for your time Mr D'Errico. Choosing the correct one among multiple solutions is not a problem for me because for any k and t value I know in which range a and b must be or vice versa. For a specific a and b value I can find k and t with the initial equations. Then I can reverse check that k and t values with solution equations and choose the one which gives same a and b values. Forexample when I solve initial equations for a=0.7854 and b=0.2618 results are k=0.9385 and t=1.5239. Now if I solve equations for k=0.9385 and t=1.5239 with solve function, it returns 5 sets of a and b results and one of them is same with initial a and b values as expected. I think MATLAB uses an explicit function to solve this and symbolic explicit solutions are somewhere out there. I just cannot make any progress after symbolic solve() returns solution with rootof. I just can't make it show them explicitly. Mr Roberson gave explicit solutions for my initial post but I needed to update my equations and now I am stuck. As a last hope I will try interpolation method you suggested. By the way my updated equations are:
tan(k)=(cos(0.4363)*cos(b)*sin(a)-sin(0.4363)*cos(a))/(cos(0.4363)*sin(b))
tan(t)*cos(k)=cos(0.4363)*sin(b)/(cos(0.4363)*cos(b)*cos(a)+sin(0.4363)*sin(a))
Well, in one of the branches,
b = arctan(-2^(5/6)*3^(1/2)*(((2/3)*cos(t)^4*((cos(t)^2-1)*cos(k)^2-(1/2)*cos(t)^2)*2^(1/3)*(1/cos(t)^6)^(2/3)*(-3*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*3^(1/2)*signum(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*abs(sin(t))*(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*(((4*cos(k)^4-8*cos(k)^2+4)*cos(t)^2-4*cos(k)^4+4*cos(k)^2)*cos(4363/10000)^4+cos(t)^2*cos(k)^4-cos(k)^4)^(1/2)-9*((cos(k)^2-2)*cos(t)^2-cos(k)^2)*((cos(k)+1)*(cos(k)-1)*(cos(t)-1)*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*(cos(t)+1)*cos(4363/10000)^4+(2/9)*((cos(k)^2+1)*cos(t)^2-cos(k)^2)*((cos(k)^2-1/2)*cos(t)^2-cos(k)^2)))^(2/3)+cos(t)^2*2^(2/3)*(1/cos(t)^6)^(1/3)*((cos(t)+1)*(cos(k)-1)*((cos(t)^2-1)*cos(k)^2-cos(t)^2)*(cos(t)-1)*(cos(k)+1)*cos(4363/10000)^4+(1/3)*(cos(t)-1)^2*(cos(t)+1)^2*cos(k)^4+(-(1/3)*cos(t)^4+(1/3)*cos(t)^2)*cos(k)^2+(1/3)*cos(t)^4)*(-3*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*3^(1/2)*signum(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*abs(sin(t))*(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*(((4*cos(k)^4-8*cos(k)^2+4)*cos(t)^2-4*cos(k)^4+4*cos(k)^2)*cos(4363/10000)^4+cos(t)^2*cos(k)^4-cos(k)^4)^(1/2)-9*((cos(k)^2-2)*cos(t)^2-cos(k)^2)*((cos(k)+1)*(cos(k)-1)*(cos(t)-1)*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*(cos(t)+1)*cos(4363/10000)^4+(2/9)*((cos(k)^2+1)*cos(t)^2-cos(k)^2)*((cos(k)^2-1/2)*cos(t)^2-cos(k)^2)))^(1/3)-((cos(t)^2-1)*cos(k)^2-cos(t)^2)*3^(1/2)*signum(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*abs(sin(t))*(((cos(t)^2-1)*cos(k)^2-cos(t)^2+1)*cos(4363/10000)^4+cos(t)^2)*(((4*cos(k)^4-8*cos(k)^2+4)*cos(t)^2-4*cos(k)^4+4*cos(k)^2)*cos(4363/10000)^4+cos(t)^2*cos(k)^4-cos(k)^4)^(1/2)-3*((cos(t)^2-1)*cos(k)^2-2*cos(t)^2)*((cos(t)+1)*(cos(k)-1)*((cos(t)^2-1)*cos(k)^2-cos(t)^2)*(cos(t)-1)*(cos(k)+1)*cos(4363/10000)^4+(2/9)*((cos(t)^2-1)*cos(k)^2-(1/2)*cos(t)^2)*((cos(t)^2-1)*cos(k)^2+cos(t)^2)))*((cos(t)^2-1)*cos(k)^2-cos(t)^2))^(1/2)/((1/cos(t)^6)^(1/3)*(-3*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*3^(1/2)*signum(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*abs(sin(t))*(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*(((4*cos(k)^4-8*cos(k)^2+4)*cos(t)^2-4*cos(k)^4+4*cos(k)^2)*cos(4363/10000)^4+cos(t)^2*cos(k)^4-cos(k)^4)^(1/2)-9*((cos(k)^2-2)*cos(t)^2-cos(k)^2)*((cos(k)+1)*(cos(k)-1)*(cos(t)-1)*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*(cos(t)+1)*cos(4363/10000)^4+(2/9)*((cos(k)^2+1)*cos(t)^2-cos(k)^2)*((cos(k)^2-1/2)*cos(t)^2-cos(k)^2)))^(1/3)*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*cos(t)^2), 2^(2/3)*(-6*((1/6)*(-3*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*3^(1/2)*signum(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*abs(sin(t))*(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*(((4*cos(k)^4-8*cos(k)^2+4)*cos(t)^2-4*cos(k)^4+4*cos(k)^2)*cos(4363/10000)^4+cos(t)^2*cos(k)^4-cos(k)^4)^(1/2)-9*((cos(k)^2-2)*cos(t)^2-cos(k)^2)*((cos(k)+1)*(cos(k)-1)*(cos(t)-1)*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*(cos(t)+1)*cos(4363/10000)^4+(2/9)*((cos(k)^2+1)*cos(t)^2-cos(k)^2)*((cos(k)^2-1/2)*cos(t)^2-cos(k)^2)))^(2/3)*2^(1/3)*(1/cos(t)^6)^(2/3)*cos(t)^4-(1/2)*cos(t)^2*2^(2/3)*(1/cos(t)^6)^(1/3)*(((cos(t)^2-1)*cos(k)^2-cos(t)^2)*cos(4363/10000)^2+(-(2/3)*cos(t)^2+2/3)*cos(k)^2+(1/3)*cos(t)^2)*(-3*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*3^(1/2)*signum(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*abs(sin(t))*(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*(((4*cos(k)^4-8*cos(k)^2+4)*cos(t)^2-4*cos(k)^4+4*cos(k)^2)*cos(4363/10000)^4+cos(t)^2*cos(k)^4-cos(k)^4)^(1/2)-9*((cos(k)^2-2)*cos(t)^2-cos(k)^2)*((cos(k)+1)*(cos(k)-1)*(cos(t)-1)*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*(cos(t)+1)*cos(4363/10000)^4+(2/9)*((cos(k)^2+1)*cos(t)^2-cos(k)^2)*((cos(k)^2-1/2)*cos(t)^2-cos(k)^2)))^(1/3)+(cos(t)+1)*(cos(k)-1)*((cos(t)^2-1)*cos(k)^2-cos(t)^2)*(cos(t)-1)*(cos(k)+1)*cos(4363/10000)^4+(1/3)*(cos(t)-1)^2*(cos(t)+1)^2*cos(k)^4+(-(1/3)*cos(t)^4+(1/3)*cos(t)^2)*cos(k)^2+(1/3)*cos(t)^4)/((-3*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*3^(1/2)*signum(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*abs(sin(t))*(((cos(k)^2-1)*cos(t)^2-cos(k)^2+1)*cos(4363/10000)^4+cos(t)^2)*(((4*cos(k)^4-8*cos(k)^2+4)*cos(t)^2-4*cos(k)^4+4*cos(k)^2)*cos(4363/10000)^4+cos(t)^2*cos(k)^4-cos(k)^4)^(1/2)-9*((cos(k)^2-2)*cos(t)^2-cos(k)^2)*((cos(k)+1)*(cos(k)-1)*(cos(t)-1)*((cos(k)^2-1)*cos(t)^2-cos(k)^2)*(cos(t)+1)*cos(4363/10000)^4+(2/9)*((cos(k)^2+1)*cos(t)^2-cos(k)^2)*((cos(k)^2-1/2)*cos(t)^2-cos(k)^2)))^(1/3)*((cos(t)^2-1)*cos(k)^2-cos(t)^2)))^(1/2))
along with 11 other values, some of which appear likely to be complex valued.
Some of the signum() and abs() disappear because of the constraints on k force sin(k) and cos(k) to be positive, but the value range for t might force sin(k) to be positive but allows cos(k) to be negative -- and the some of the signum() are complex enough that it looks to me as if they might change signs a couple of times during the ranges and so look like they might not simplify out.
One way of viewing this is to replace sin(a) with u. Then cos(a) will become +/-sqrt(1-u^2). Likewise, replace sin(b) with v, then we replace cos(b) with +/-sqrt(1-v^2).
Now if we carefully go through and do those substitutions for each of the 4 possible branches, with some effort and algebraic manipulations, you should be able to isolate u in one of the equations, as purely a function of v. Further examination shows you will get a quadratic equation in u or v. So there will be TWO roots, thus two branches to choose from. Either will yield a solution.
Then substitute into the other equation, which will yield a polynomial equation in only v. I predict that equation will be a 3rd or 4th order polynomial in v. It will be solvable, so compute the roots. Roots would suffice, then using those roots in v, recover the corresponding solutions for u.
Repeat this analysis for each of the 4 possible branches of the sqrt we had initially. The final result will be something on the order of a dozen possible solutions. Some of them will have u or v outside the interval [-1,1]. When we go back and try to recover a and b from an asin or acos, that will result in a complex value. Since you care only about real valued solutions to the problem, you will use only the solutions where u and v are both real and fall in the interval [-1,1].
Even then, after you have chased down every one of those branches to a set of real solutions, you will still need to choose which solution to prefer from among the dozen real solutions that will generally pop out.
I see that you have a modified version of your problem. One thing you can do to make things slightly simpler is to divide numerator and denominator by cos(0.4363). Then you are left with ONLY a single term, that has tan(0.4363) in it.
When I do that manipulation, I see that interestingly, one of your equations has mysteriously flipped upside down!!!!!!!! I suppose that is no more than swapping tan(k) for cot(k) in that first equation.
tan(k)=(cos(b)*sin(a)-tan(0.4363)*cos(a))/sin(b)
tan(t)*cos(k)=sin(b)/(cos(b)*cos(a)+tan(0.4363)*sin(a))
As well, the left hand side of equation 2 has now morphed into tan(t)*cos(k), from tan(t)*sin(k).
I'm not sure what has happened in these equations, if they have really morphed, or if you were just sloppy in writing them down.
But lets start with one of them, the first seems reasonable. Multiplying by sin(b), we find this:
tan(k)*sin(b) = cos(b)*sin(a)-tan(0.4363)*cos(a)
I could have done something similar with equation 2.
Now wander into the table of identities for trig functions. I'd look carefully at the sum of angles identities. Hmm. Suppose we were to divide both sides of this equation by
cos(b)^2 + tan(0.4363)^2
There is method to my madness, of course. This is a classic trick, used to reduce such a problem. Doing that would allow us to re-write the entire right hand side (using a sum of angles identity) in a form like
sin(C + a)
where C is a function of b. This of course is the stuff that computer algebra thrives upon, whereas I am just lazy.
fun1 = @(a,b) (cos(b).*sin(a)-tan(0.4363)*cos(a))./sin(b);
fun2 = @(a,b) sin(b)./(cos(b).*cos(a)+tan(0.4363)*sin(a));
[A,B] = meshgrid(linspace(0,2*pi,1000));
f1AB = fun1(A,B);
f2AB = fun2(A,B);
You used this pair of values for k and t before.
k=0.9385;
t=1.5239;
If I now use the same contour plot trick to count and localize solutions as before, we see 10 real solutions, two of which are replicated.
contour(A,B,f1AB,[1 1]*tan(k),'b')
hold on
contour(A,B,f2AB,[1 1]*cos(k)*tan(t),'r')
So effectively again 12 real solutions since we need to count the pair of replicated solutions twice.
There are methods that exist to identify those solutions as intersections of curves from the contour plot itself. But you still have roughly a dozen solutions to track down.
Above I posted one of the 12 b values. The first of the corresponding a values is attached. It is too long to put in a comment as it is over 55000 characters.
The attached solution is after simplification to specialize for the data ranges you specified (which allows some signum() and abs() to be removed.) The simplification process took more than half an hour of computation for the one solution.
evaluating the above solution for a with k = Pi/4 and simplifying the result has taken over an hour so far.
... there goes my idea of taylor'ing it.
I think a series approximation is one that simply won't go far here. That we have a tan(k) and tan(t) on the left hand side of those equations means that we need to expect a great deal of variability in the solutions. The 12 solutions will be highly sensitive to moderately small changes in k and t. What does that say about a series solution? BAD news. Any series solution will probably not be a convergent one, or to expect serious problem with that approach.
OK now we know that we can find explicit solutions but they are extremely long so not applicable to real life. Real application needs to adjust a and b angles according to changing k and t values. So it needs to calculate the functions in short time intervals to be accurate enough. Actually these equations are for tip of a some kind of manipulator arm which moves along a spherical surface. I didn't think it would be that complicated since it seems a simple real life problem. Anyway I agree with Mr D'errico that series approximation also won't get us far. I think my best bet is to solve them for constant t values that will be used most(15°, 30°, 45) and hopefully get three different simple enough equations for a and b as a function of k.

Sign in to comment.

More Answers (0)

Community Treasure Hunt

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

Start Hunting!