I'm trying to read digits of irrational numbers such as 2^0.5
and pi
one by one in Matlab.
I tried using this:
x=pi;
y=num2str(x)
out=str2num(y(1))
but it only reads just a few digits. Then I tried using vpa function.
x=vpa(pi,100);
y=num2str(x)
out=str2num(y(1))
but vpa makes x a sym variable which num2str can't read.
Then I tried the method explained in here, but it only seems to work for rational numbers since
sym(99)^95
returns a number which can be read digit by digit using
char(sym(99)^95)-'0'
but
sym(2)^0.5
just says
ans= 2^(1/2)
How can I do the same with irrational numbers to say 10000 digits of precision and store these digits in a (1000,1) array?