From: <HIDDEN>
Newsgroups: comp.soft-sys.matlab
Subject: Re: vpa help with matrices
Date: Sun, 18 Apr 2010 19:05:10 +0000 (UTC)
Organization: Missouri Science and Technology
Lines: 32
Message-ID: <hqfl56$nfj$>
References: <hqfald$g20$> <hqfej0$fj4$> <hqfg9c$bii$> <hqfj77$p87$>
Reply-To: <HIDDEN>
Content-Type: text/plain; charset=UTF-8; format=flowed
Content-Transfer-Encoding: 8bit
X-Trace: 1271617510 24051 (18 Apr 2010 19:05:10 GMT)
NNTP-Posting-Date: Sun, 18 Apr 2010 19:05:10 +0000 (UTC)
X-Newsreader: MATLAB Central Newsreader 1549003
Xref: comp.soft-sys.matlab:627652

"Roger Stafford" <> wrote in message <hqfj77$p87$>...
> "ben payne" <> wrote in message <hqfg9c$bii$>...
> > Hello. I am somewhat confused as to how useful vpa is if it only displays output from symbolic computation. For example, if I want to perform a numeric calculation to better than double or quad precision, it sounds like matlab is unable to do that?
> > 
> > I am asking basically the same question as on
> >
> > but they don't answer my question there. Namely, if I have two variables known to 100 decimal places, can I perform operations with those variables and retain precision?
> > 
> > Unlike thread 151496, I don't need the fastest library. The original program is written in Fortran 90, and I have used quadruple precision for that. However, quadruple precision is insufficient.
> > 
> > Do I need to be using something like the following?
> >
> > I assumed matlab would be able to perform vpa arithmetic.
>   On my system if I type
>  x = vpa('sqrt(2)',100)
> I get the square root of two out to a hundred decimal places of accuracy, but if I merely type
>  y = vpa(sqrt(2),100)
> I get a hundred decimal places but it is accurate only out to the sixteenth place.
>   The difference is that I have convinced 'vpa' to regard the first expression as being of type 'sym', but the second is only regarded as of type 'double'.  There is a world of difference between the two entities.
>   To obtain 100-place accuracy in general computations you will need a system that is capable of handling type 'sym'.  When you say, "I have two variables known to 100 decimal places" you cannot be talking about a variable represented as a 64-bit double precision floating point number.  It can't be done with such a limited object.  It has to be in another form with far greater capacity, a form which the symbolic toolbox can use, which is to say a type 'sym'.  As you are probably aware, matlab's symbolic toolbox accomplishes this with strings of characters or strings of decimal digits of variable lengths depending on the required accuracy.
> Roger Stafford

Thanks for your help Roger. I will implement the program in Mathematica