Re: Two questions (1) Sollve and (2) Precision
- To: mathgroup at smc.vnet.net
- Subject: [mg67053] Re: [mg67035] Two questions (1) Sollve and (2) Precision
- From: "Chris Chiasson" <chris at chiasson.name>
- Date: Thu, 8 Jun 2006 04:53:30 -0400 (EDT)
- References: <200606070910.FAA23549@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Your first equation isn't "valid" Mathematica input. The = character in Mathematica is the infix form of the Set operator. == is the infix form of the Equal operator. Mathematica is not smart enough to know what you mean. Unfortunately, the burden is upon you to figure out how various mathematical concepts can be implemented in Mathematica. Also, a lot of structure is hidden from the you to obtain readable output. You may frequently have to use FullForm to see exactly what kind of output you receive. SetPrecision[ 123456789123 * 123456789123.0 , 50 ] does not give the result to 50 digits of precision. It simply changes the precision after evaluating the first argument. If you want a high precision answer, you will have to start with high precision inputs. If you do start with high precision inputs, you probably won't need SetPrecision. 123456789123.0 is interpreted as 123456789123.0`, a machine precision number. You could try using 123456789123, which is exact, or 123456789123.0`100 (100 digits of precision). On 6/7/06, Bharat Bhole <bbhole at gmail.com> wrote: > > Would appreciate if someone can point out why Mathematica is not giving the > expected output in the followng two cases. > > (1) I was trying to solve the follwing two linear equations using 'Solve'. > > > *In: Solve[{64919121*x-159018721*y=8A1,41869520.5*x-102558961*y=8A0},{x,y}]* > > *Out: {}* > > However, the solution exists and is given by x = 205117922, y = 83739041 > > Why is Mathematica unable to solve this simple linear equation? Am I doing > something wrong? > > > > (2) I suppose that the default precision for numerical calculations is > MachinePrecision which is less than 16. If I increase the precision, should > I not get more accurate results? The example below seems to contradict that. > > (i) Exact Calculation > > *In[1]: 123456789123 * 123456789123* > > *Out[1]: 15241578780560891109129* > > (ii) Numerical Calculation with Default Precision > > *In[2]: 123456789123 * 123456789123.0* > > *Out[2]: 1.52416 =D7 10^22* > > (iii) Numerical Calcuation with a higher precision. > > *In[3]:SetPrecision[ 123456789123 * 123456789123.0 , 50 ]* > > *Out[3]: 1.5241578780560891838464000000000000000000000000000 x 10^22* > > Now if I calculate Out[1]-Out[2], I get zero. > > But if I calculate Out[1]-Out[3], I get -729335.000000000000000000000000000 > -- http://chris.chiasson.name/
- References:
- Two questions (1) Sollve and (2) Precision
- From: "Bharat Bhole" <bbhole@gmail.com>
- Two questions (1) Sollve and (2) Precision