Re: Need help integrating Wolfram Alpha data in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg123445] Re: Need help integrating Wolfram Alpha data in Mathematica
- From: Barrie Stokes <Barrie.Stokes at newcastle.edu.au>
- Date: Thu, 8 Dec 2011 05:20:38 -0500 (EST)
- Delivered-to: l-mathgroup@mail-archive0.wolfram.com
Hi Bob Do you get these results? In[1]:= protonMass = WolframAlpha["proton mass in kilograms", "ComputableData"][[1]] Precision[ protonMass ] (* Precision[x] gives the effective number of \ digits of precision in the number x. *) Accuracy[ protonMass ] (* Accuracy [x] gives the effective number of \ digits to the right of the decimal point in the numberx. *) Out[1]= 1.6726217*10^-27 Out[2]= 7.2701 Out[3]= 34.0467 In[4]:= Precision[ protonMass ] + 27 Out[4]= 34.2701 In[5]:= Needs["PhysicalConstants`"] ProtonMass Precision[ ProtonMass ] Accuracy[ ProtonMass ] Out[6]= 1.67262*10^-27 Kilogram Out[7]= MachinePrecision Out[8]= 42.7312 In[9]:= $MachinePrecision Out[9]= 15.9546 In[10]:= $MachinePrecision + 27 Out[10]= 42.9546 Hmm. I wonder what is going on here. BTW, Wikipedia gives 1.672621777(74)*10^(*27) kg, and proton mass = 1.67262158 * 10-27 kilograms is the first Google hit for "mass of a proton". Barrie >>> On 06/12/2011 at 7:12 pm, in message <201112060812.DAA18403 at smc.vnet.net>, Bob Hanlon <hanlonr357 at gmail.com> wrote: > WolframAlpha["proton mass in kilograms","ComputableData"][[1]] > > 1.6726217*10^-27 > > Needs["PhysicalConstants`"] > > ProtonMass > > 1.67262*10^-27 Kilogram > > > Bob Hanlon > > On Mon, Dec 5, 2011 at 5:17 AM, Dave M <cvk1812 at hotmail.com> wrote: >> I'm using Wolfram Mathematica 8, and I have a question about using Wolfram > Alpha data in my calculations. >> >> What I would like to do is to pull data from the Wolfram Alpha search > engine, and then store it in a Mathematica variable for future use. I cannot > figure out how to do this easily. >> >> To illustrate what I mean, here's a simple example. Let's say I want the > mass of a proton in kilograms. I can obtain this by simply typing "== mass of > proton in kilograms", upon which Mathematica contacts the Wolfram Alpha > server, and downloads a lot of data. >> >> This data doesn't only contain the actual number I wanted, it is actually a > huge table with many cells containing information about how Wolfram Alpha > parsed my query, the assumptions used, conversions of the answer to various > other units, etc. >> >> However, all I wanted was simply the answer to my query in a computable > numeric form, so I could store that in a variable in Mathematica. >> >> I can get somewhat usable results if I do something like this: >> >> WolframAlpha["mass of proton in kilograms", {{"Result", 1}, >> "ComputableData"}] >> >> However, this is a pretty complicated way of doing something really simple. > Is there some simpler method that involves much less typing? >>