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:
Athanasios Paraskevopoulos
2024 年 5 月 19 日
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 で Geometry and Mesh についてさらに検索
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!Web サイトの選択
Web サイトを選択すると、翻訳されたコンテンツにアクセスし、地域のイベントやサービスを確認できます。現在の位置情報に基づき、次のサイトの選択を推奨します:
また、以下のリストから Web サイトを選択することもできます。
最適なサイトパフォーマンスの取得方法
中国のサイト (中国語または英語) を選択することで、最適なサイトパフォーマンスが得られます。その他の国の 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)
