Demonstrate variable precision arithmetic with the Symbolic Math Toolbox.
Compute 19/81 to 70 digits. Notice the repeated pattern of digits. "vpa" stands for variable precision arithmetic.
vpa 19/81 70
ans = .2345679012345679012345679012345679012345679012345679012345679012345679
Compute pi to 780 digits. Notice the string of 9's near the end.
vpa pi 780
ans = 3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110555964462294895493038196442881097566593344612847564823378678316527120190914564856692346034861045432664821339360726024914127372458700660631558817488152092096282925409171536436789259036001133053054882046652138414695194151160943305727036575959195309218611738193261179310511854807446237996274956735188575272489122793818301194912983367336244065664308602139494639522473719070217986094370277053921717629317675238467481846766940513200056812714526356082778577134275778960917363717872146844090122495343014654958537105079227968925892354201995611212902196086403441815981362977477130996051870721134999999837297804995
Compute exp(sqrt(163)*pi) to 30 digits.
vpa exp(sqrt(163)*pi) 30
ans = 262537412640768744.000000000024
The value might be an integer.
Compute the same value to 40 digits.
vpa exp(sqrt(163)*pi) 40
ans = 262537412640768743.9999999999992500725944
So, the value is close to, but not exactly equal to, an integer.
Compute 70 factorial with 200 digit arithmetic.
f = vpa('70!',200)
f = 11978571669969891796072783721689098736458938142546425857555362864628009582789845319680000000000000000.
How many digits in 70!?
length(char(f))
ans = 102
Compute the eigenvalues of the fifth order magic square to 50 digits.
digits(50) A = sym(magic(5)) e = eig(vpa(A))
A = [ 17, 24, 1, 8, 15] [ 23, 5, 7, 14, 16] [ 4, 6, 13, 20, 22] [ 10, 12, 19, 21, 3] [ 11, 18, 25, 2, 9] e = 65.000000000000000000000000000000000000000000000031 21.276765471473795530626426697974230836132173556001 -13.126280930709218802525643085949143823222734386507 -21.276765471473795530626426697974230836132173556008 13.126280930709218802525643085949143823222734386506