plot of riemann surface
이 질문을 팔로우합니다.
- 팔로우하는 게시물 피드에서 업데이트를 확인할 수 있습니다.
- 정보 수신 기본 설정에 따라 이메일을 받을 수 있습니다.
오류 발생
페이지가 변경되었기 때문에 동작을 완료할 수 없습니다. 업데이트된 상태를 보려면 페이지를 다시 불러오십시오.
이전 댓글 표시
0 개 추천
I am plotting the Riemann surface and I do expect symmetry with respect to the x and y axis, but it seems that I get only the one half of the surface
those lines give the surface
w01 = sqrt(r).*exp(1i*theta/2); % first branch
w02 = sqrt(r).*exp(1i*(theta+2*pi)/2); % second branch
(with z = re + 1j*im;
theta = angle(z); % atan2(imag(z), real(z));
r = 2*abs(z);)
채택된 답변
Athanasios Paraskevopoulos
2024년 5월 18일
To plot a complete Riemann surface for the function
, you need to consider the nature of the complex square root function and how it behaves in different branches of the complex plane. The function
has two branches, which you've correctly identified. However, to visualize the complete surface, you must ensure that your parameterization covers the entire complex plane, not just a portion.
The complex plane
is defined by
, where
is the magnitude
and θ is the angle
.
The square root function has two branches:
- 
- 
To visualize both branches and the symmetry, ensure you cover θ from
to
and r over the desired range.
% Define the range for r and theta
r_min = 0; r_max = 4; % You can adjust the range as needed
theta_min = -pi; theta_max = pi;
% Create a grid of (r, theta)
r = linspace(r_min, r_max, 100); % 100 points in r
theta = linspace(theta_min, theta_max, 100); % 100 points in theta
[R, Theta] = meshgrid(r, theta);
% Calculate the first branch w01 and second branch w02
W01 = sqrt(R) .* exp(1i * Theta / 2); % first branch
W02 = sqrt(R) .* exp(1i * (Theta + 2*pi) / 2); % second branch
% Split into real and imaginary parts for plotting
x1 = real(W01); y1 = imag(W01); z1 = R; % First branch
x2 = real(W02); y2 = imag(W02); z2 = R; % Second branch
% Plot the first branch
figure;
surf(x1, y1, z1);
hold on;
% Plot the second branch
surf(x2, y2, z2);
% Labels and title
xlabel('Re(w)');
ylabel('Im(w)');
zlabel('r');
title('Riemann Surface of w = \surd{z}');
grid on;
hold off;

댓글 수: 7
This is how I have adapted my code to your suggestions, but still I do not see the full rotation. Should I include plus/minus pi in theta definition?
Thank you
re = linspace(-r0, r0, 40).';
im = linspace(-r1, r1, 40);
z = re + 1j*im;
theta = angle(z);
r = 2*abs(z);
w01 = sqrt(r).*exp(1i*theta/2); % first branch
w02 = sqrt(r).*exp(1i*(theta+2*pi)/2); % second branch
w1=(8+1i*gnr-0.5*sqrt((delta+k^2)^2+4*k^2))*w01;
w2=(10+1i*gnr+0.5*gr+0.5*sqrt((1i*gr+delta+k^2)^2+4*k^2))*w02; %2 4
Torsten
2024년 5월 19일
Looks like a paraboloid, but not like the correct graph given here:
Hello@Torsten.The code I provided is specifically tailored to plot the Riemann surface using polar coordinates. This method offers a more accurate representation of the complex square root function's branches and makes it easier to visualize the continuity and branch cuts of the function
- Polar Coordinates (First Code)
% Define the range for r and theta
r_min = 0; r_max = 4; % You can adjust the range as needed
theta_min = -pi; theta_max = pi;
% Create a grid of (r, theta)
r = linspace(r_min, r_max, 100); % 100 points in r
theta = linspace(theta_min, theta_max, 100); % 100 points in theta
[R, Theta] = meshgrid(r, theta);
% Calculate the first branch w01 and second branch w02
W01 = sqrt(R) .* exp(1i * Theta / 2); % first branch
W02 = sqrt(R) .* exp(1i * (Theta + 2*pi) / 2); % second branch
% Split into real and imaginary parts for plotting
x1 = real(W01); y1 = imag(W01); z1 = R; % First branch
x2 = real(W02); y2 = imag(W02); z2 = R; % Second branch
% Create the figure
figure;
% Plot the first branch
surf(x1, y1, z1, 'FaceColor', 'interp', 'FaceAlpha', 0.8, 'EdgeColor', 'none');
hold on;
% Plot the second branch
surf(x2, y2, z2, 'FaceColor', 'interp', 'FaceAlpha', 0.8, 'EdgeColor', 'none');
% Adjust the colormap
colormap(hsv);
% Set the plot aesthetics
shading interp;
axis tight;
xlabel('Re(w)', 'FontSize', 14);
ylabel('Im(w)', 'FontSize', 14);
zlabel('r', 'FontSize', 14);
title('Riemann Surface of w = \surd{z}', 'FontSize', 16);
% Add a color bar
colorbar;
% Set the view angle to match the original image
view([-45 45]);
% Add a light for better visual effect
camlight left;
lighting phong;
% Enhance the grid and axes
grid on;
set(gca, 'GridAlpha', 0.5, 'GridLineStyle', '--', 'LineWidth', 1.5);

This code uses polar coordinates (r, theta) to plot the Riemann surface of the square root function. It calculates both branches of the square root function, and plots them, which provides a more accurate representation of the Riemann surface and highlights the branch cuts.
- Cartesian Coordinates (Second Code)
% Define the range and create a grid
[x, y] = meshgrid(linspace(-1, 1, 200), linspace(-1, 1, 200));
% Convert the grid to complex numbers
z = x + 1i * y;
% Calculate the function values (square root)
w = sqrt(z);
% Separate the real and imaginary parts
u = real(w);
v = imag(w);
% Create the figure
figure;
% Create the surface plot for the real part
surf(x, y, u, 'FaceColor', 'interp', 'FaceAlpha', 0.9, 'EdgeColor', 'none');
hold on;
% Create the surface plot for the imaginary part
surf(x, y, v, 'FaceColor', 'interp', 'FaceAlpha', 0.9, 'EdgeColor', 'none');
% Adjust the colormap to match the original image
colormap(hsv);
% Set the plot aesthetics
shading interp;
axis tight;
xlabel('Real part of z', 'FontSize', 14);
ylabel('Imaginary part of z', 'FontSize', 14);
zlabel('Real and Imaginary parts of sqrt(z)', 'FontSize', 14);
title('Riemann Surface of w = \surd{z}', 'FontSize', 16);
% Set the view angle to match the original image
view([-45 45]);
% Add a light for better visual effect
camlight left;
lighting phong;
% Enhance the grid and axes
grid on;
set(gca, 'GridAlpha', 0.5, 'GridLineStyle', '--', 'LineWidth', 1.5);
% Add a color bar
colorbar;

This code uses Cartesian coordinates (x, y) to plot the surfaces representing the real and imaginary parts of the square root function. This results in two separate surfaces plotted in 3D space.
- Function Branches
- The first code explicitly calculates and plots both branches, providing a more complete representation of the Riemann surface.The first code plots the real and imaginary parts in a way that visually represents the multi-valued nature of the complex square root function.
- The second code does not explicitly account for the different branches of the square root function. The second code plots separate surfaces for the real and imaginary parts of the function.
Athanasios Paraskevopoulos
2024년 5월 19일
@SCIUSCIA could you show me your whole code please?
this is my code
r0 = 2; %delta
r1 = 2; %k1 10
r2 = 2; %2
re = linspace(-r0, r0, 40).';
im = linspace(-r1, r1, 40);
z = re + 1j*im;
theta = angle(z);
r = 2*abs(z);
delta = 0.5;
k = 0.01;
gnr = 0.3;
gr = 0.4;
w01 = sqrt(r).*exp(1i*theta/2); % first branch
w02 = sqrt(r).*exp(1i*(theta+2*pi)/2); % second branch
w1=(8+1i*gnr-0.5*sqrt((delta+k^2)^2+4*k^2))*w01;
w2=(10+1i*gnr+0.5*gr+0.5*sqrt((1i*gr+delta+k^2)^2+4*k^2))*w02; %2 4
% w1=(1i*gnr-0.5*sqrt((delta+k^2)^2+4*k^2))*w01;
% w2=(1i*gnr+1i*0.5*gr+0.5*sqrt((1i*gr+delta+k^2)^2+4*k^2))*w02;
% z = [z, nan(size(w1,1),1), z(:,end:-1:1)];
% w = [w1, nan(size(w1,1),1), w2(:,end:-1:1)];
z = [z, nan(size(w1,1),1), z(:,end:-1:1)];
w1 = [w1, nan(size(w1,1),1), w1(:,end:-1:1)];
w2 = [w2, nan(size(w2,1),1), w2(:,end:-1:1)];
figure('Name','Graphique complexe','units','normalized','outerposition',[ 0.08 0.1 0.8 0.55]);
subplot(121)
% surf(real(z),imag(z),real(w1),'FaceAlpha',0.8);
surf(real(z),imag(z),real(w1), 'FaceLighting','gouraud',...
'MeshStyle','column',...
'SpecularColorReflectance',0,...
'SpecularExponent',5,...
'SpecularStrength',0.2,...
'DiffuseStrength',1,...
'AmbientStrength',0.4,...
'AlignVertexCenters','on',...
'LineWidth',0.2,...
'FaceAlpha',0.2,...
'FaceColor',[0.07 0.6 1],...
'EdgeAlpha',0.2);
hold on
% surf(real(z),imag(z),real(w2),'FaceAlpha',0.8); % visualize the complex function using surf
surf(real(z),imag(z),real(w2), 'SpecularExponent',1,...
'SpecularStrength',1,...
'DiffuseStrength',1,...
'AmbientStrength',0.4,...
'FaceColor',[0.5 0.5 .5],...
'AlignVertexCenters','on',...
'LineWidth',0.2,...
'EdgeAlpha',1);
ylabel('Imag(z)')
zlabel('Real(u)')
%cb = colorbar;
%colormap pink; % gradient from blue to red
%cb.Label.String = 'Imag(v)';
plane_z = +0;
surf(xlim, ylim, plane_z*ones(2), 'FaceColor','w', 'FaceAlpha',0.5)
subplot(122)
% surf(real(z),imag(z),imag(w1),'FaceAlpha',0.8); % visualize the complex function using surf
surf(real(z),imag(z),imag(w1),'FaceLighting','gouraud',...
'MeshStyle','column',...
'SpecularColorReflectance',0,...
'SpecularExponent',5,...
'SpecularStrength',0.2,...
'DiffuseStrength',1,...
'AmbientStrength',0.4,...
'AlignVertexCenters','on',...
'LineWidth',0.2,...
'FaceAlpha',0.2,...
'FaceColor',[0.07 0.6 1],...
'EdgeAlpha',0.2);
hold on
% surf(real(z),imag(z),imag(w2),'FaceAlpha',0.8);
surf(real(z),imag(z),imag(w2),'SpecularExponent',1,...
'SpecularStrength',1,...
'DiffuseStrength',1,...
'AmbientStrength',0.4,...
'FaceColor',[0.5 0.5 .5],...
'AlignVertexCenters','on',...
'LineWidth',0.2,...
'EdgeAlpha',0.2);
xlabel('Real(z)')
ylabel('Imag(z)')
zlabel('Imag(v)')
%cb = colorbar;
%colormap pink;
%cb.Label.String = 'Real(u)';
plane_z = +0;
surf(xlim, ylim, plane_z*ones(2), 'FaceColor','w', 'FaceAlpha',0.5)
hold off

I get something that is similar to the output of your second code.
Athanasios Paraskevopoulos
2024년 5월 19일
If your goal is to visualize a more complex function with specified parameters and not the Riemann surface of
, your code is correct. I don't now if this is your goal because you are using the square root and exponential functions, with parameters influencing the function's branches.
SCIUSCIA
2024년 5월 19일
Thank you. Yes, my objective is to visualize a specified function which has Im and Re parts.
I thought to visualize only half surface.
추가 답변 (0개)
카테고리
도움말 센터 및 File Exchange에서 Contour Plots에 대해 자세히 알아보기
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!웹사이트 선택
번역된 콘텐츠를 보고 지역별 이벤트와 혜택을 살펴보려면 웹사이트를 선택하십시오. 현재 계신 지역에 따라 다음 웹사이트를 권장합니다:
또한 다음 목록에서 웹사이트를 선택하실 수도 있습니다.
사이트 성능 최적화 방법
최고의 사이트 성능을 위해 중국 사이트(중국어 또는 영어)를 선택하십시오. 현재 계신 지역에서는 다른 국가의 MathWorks 사이트 방문이 최적화되지 않았습니다.
미주
- América Latina (Español)
- Canada (English)
- United States (English)
유럽
- Belgium (English)
- Denmark (English)
- Deutschland (Deutsch)
- España (Español)
- Finland (English)
- France (Français)
- Ireland (English)
- Italia (Italiano)
- Luxembourg (English)
- Netherlands (English)
- Norway (English)
- Österreich (Deutsch)
- Portugal (English)
- Sweden (English)
- Switzerland
- United Kingdom (English)
