Convert complex numbers from mp to sym

Michael_ 6 years ago updated by Pavel Holoborodko 6 years ago 2
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)
Under review
The '1i' syntax is standard in MATLAB. It is strange that 'vpa' doesn't support it.

Please modify the mp2sym script as follow:

    r = sym(zeros(size(s)));
    for n=1:numel(s), r(n) = sym(strrep(num2str(s(n)),'i','*i')); end;