High precision calculation in Mathematica


by brian0918
Tags: calculation, mathematica, precision
brian0918
brian0918 is offline
#1
Nov15-04, 11:12 PM
P: 44
I'm trying to calculate the velocity of 10^20 eV cosmic rays, but the precision in Mathematica and Google is not high enough: both give velocities of exactly 1*c.

I've tried putting SetAccuracy[...,1000] around all the constants and the final result, and it still doesnt work. It now gives 1.0000000000000...000*c


I know Mathematica can do this, so what is the proper command?


Thanks.
Phys.Org News Partner Science news on Phys.org
Simplicity is key to co-operative robots
Chemical vapor deposition used to grow atomic layer materials on top of each other
Earliest ancestor of land herbivores discovered
Tide
Tide is offline
#2
Nov15-04, 11:14 PM
Sci Advisor
HW Helper
P: 3,149
Why don't you try subtracting c from the answer to find what Mathematica thinks the difference is?
brian0918
brian0918 is offline
#3
Nov15-04, 11:24 PM
P: 44
Well, I've tried N, SetAccuracy, and SetPrecision. For a precision of 1000 decimals, I subtracted c (which also has a precision of 1000 decimals) and it got zero out to all the digits.

I'm pretty sure I'm just not using the correct command, since I've had this problem before and figured out what to do.

brian0918
brian0918 is offline
#4
Nov15-04, 11:31 PM
P: 44

High precision calculation in Mathematica


Nevermind, I figured it out. You have to use SetPrecision on basically every number.


Oh, and for the record, 10^20 eV corresponds to 0.999999999999999999999955982283131960440050993898862440697486711315663 19262949728462461319064015929690c
Duarh
Duarh is offline
#5
Nov15-04, 11:31 PM
P: 59
hmm, aren't those rays photons? aren't they supposed to move at the speed of light? or are they propagating through some medium or otherwise interacting in a way that would slow them down?
brian0918
brian0918 is offline
#6
Nov15-04, 11:33 PM
P: 44
No, they're ultra-high energy cosmic rays (most likely protons). I'm using the relativistic kinetic energy equation to get the velocity:
Attached Thumbnails
keneticenergy.jpg  
brian0918
brian0918 is offline
#7
Nov15-04, 11:38 PM
P: 44
I wonder if this necessary high precision is going to slow down numerical analysis, since everything will have to be out to ~30 decimals.
krab
krab is offline
#8
Nov16-04, 12:43 PM
Sci Advisor
krab's Avatar
P: 905
It's not numerically efficient to deal directly with v/c when energy is very high. You should get into the habit of using the relevant expansions. So for example,
[tex]\gamma={1\over\sqrt{1-\beta^2}}[/tex]
where [itex]\gamma=\mbox{Energy}/(mc^2)[/itex], and [itex]\beta=v/c[/itex]. Then
[tex]\beta=\sqrt{1-1/\gamma^2}\approx 1-{1\over 2\gamma^2}[/tex]
This gives you easily sufficient accuracy, and is very fast.


Register to reply

Related Discussions
Precision Introductory Physics Homework 3
Setting precision? C++ Programming & Computer Science 5
Calculating constants to high precision General Math 7
low noise, precision amp? Electrical Engineering 3