vpa - Variable precision arithmetic

Syntax

R = vpa(A)
R = vpa(A,d)

Description

R = vpa(A) uses variable-precision arithmetic (VPA) to compute each element of A to d decimal digits of accuracy, where d is the current setting of digits. Each element of the result is a symbolic expression.

R = vpa(A,d) uses d digits, instead of the current setting of digits.

Examples

The statements

digits(25)
q = vpa(sin(sym('pi')/6))
p = vpa(pi)
w = vpa('(1+sqrt(5))/2')

return

q = 0.5

p = 3.141592653589793238462643

w = 1.618033988749894848204587

vpa pi 75 computes π to 75 digits.

The statements

A = vpa(hilb(2),25)
B = vpa(hilb(2),5)

return

A =
[ 1.0,                         0.5]
[ 0.5, 0.3333333333333333333333333]

B =
[ 1.0,     0.5]
[ 0.5, 0.33333]

See Also

digits, double

  


 © 1984-2008- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS