David1

65 Reputation

4 Badges

7 years, 296 days

MaplePrimes Activity


These are questions asked by David1

I have a code in Maple that solves a system of polynomial equations (18 equations, 18 variables) using the command 'RootFinding[Isolate]' (it takes to Maple about 40 minutes to find all the solutions to the equations). Is it possible to see the implementation of the Isolate command? if not, is there any other open source code that implements the equivalent to Isolate command and also able to solve such equations? (I'm talking about the  numeric solutions. not symbolic).

I already tried to use the command 'solve_poly_system' in python (sympy package) which is open source. but the function didn't return a solution after a very long time (and I used a system of 9 equations and 9 variables which were much simpler than the equations Maple was able to solve using Isolate command).

I'm attaching the equations Maple solved using Isolate command. and also the equivalent in python with the simpler equations (that it wasn't able to solve).

solving_18_polynomial_equations.mw

trying_to_solve_polynomial_equations_python.txt

I'd appreciate any idea of how to use open source code that produces the same results as the code in Maple (if it's possible).

Thanks

 

Hi all,

I have a system of 18 polynomial equations (and 18 variables).

The polynomials are of second degree (meaning, every polynomial has at most multiplications of two different variables or a single variable squared).

My goal is to be able to solve the polynomials by getting ALL the possible solutions.

For now, when I use the solve command, Maple is trying to solve and never returns the solutions to the equations (I stopped after 3 hours).

But when I use fsolve, Maple returns a single solution (immediately) which is sometimes the solution I expected to get but not always.

If I don't get the solution I expected to get, I call fsolve again but this time with the 'avoid' option in order not to get the same solution again. that way if I use 'fsolve' about 3 times I get the solution I expected to get in most cases. but still not always.

My question, since the equations are polynomials, is there a way to tell Maple to solve the equations in a more efficient way so that I will get ALL the possible solutions? (when I use the 'solve' command I don't tell Maple in any way that the equations are polynomials). or any other way to get all the solutions (I'm new with Maple so maybe there are other commands that I don't know about and can give me all the solutions).

btw, I need only the real solutions. I don't need the complex solutions if exist.

 

I wrote bellow an example of the code in Maple with the equations that I'm trying to solve (note that I use fsolve twice but only in the second time I get the solutions I expected to get).

The 'h' function in the code looks extermely long but I don't try to solve 'h' in the fsolve command. only the g1* and diff_r1* and diff_t1* functions (which are much shorter than 'h').

I will appreciate any help.

Thanks!

Here is the code:

restart;
g1_1_1:=r1__1_1^2+r1__1_2^2+r1__1_3^2-1;
g1_1_2:=r1__1_1*r1__2_1+r1__1_2*r1__2_2+r1__1_3*r1__2_3;
g1_1_3:=r1__1_1*r1__3_1+r1__1_2*r1__3_2+r1__1_3*r1__3_3;
g1_2_2:=r1__2_1^2+r1__2_2^2+r1__2_3^2-1;
g1_2_3:=r1__2_1*r1__3_1+r1__2_2*r1__3_2+r1__2_3*r1__3_3;
g1_3_3:=r1__3_1^2+r1__3_2^2+r1__3_3^2-1;
h:=(-.992492661403*r1__1_1+12.3284921161777*r1__1_2+7.57084655768457*r1__1_3+.324267866473309*t11+.0749281794197556+1.09088742857604*r1__2_1-13.5507269559957*r1__2_2-8.32141299937268*r1__2_3-.356415470609132*t12+.928796854654334*r1__3_1-11.5372789567796*r1__3_2-7.08496771958172*r1__3_3-.303457129743798*t13)^2+(-2.48532903781461*r1__2_1+30.87212696684*r1__2_2+18.958371709801*r1__2_3+.81200836636144*t12-.197547504455846+1.09088742838705*r1__1_1-13.550726959431*r1__1_2-8.32141299910563*r1__1_3-.356415470592923*t11+.48989466626242*r1__3_1-6.08534729180524*r1__3_2-3.73697206129778*r1__3_3-.160058713114523*t13)^2+(-2.6436153220831*r1__3_1+32.8383190443191*r1__3_2+20.1657974352703*r1__3_3+.863723767113888*t13+.0651743072009662+.928796854295815*r1__1_1-11.5372789582423*r1__1_2-7.08496772054044*r1__1_3-.303457129759512*t11+.48989466615819*r1__2_1-6.08534729103406*r1__2_2-3.73697206192339*r1__2_3-.160058713130091*t12)^2+(-3.0453012837136*r1__1_1+28.3453761824993*r1__1_2+20.6329645159026*r1__1_3+.803383631995274*t11+1.1433809887851+.588739190174359*r1__2_1-5.47992867285244*r1__2_2-3.98891068120136*r1__2_3-.15531580779083*t12+1.38673265028867*r1__3_1-12.9075762854695*r1__3_2-9.39559107531887*r1__3_3-.365835170130537*t13)^2+(-3.32552348095664*r1__2_1+30.9536578751004*r1__2_2+22.5315663656812*r1__2_3+.877309298336102*t12-1.987216561269+.588739190114314*r1__1_1-5.47992866961904*r1__1_2-3.98891068053918*r1__1_3-.155315807786897*t11+1.09544034380124*r1__3_1-10.1962550610257*r1__3_2-7.42198542424216*r1__3_3-.28898908845837*t13)^2+(-1.21036350562772*r1__3_1+11.2659489790199*r1__3_2+8.20062940888435*r1__3_3+.319307069650757*t13+.229170772052734+1.38673265024704*r1__1_1-12.9075762829888*r1__1_2-9.39559107412026*r1__1_3-.365835170095885*t11+1.09544034388008*r1__2_1-10.1962550650824*r1__2_2-7.4219854245274*r1__2_3-.288989088438315*t12)^2+(-5.95351974815554*r1__1_1+36.6994162407641*r1__1_2+25.4290813546269*r1__1_3+.974842575637377*t11-2.63695732507178+.0862138869060729*r1__2_1-.531450210031119*r1__2_2-.368242659171055*r1__2_3-.0141168537454004*t12+.952506399264142*r1__3_1-5.87155670816424*r1__3_2-4.06841057826005*r1__3_3-.155965518005519*t13)^2+(-6.05878205069695*r1__2_1+37.3482870296174*r1__2_2+25.8786849115508*r1__2_3+.992078459354551*t12-1.33152058265882+.0862138869007144*r1__1_1-.531450210081823*r1__1_2-.368242659219069*r1__1_3-.0141168537421636*t11+.534490070726969*r1__3_1-3.29476921378019*r1__3_2-2.28295060211721*r1__3_3-.087518593905657*t13)^2+(-.202018537282116*r1__3_1+1.24530743607334*r1__3_2+.862875410606218*r1__3_3+.0330789650607677*t13+.545863834860738+.952506399246256*r1__1_1-5.87155670833708*r1__1_2-4.06841057735347*r1__1_3-.155965517969505*t11+.534490070750153*r1__2_1-3.29476921356283*r1__2_2-2.28295060131082*r1__2_3-.0875185939055155*t12)^2+(-6.07959771459677*r1__1_1+30.9674242426801*r1__1_2+22.3705097998352*r1__1_3+.857873368534317*t11-1.76471733145788+1.65075563468967*r1__2_1-8.40839352379239*r1__2_2-6.07412642093546*r1__2_3-.232933059628316*t12+1.84351225448619*r1__3_1-9.39023086096381*r1__3_2-6.78339437706986*r1__3_3-.260132354459928*t13)^2+(-4.38138073503315*r1__2_1+22.3172786035824*r1__2_2+16.1217444412232*r1__2_3+.618243184218713*t12-.923385301124302+1.65075563490521*r1__1_1-8.40839352323243*r1__1_2-6.07412642020582*r1__1_3-.232933059620808*t11+3.02135458680454*r1__3_1-15.3897632163199*r1__3_2-11.1173872944915*r1__3_3-.426334069877298*t13)^2+(-3.71266987086301*r1__3_1+18.9110905602843*r1__3_2+13.6611535221535*r1__3_3+.523883447195053*t13+1.79101248019951+1.84351225469879*r1__1_1-9.39023085830571*r1__1_2-6.78339437737683*r1__1_3-.260132354453603*t11+3.02135458675847*r1__2_1-15.3897632129884*r1__2_2-11.1173872963301*r1__2_3-.426334069880672*t12)^2+(-3.90011435645636*r1__1_1+33.4181858543797*r1__1_2+19.9362529914774*r1__1_3+.790634768245585*t11-3.40601893140435+1.48764430833506*r1__2_1-12.7469016125627*r1__2_2-7.60440607186657*r1__2_3-.301576621987651*t12+1.34716650703029*r1__3_1-11.5432155550731*r1__3_2-6.88632430891628*r1__3_3-.273098832924476*t13)^2+(-2.79003782913976*r1__2_1+23.9064791937414*r1__2_2+14.261863864387*r1__2_3+.565599033947199*t12+2.94191879923881+1.48764430859128*r1__1_1-12.7469016146313*r1__1_2-7.6044060696602*r1__1_3-.301576621995954*t11+1.94050330636006*r1__3_1-16.6272304379243*r1__3_2-9.91928987276943*r1__3_3-.393380614413616*t13)^2+(-3.17562785143546*r1__3_1+27.2104128357136*r1__3_2+16.2328881834776*r1__3_3+.643766197822571*t13-.637542053291817+1.34716650724399*r1__1_1-11.5432155571023*r1__1_2-6.88632430841617*r1__1_3-.273098832949826*t11+1.94050330633365*r1__2_1-16.627230438149*r1__2_2-9.91928987492707*r1__2_3-.3933806144393*t12)^2+(-2.01324057094153*r1__1_1+40.4637240018238*r1__1_2+19.1624249532275*r1__1_3+.995107416713897*t11+1.84529512341763+.0539908034671229*r1__2_1-1.08515047907221*r1__2_2-.513895226737029*r1__2_3-.0266866512328603*t12+.130433143363034*r1__3_1-2.62154994723571*r1__3_2-1.24148865078056*r1__3_3-.0644706798567015*t13)^2+(-1.72864549456945*r1__2_1+34.7437038570169*r1__2_2+16.453592301917*r1__2_3+.854437357037078*t12+1.26622268071142+.0539908034660728*r1__1_1-1.08515047910239*r1__1_2-.513895226549678*r1__1_3-.026686651233501*t11+.711449065385413*r1__3_1-14.2992740321447*r1__3_2-6.77171397936849*r1__3_3-.351656057242671*t13)^2+(-.304391827618365*r1__3_1+6.11791114030412*r1__3_2+2.89726208101195*r1__3_3+.150455226223174*t13-.664170181540941+.130433143328345*r1__1_1-2.62154994715954*r1__1_2-1.24148865060744*r1__1_3-.0644706798534696*t11+.711449065210039*r1__2_1-14.2992740313315*r1__2_2-6.77171398089296*r1__2_3-.3516560572166*t12)^2+(-.554028798262323*r1__1_1+16.4352774899688*r1__1_2+12.212735424138*r1__1_3+.451248010725026*t11+1.80668680530669+.561213036138882*r1__2_1-16.6483980707805*r1__2_2-12.3711011963105*r1__2_3-.457099462951262*t12+.241478758779813*r1__3_1-7.16347312712678*r1__3_2-5.32303772144054*r1__3_3-.19668076798868*t13)^2+(-.760290795908938*r1__2_1+22.5540445569422*r1__2_2+16.7594723669968*r1__2_3+.619245263577858*t12-.547959274703874+.561213036185506*r1__1_1-16.6483980712546*r1__1_2-12.3711011949445*r1__1_3-.457099462966984*t11+.201146990103896*r1__3_1-5.96703024933782*r1__3_2-4.43398426133857*r1__3_3-.163831157208818*t13)^2+(-1.14122053061752*r1__3_1+33.854334200315*r1__3_2+25.1564980835807*r1__3_3+.929506725704928*t13-3.76727778582615+.241478758813686*r1__1_1-7.16347312565607*r1__1_2-5.32303772203581*r1__1_3-.196680768005511*t11+.201146990115401*r1__2_1-5.96703024794285*r1__2_2-4.43398426232404*r1__2_3-.163831157217202*t12)^2+(-4.02477735374144*r1__1_1+27.7950101802505*r1__1_2+21.425586834354*r1__1_3+.78027956702849*t11+.221994737480659+1.24285496385638*r1__2_1-8.5831248120031*r1__2_2-6.61624099843662*r1__2_3-.24095105086973*t12+1.73688577463857*r1__3_1-11.9948890468077*r1__3_2-9.24617530570086*r1__3_3-.336728310946364*t13)^2+(-3.7951756300308*r1__2_1+26.2093865067395*r1__2_2+20.2033200543809*r1__2_3+.735766910103154*t12-.764444377219279+1.2428549639263*r1__1_1-8.58312481092265*r1__1_2-6.61624100152625*r1__1_3-.240951050879308*t11+1.90471339873406*r1__3_1-13.1539023563811*r1__3_2-10.1395925103233*r1__3_3-.369264884863308*t13)^2+(-2.49629140831476*r1__3_1+17.2393250571566*r1__3_2+13.2888116882479*r1__3_3+.483953522844612*t13+.402154769245324+1.73688577506273*r1__1_1-11.9948890436773*r1__1_2-9.24617530885054*r1__1_3-.336728310949967*t11+1.90471339909204*r1__2_1-13.153902354604*r1__2_2-10.1395925090424*r1__2_3-.36926488485258*t12)^2+(r1__1_1^2+r1__1_2^2+r1__1_3^2-1)*b1__1_1+(r1__1_1*r1__2_1+r1__1_2*r1__2_2+r1__1_3*r1__2_3)*b1__1_2+(r1__2_1^2+r1__2_2^2+r1__2_3^2-1)*b1__2_2+(r1__1_1*r1__3_1+r1__1_2*r1__3_2+r1__1_3*r1__3_3)*b1__1_3+(r1__2_1*r1__3_1+r1__2_2*r1__3_2+r1__2_3*r1__3_3)*b1__2_3+(r1__3_1^2+r1__3_2^2+r1__3_3^2-1)*b1__3_3;
diff_t11:=diff(h,t11);
diff_t12:=diff(h,t12);
diff_t13:=diff(h,t13);
diff_r1__1_1:=diff(h,r1__1_1);
diff_r1__2_1:=diff(h,r1__2_1);
diff_r1__3_1:=diff(h,r1__3_1);
diff_r1__1_2:=diff(h,r1__1_2);
diff_r1__2_2:=diff(h,r1__2_2);
diff_r1__3_2:=diff(h,r1__3_2);
diff_r1__1_3:=diff(h,r1__1_3);
diff_r1__2_3:=diff(h,r1__2_3);
diff_r1__3_3:=diff(h,r1__3_3);
with(Groebner):
with(RealDomain):
sols:=fsolve({g1_1_1,g1_1_2,g1_1_3,g1_2_2,g1_2_3,g1_3_3,diff_t11,diff_t12,diff_t13,diff_r1__1_1,diff_r1__1_2,diff_r1__1_3,diff_r1__2_1,diff_r1__2_2,diff_r1__2_3,diff_r1__3_1,diff_r1__3_2,diff_r1__3_3},{ t11, t12, t13, r1__1_1, r1__1_2, r1__1_3, r1__2_1, r1__2_2, r1__2_3, r1__3_1, r1__3_2, r1__3_3, b1__1_1, b1__1_2, b1__1_3, b1__2_2, b1__2_3, b1__3_3} );
with(Groebner):
with(RealDomain):
sols:=fsolve({g1_1_1,g1_1_2,g1_1_3,g1_2_2,g1_2_3,g1_3_3,diff_t11,diff_t12,diff_t13,diff_r1__1_1,diff_r1__1_2,diff_r1__1_3,diff_r1__2_1,diff_r1__2_2,diff_r1__2_3,diff_r1__3_1,diff_r1__3_2,diff_r1__3_3},{ t11=0.184015, t12=0.087459, t13=0.308915, r1__1_1=0.230878, r1__1_2=0.909187, r1__1_3=0.936884, r1__2_1=0.031879, r1__2_2=0.593647, r1__2_3=0.043818, r1__3_1=0.424903, r1__3_2=0.521581, r1__3_3=0.840339, b1__1_1=0.625030, b1__1_2=0.255205, b1__1_3=0.904691, b1__2_2=0.767301, b1__2_3=0.562666, b1__3_3=0.897154}, avoid={{b1__1_1 = -32.51343311, b1__1_2 = 43.92451284, b1__1_3 = 22.91611840, b1__2_2 = -6.848329887, b1__2_3 = 16.30411571, b1__3_3 = -13.09739229, r1__1_1 = .5873876993, r1__1_2 = -.8092603402, r1__1_3 = -.8566942425e-2, r1__2_1 = .2869971672e-1, r1__2_2 = .1024997381e-1, r1__2_3 = .9995355243, r1__3_1 = -.8087966474, r1__3_2 = -.5873607408, r1__3_3 = .2924625105e-1, t11 = 36.59195193, t12 = -22.18329766, t13 = 22.31332161}} );

Hi, I have a system of 15 polynomial equations (of 15 variables) of 2nd degree. Meaning, every monomial has at most mulplications of 2 different variables or a single variable squared.

I tried to solve them in Maple but it's been 2 hours and Maple is still thinking.. I don't have any indication if Maple is just stuck or it should return a solution at some point.  

Below I wrote the Maple commands that I tried to run (sorry but I'm new here so I didn't know how to write them nicely). I also wrote one of the solutions that I'm expecting to get (15 values for the 15 variables). and you can see that by typing eq7 for example I got -2.5=-2.5 (and the same for the rest of the equations) which means that the values are correct.

I know there is an algorithm for solving any system of numerical polynomial equations of any degree. I don't know if Maple implemented it.

Anyone knows if Maple is able to solve the equations below? and if not, is there any other way that can be done to solve them?

Thanks

David

 

Here's the commands for Maple (including one of the solutions I'm expecting to get).

The variables are: r11, r12, r13, r21, r22, r23, r31, r32, r33, t1, t2, t3, s1, s2, s3

eq1:=r11^2+r21^2+r31^2 = 1;
eq2:=r12^2+r22^2+r32^2 = 1;
eq3:=r13^2+r23^2+r33^2 = 1;
eq4:=r11*r12+r21*r22+r31*r32 = 0;
eq5:=r11*r13+r21*r23+r31*r33 = 0;
eq6:=r12*r13+r22*r23+r32*r33 = 0;
eq7:=-30*r13-.79382581863774e-1*s1*r11-.95259098236529e-1*s1*r12+.992282273297173*s1*r13 = -.83717247687439e-1*t1;
eq8:=-30*r13+.79382581863774e-1*s2*r11+.95259098236529e-1*s2*r12+.992282273297173*s2*r13 = .76364294519742e-1*t2;
eq9:=-30*r13-.86165283952334e-1*s3*r11+.103398340742801*s3*r12+.990900765451843*s3*r13 = -.81460429387834e-1*t3;
eq10:=-30*r23-.79382581863774e-1*s1*r21-.95259098236529e-1*s1*r22+.992282273297173*s1*r23 = -.107930827800543*t1;
eq11:=-30*r23+.79382581863774e-1*s2*r21+.95259098236529e-1*s2*r22+.992282273297173*s2*r23 = .60269029165473e-1*t2;
eq12:=-30*r23-.86165283952334e-1*s3*r21+.103398340742801*s3*r22+.990900765451843*s3*r23 = .105021268850622*t3;
eq13:=-30*r33-.79382581863774e-1*s1*r31-.95259098236529e-1*s1*r32+.992282273297173*s1*r33 = .990627255252918*t1-30;
eq14:=-30*r33+.79382581863774e-1*s2*r31+.95259098236529e-1*s2*r32+.992282273297173*s2*r33 = .995256820446840*t2-30;
eq15:=-30*r33-.86165283952334e-1*s3*r31+.103398340742801*s3*r32+.990900765451843*s3*r33 = .991128009660183*t3-30;


r11 := 1;
r12 := 0;
r13 := 0;
x := .523598775598299;
r21 := 0;
r22 := cos(x);
r23 := -sin(x);
r31 := 0;
r32 := sin(x);
r33 := cos(x);
t1 := 29.862424638395044;
t2 := 32.737813080348531;
t3 := 30.689747387623886;
s1 := 31.493054789905649;
s2 := 31.493054789905628;
s3 := 29.014005238849720;
eq1;
eq2;
eq3;
eq4;
eq5;
eq6;
eq7;
eq8;
eq9;
eq10;
eq11;
eq12;
eq13;
eq14;
eq15;

unassign('r11', 'r12', 'r13', 'r21', 'r22', 'r23', 'r31', 'r32', 'r33', 't1', 't2', 't3', 's1', 's2', 's3');
solve({eq1, eq10, eq11, eq12, eq13, eq14, eq15, eq2, eq3, eq4, eq5, eq6, eq7, eq8, eq9}, {r11, r12, r13, r21, r22, r23, r31, r32, r33, s1, s2, s3, t1, t2, t3});

I have a big project in matlab that I've been writing for months. It includes a lot of code related to equations. The code worked with Matlab symbolic engine (or maybe it was Mupad I'm not sure). I wanted to switch to Maple symbolic engine so I downloaded Maple toolbox for Matlab. Now I can't run my code anymore since matlab doesn't recognize commands like 'vpasolve' (solve numeric equations), 'children' (finds subexpressions of a given expression), etc..

I'm looking for a long time for a tutorial that explains how to work with Maple toolbox for matlab that can expain in details what changes I need to make in my code to make it work. For example, I have no idea what to write instead of the 'children' command. I didn't find any tutorial. The best I've found so far is this link:

http://www-h.eng.cam.ac.uk/help/tpl/programs/Matlab/maplesymbolic.html

but It explains only a little and I still don't know what to do with many of the commands that I need to change (like 'children').

Can anyone suggest how I can change my code to make it work? or send me a link that explains that (if exists). I know a little Maple (mostly works with Matlab).

I know that ''op'' command in maple is the equivalent to "children" command in matlab. but I still don't know if I should use the command "op" in matlab (for maple engine) or something else.

Also, I have a command "eq=exp1==exp2" (where exp1 and exp2 are 3x3 matrices of symbolic expressions). In Mupad engine it defined eq as a matrix of equations but in maple engine eq is a logical matrix (all zeros). How can I write the equivalent (I mean code in matlab for maple engine)

Thanks!

1 2 Page 2 of 2