Enter forum description here ...
No similar topics found.

0
Answered
Change precision of mp object
Hello.
I got a few questions about the initialisation of mp-numbers and the used precision.
A short example:
mp.Digits(34);
%cuts the number at 34 decimal digits
number34digits = mp('0.123456789123456789123456789123456789') ;
%number with lower precision
number9digits = mp('0.123456789',9);
%Some calculations
number9digits-mp('10^-20')
ans = 0.123456789
number9digits-mp('10^-9')
ans = 0.123456788
number9digits-mp('10^-20',34)
ans = 0.123456789
mp('10^-20')-number9digits
ans = -0.12345678894780576228095458984375
Interestingly this works as well:
number9digits-'10^-9'
ans = 0.123456788
Obviously the calculations are done with the precision of the first number, even the global precision is 34 digits.
%Another calculation
number34digits-number9digits
ans = 1.756510268325021992797067835708226e-10
number9digits-number34digits
ans = -1.75651027e-10
I assume the calculation is done with 34 digits precision and the number9digits is converted to 34 digits. The converted version of number9digits in 34 digits is not 0.1234567890000000000000000000000000.
mp(number9digits,34)
ans = 0.12345678894780576229095458984375
I guess the reason for that is, that the binary number is converted and not the decimal one.
If I define:
number9digits_ = mp('0.123456789',34);
number34digits-number9digits_
ans = 1.23456789123456789123456781439154e-10
The result is different of course, since the number9digits_ was defined with 34 digits precision.
Could you provide a more detailed documentation on this matter? Which precision is acctually used in calculations when numbers with different precision are used?
I was wondering if it is possible to make a function which simply converts a low precision number like
numberlowprecision = mp('1.234',9);
to a higher precision number like
numberhighprecision = mp(numberlowprecision,34)
which is acctually
numberhighprecision = mp('1.234',34);
For double numbers I am able to do that with an work around:
doublenumber = 1.234;
mpnumber = (num2str(doublenumber),34);
I did not find a mp2str function but maybe I missed it.
A question on another matter is the initialisation of mp-arrays. I did not get the syntax yet. I tried:
mparray = mp('[1.23456,1.23456]');
mparray = mp({'1.23456','1.23456'})
Thank you for your answer.
I got a few questions about the initialisation of mp-numbers and the used precision.
A short example:
mp.Digits(34);
%cuts the number at 34 decimal digits
number34digits = mp('0.123456789123456789123456789123456789') ;
%number with lower precision
number9digits = mp('0.123456789',9);
%Some calculations
number9digits-mp('10^-20')
ans = 0.123456789
number9digits-mp('10^-9')
ans = 0.123456788
number9digits-mp('10^-20',34)
ans = 0.123456789
mp('10^-20')-number9digits
ans = -0.12345678894780576228095458984375
Interestingly this works as well:
number9digits-'10^-9'
ans = 0.123456788
Obviously the calculations are done with the precision of the first number, even the global precision is 34 digits.
%Another calculation
number34digits-number9digits
ans = 1.756510268325021992797067835708226e-10
number9digits-number34digits
ans = -1.75651027e-10
I assume the calculation is done with 34 digits precision and the number9digits is converted to 34 digits. The converted version of number9digits in 34 digits is not 0.1234567890000000000000000000000000.
mp(number9digits,34)
ans = 0.12345678894780576229095458984375
I guess the reason for that is, that the binary number is converted and not the decimal one.
If I define:
number9digits_ = mp('0.123456789',34);
number34digits-number9digits_
ans = 1.23456789123456789123456781439154e-10
The result is different of course, since the number9digits_ was defined with 34 digits precision.
Could you provide a more detailed documentation on this matter? Which precision is acctually used in calculations when numbers with different precision are used?
I was wondering if it is possible to make a function which simply converts a low precision number like
numberlowprecision = mp('1.234',9);
to a higher precision number like
numberhighprecision = mp(numberlowprecision,34)
which is acctually
numberhighprecision = mp('1.234',34);
For double numbers I am able to do that with an work around:
doublenumber = 1.234;
mpnumber = (num2str(doublenumber),34);
I did not find a mp2str function but maybe I missed it.
A question on another matter is the initialisation of mp-arrays. I did not get the syntax yet. I tried:
mparray = mp('[1.23456,1.23456]');
mparray = mp({'1.23456','1.23456'})
Thank you for your answer.

0
Answered
Citing the Multiple Precision Toolbox
Hi Pavel,
how are you doing? We are now in the last stage of preparing the next release of the Rational Krylov Toolbox. When updating the guide I was wondering what would be the best way to cite your toolbox? I looked at several papers in the literature which referred to the toolbox, and there doesn't seem to be any agreement. For example, I've seen
- Advanpix. Multiple Precision Toolbox. www.advanpix.com
- www.advanpic.com MP toolbox.
- MATLAB Multiple Precision Toolbox.
I think it would be very useful to many authors if you could add to your website how to cite the toolbox, perhaps even providing a bibitem? Perhaps you can even create an EPrint from the documentation? Or perhaps there already is one?
As promised, I will let you know about our release in due course.
Greetings from Manchester,
Stefan
how are you doing? We are now in the last stage of preparing the next release of the Rational Krylov Toolbox. When updating the guide I was wondering what would be the best way to cite your toolbox? I looked at several papers in the literature which referred to the toolbox, and there doesn't seem to be any agreement. For example, I've seen
- Advanpix. Multiple Precision Toolbox. www.advanpix.com
- www.advanpic.com MP toolbox.
- MATLAB Multiple Precision Toolbox.
I think it would be very useful to many authors if you could add to your website how to cite the toolbox, perhaps even providing a bibitem? Perhaps you can even create an EPrint from the documentation? Or perhaps there already is one?
As promised, I will let you know about our release in due course.
Greetings from Manchester,
Stefan

0
Fixed
Convert complex numbers from mp to sym
Hello again.
The following statement leads to an error:
x = mp('1i');
xvpa = mp2sym(x);
I think the reason is the following:
xvpa = vpa('1*i') (This works)
xvpa = vpa('1i') (Without "*" it gives an error)
The following statement leads to an error:
x = mp('1i');
xvpa = mp2sym(x);
I think the reason is the following:
xvpa = vpa('1*i') (This works)
xvpa = vpa('1i') (Without "*" it gives an error)

0
Not a bug
Wrong display of arrays after vertical concatenation
Hello.
There is a bug in the display of arrays after a vertical concatenation. (Matlab 2014b)
Example:
mp.Digits(34)
a=(1:100)';
b=mp(a(1:50));
c=mp(a(51:100));
d=[b;c];
If you view the variable d in the variable editor it shows the wrong numbers after the 65th entry. If you check it in the command window it is correct.
There is a bug in the display of arrays after a vertical concatenation. (Matlab 2014b)
Example:
mp.Digits(34)
a=(1:100)';
b=mp(a(1:50));
c=mp(a(51:100));
d=[b;c];
If you view the variable d in the variable editor it shows the wrong numbers after the 65th entry. If you check it in the command window it is correct.

0
Answered
meshgrid and ndgrid support
Does the MCT support meshgrid and/or ndgrid in multiprecision? I've been using these in my programs with the mp type, but I wanted to check anyway.

0
Fixed
Output of disp
Hi Pavel,
we have observed the following "bug" (or rather inconsistency) in the formatting of the output via DISP:
Mario Berljafa & Stefan Guettel
we have observed the following "bug" (or rather inconsistency) in the formatting of the output via DISP:
Standard MATLAB code with output:
>> disp(1)
1
MP version:
>> disp(mp(1))
x =
1
There should be no x. As mp(1) pruduces no "x =", the bug must be in disp.
Another inconsistency with MATLAB output formatting concerns format compact. One would expect a reduced amount of space when it is turned on, which appears not to be the case with mp.
>> format compact
>> 1
ans =
1
>> disp(1)
1
>> mp(1)
ans =
1
>> disp(mp(1))
x =
1
Cheers,

0
Answered
Does matrix multiplication use multiple cores?
Hello Pavel.
I was wondering if you updated the software to use multiple cores in case of matrix multiplication. I read something about it in the change log, but it seems to me it still uses 1 core all the time.
Thank you.
Best regards,
Michael
I was wondering if you updated the software to use multiple cores in case of matrix multiplication. I read something about it in the change log, but it seems to me it still uses 1 core all the time.
Thank you.
Best regards,
Michael

0
Answered
Definite integrals with mp-objects
Hello,
Is there a possibility to calculate definite integrals of sum of products of sines/cosines with cosh/sinh with mp-objects?
Kind regards,
Jeremy

0
Answered
Read and write performance in arrays
Hello.
Following example:
Double values:
A=zeros(6000,6000);
tic
for ii = 1:6000
for jj = 1:6000
A(ii,jj)=1.234;
end
end
toc
Elapsed time is 2.038870 seconds
Now without defining A before the for-loop
tic
for ii = 1:6000
for jj= 1:6000
A(ii,jj)=1.234;
end
end
toc
Elapsed time is 120.038870 seconds
Of course the performance is better if I define the array in advance.
Now the same for an mp array with 34 digits:
A=mp(zeros(200,200));
tic
for ii =1:200
for jj = 1:200
A(ii,jj)=mp('1.234');
end
end
toc
Elapsed time is 22.309700 seconds.
Now without defining A before the for-loop
tic
for ii =1:200
for jj = 1:200
A(ii,jj)=mp('1.234');
end
end
toc
Elapsed time is 14.581011 seconds.
How is this possible? This even becomes worse if the matrix is bigger.
Thanks for your answer.
Following example:
Double values:
A=zeros(6000,6000);
tic
for ii = 1:6000
for jj = 1:6000
A(ii,jj)=1.234;
end
end
toc
Elapsed time is 2.038870 seconds
Now without defining A before the for-loop
tic
for ii = 1:6000
for jj= 1:6000
A(ii,jj)=1.234;
end
end
toc
Elapsed time is 120.038870 seconds
Of course the performance is better if I define the array in advance.
Now the same for an mp array with 34 digits:
A=mp(zeros(200,200));
tic
for ii =1:200
for jj = 1:200
A(ii,jj)=mp('1.234');
end
end
toc
Elapsed time is 22.309700 seconds.
Now without defining A before the for-loop
tic
for ii =1:200
for jj = 1:200
A(ii,jj)=mp('1.234');
end
end
toc
Elapsed time is 14.581011 seconds.
How is this possible? This even becomes worse if the matrix is bigger.
Thanks for your answer.
Customer support service by UserEcho