No BSD License  

Highlights from
Complex Dilogarithm

4.0

4.0 | 6 ratings Rate this file 13 Downloads (last 30 days) File Size: 1.69 KB File ID: #10186

Complex Dilogarithm

by Didier Clamond

 

28 Feb 2006 (Updated 03 May 2006)

Dilogarithm of any complex numbers

| Watch this File

File Information
Description

dilog(z) returns the (component-wise) dilogarithm of z. It is quite fast and accurate (around machine precision).

The present dilog function corresponds to Maple's polylog(2,z) and Mathematica's PolyLog[2,z] functions.

It is defined as
dilog(z) = sum_{n=1}^Inf z^n/n^2
for |z|<=1, and by analytic continuation for |z|>1.

MATLAB release MATLAB 7.1.0 (R14SP3)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (9)
02 May 2006 Richard Alexander

Results appear to be wrong!
For example:
dilog(100) = -12.19242 according to Maple
dilog(100) = -7.324 -14.467i according to this.

03 May 2006 Didier Clamond

They are several definitions of the dilogarithm. The present M-file corresponds
to Maple's polylog(2,z) function and NOT its
dilog function. Maple 8 says:
evalf(polylog(2,100)) = -7.323953199-14.46756882*I
which is what the M-file gives.

The definition is clearly explained in the header of dilog.m. You should read it.

09 Sep 2006 lian tuma  
06 Jan 2009 Marcelo Pisani  
06 Jan 2009 Marcelo Pisani

except for x=0.5, this function gives incorrect results for x in the interval [0 2]

08 Jan 2009 Didier Clamond

I don't see what's wrong with dilog.m for x in the interval [0 2].
For example,

with Matlab R2007a:
dilog(0.25)
ans = 0.267652639082733

with Mathematica 5.2:
N[PolyLog[2, 1/4], 17]
ans = 0.26765263908273261

09 Jan 2009 Marcelo Pisani

x = linspace(-10,10,256)';
d1 = dilog(x);
d2 = zeros(size(x));
for ii = 1:numel(d2)
    d2(ii) = str2double(maple(sprintf('evalf(polylog(2,%g))',x(ii))));
end
clf;
subplot(2,1,1); plot(x,[real(d1) real(d2)]); ylabel('real');
subplot(2,1,2); plot(x,[imag(d1) imag(d2)]); ylabel('imag');
legend({'dilog(x)' 'polylog(2,x)'});
xlabel('x');

10 Jan 2009 Didier Clamond

I still don't find the problem.
I don't have access to Matlab's symbolic toolbox.
My guess is that you loose accuracy somewhere in converting string to numeric, or something like that. Please, read your manual.

11 Jul 2009 Marcelo Pisani

The code works as expected, unfortunately File exchange does not allow to edit past ratings and I could not revise it. Even worse, the low rate was entered twice when I was trying to correct it.

Please login to add a comment or rating.
Updates
03 May 2006

Clarified definition.

Tag Activity for this File
Tag Applied By Date/Time
dilog Didier Clamond 22 Oct 2008 08:17:12
dilogarithm Didier Clamond 22 Oct 2008 08:17:12
complex Didier Clamond 22 Oct 2008 08:17:12
numbers Didier Clamond 22 Oct 2008 08:17:12
fast Didier Clamond 22 Oct 2008 08:17:12
accurate Didier Clamond 22 Oct 2008 08:17:12

Contact us at files@mathworks.com