Yukterez

Newtonian deflection of light

Oct 12th, 2017
185
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. (* Newtonsche Korpuskeltheorie *) (* gravitylense.yukterez.net *) (* Simon Tyran, Vienna *)
  2. (* |||||||||||||||||||||||||||||||| Syntax: Mathematica |||||||||||||||||||||||||||||||| *)
  3.  
  4. ClearAll["Global`*"]
  5. G=1; M=1; c=1; rs=2 G M/c^2;
  6. wp=MachinePrecision;
  7. r0=Sqrt[2] 10;
  8. θ0=0;
  9. тmax=200;
  10. Ф=(β+1/2) π/180;
  11. vr0=v0 Sin[Ф];
  12. vθ0=v0/r0 Cos[Ф];
  13. v0=1;
  14. Table[Subscript[sol, β]=
  15. NDSolve[{r''[t]==-((G M)/r[t]^2)+r[t] θ'[t]^2,
  16. r'[0]==vr0,
  17. r[0]==r0,
  18. θ''[t]==-((2 r'[t] θ'[t])/r[t]),
  19. θ'[0]==vθ0,
  20. θ[0]==θ0
  21. }, {r, θ}, {t, 0, тmax},
  22. MaxSteps-> Infinity, Method-> Automatic, WorkingPrecision-> wp,
  23. InterpolationOrder-> All], {β, 170, 370, 1}];
  24. x[t_, β_]:=(Sin[Evaluate[θ[t] /. Subscript[sol, β]]] Evaluate[r[t] /. Subscript[sol, β]])[[1]]
  25. y[t_, β_]:=(Cos[Evaluate[θ[t] /. Subscript[sol, β]]] Evaluate[r[t] /. Subscript[sol, β]])[[1]]
  26. R[t_, β_]:=Evaluate[r[t] /. Subscript[sol, β]][[1]];
  27. γ[t_, β_]:=Evaluate[τ'[t] /. Subscript[sol, β]][[1]];
  28. и[t_, β_]:=Evaluate[τ[t] /. Subscript[sol, β]][[1]];
  29. s[text_]:=Style[text, FontSize-> font]; font=11;
  30. PR=Sqrt[2] 10;
  31. plot=Do[Print[Rasterize[Grid[{{Show[
  32. Graphics[{{Gray, Point[{0, 0}]}},
  33. Frame-> True, ImageSize-> 400, PlotRange-> PR, ImagePadding-> 1],
  34. Table[{Graphics[{Red, Point[{x[time, β], y[time, β]}]}],
  35. ParametricPlot[{x[ε, β], y[ε, β]}, {ε, 0, time},
  36. PlotStyle-> {Thickness[0.001], Red}]}, {β, 170, 370, 1}]]},
  37. {Grid[{{s["t"], "=", s[N[time]], s[" GM/c³"]}},
  38. Alignment-> Left, Spacings-> {0, 1/2}]}}, Alignment-> Left]]],
  39. {time, 10, 50, 10}]
RAW Paste Data