0
$\begingroup$

Not exactly sure whats wrong with my code but it keeps giving me a PolynomialGCD: Exponent is out of bounds for function PolynomialGCD error. The equation that I do NSolve for is very big and it takes like 5 hours for it to return that error. How can I fix this? Is my equation to long?

rse[t_] := 1.496*^11*(1 - 0.016708 Cos[(360 (t - 4)/365.25636)]);
theta[t_] := 2*Pi*t;
r0 = 42164000;
rss[t_] := (r0^2 + rse[t]^2 + 2*r0*rse[t]*Cos[theta[t]])^0.5;
Dcs[t_] := Abs[Sin[theta[t]]]/Sin[theta[t]];
m = 292110;
Gs = 6.674*10^-11;
Ms = 1.989*10^30;
Fcs[t_] := (1/rss[t])*m*(Integrate[Dcs[t] (Sin[theta[t]])^2*Gs*Ms/(rss[t]^2), t])^2;
rem[t_] := 24949500 Cos[theta[t]/29.531] + 381514500;
rms[t_] := (r0^2 + rem[t]^2-2*r0*rem[t] Cos[theta[t] (1 - 1/29.531)])^0.5;
Dcm[t_] :=Abs[Sin[theta[t] (1 - (1/29.531))]]/Sin[theta[t] (1 - (1/29.531))];
Gm = 6.674*10^-11;
Mm = 7.34767309*10^22;
Fcm[t_] := -1*(1/rms[t])*(Integrate[Dcm[t]*(Sin[theta[t]*(1 - (1/29.531))])^2*Gm*
    Mm*m^0.5/(rms[t]^2), t])^2;
Fside[t_] := Fcm[t] + Fcs[t];
Dgs[t_] := Abs[Cos[theta[t]]]/Cos[theta[t]];
Dgm[t_] := Abs[Cos[theta[t]*(1 - (1/29.531))]]/Cos[theta[t]*(1 - (1/29.531))];
Fupdown[t_] := Dgm[t] (Cos[theta[t]*(1 - (1/29.531))])^2*Gm*Mm*m/(rms[t]^2) Dgs[t] 
    (Cos[theta[t]])^2*Gs*Ms*m/(rss[t]^2);
Ft[t_] := Fupdown[t] + Fside[t];
rreal = 100000000;
k = 0.05;
rH[t_] := rreal + (Ft[t]/k);
rcg[t_] := r0 + (Ft[t]/k);
vH[t_] := (rcg[t]*Fside[t]/m)^0.5;
wH[t_] := vH[t]/rH[t];
we = 7.2921159*10^(-5);
theta2[t_] := Integrate[wH[t], {t, 0, t}] - we*t;
Distance[t_] := D[(r0^2 + rH[t]^2 - 2*r0*rH[t]*Cos[theta2[t]])^0.5, t];
NSolve[0 == Distance[t], t]
$\endgroup$
  • $\begingroup$ Consider how Fcs[t] evaluates: With t == 3 for instance, it becomes (1/rss[3])*m*(Integrate[Dcs[3] (Sin[theta[3]])^2*Gs*Ms/(rss[3]^2),3])^2; Among other problems, the integration variable now is 3, which Mathematica does not like! Use a different symbolic variable for the integration. Even then, Integrate cannot do the integral, and NSolve cannot do the solve. Probably you need to use NIntegrate and FindRoot. $\endgroup$ – bbgodfrey Jul 20 '18 at 4:10
  • $\begingroup$ Ok I will try that. Thank you! $\endgroup$ – Patrick Hutecker Jul 20 '18 at 11:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.