0
$\begingroup$

I just want to get a smooth plot but the calculated values are "discrete" which seems to be a precision problem. I tried N[],SetPrecision[],SetAccuary[] without any success. So I paste the Code in its initial form.

M = 5.9722 10^24;
G = 6.67408 10^-11;
c = 299792458;
req = 6378.137;
rpol = 6356.752;
Rerde[B_, h_] := 
 Sqrt[((req^2*Cos[B])^2 + (rpol^2*Sin[B])^2)/((req*Cos[B])^2 + (rpol*
          Sin[B])^2)] 1000 + h
rs[z_] := (Sqrt[(1 - 2 G M/(c^2 (Rerde[48.208174, 300] + z)))/(1 - 
       2 G M/(c^2 (Rerde[48.208174, 300])))]) - 1
tab = Table[rs[x], {x, 0, 20}]
ListPlot[tab]

result of tab:

{0., 0., 2.22045*10^-16, 2.22045*10^-16, 4.44089*10^-16, 
 4.44089*10^-16, 6.66134*10^-16, 6.66134*10^-16, 8.88178*10^-16, 
 8.88178*10^-16, 1.11022*10^-15, 1.11022*10^-15, 1.33227*10^-15, 
 1.33227*10^-15, 1.55431*10^-15, 1.55431*10^-15, 1.77636*10^-15, 
 1.77636*10^-15, 1.9984*10^-15, 1.9984*10^-15, 2.22045*10^-15}

ListPlot:

enter image description here

I would like to get exact results and get rid of this pairs of identical values without altering the range of 20.

Thanks

$\endgroup$

1 Answer 1

0
$\begingroup$

Possible solution:

Prec = 100;(*Set Precision*)

$Pre = Function[{in}, Unevaluated[in] /. r_Real?MachineNumberQ :> 
RuleCondition@SetPrecision[r, Prec], HoldAllComplete];


(* Put yours code here *)


$Pre =. (*Reset to default Precision *)
$\endgroup$

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.