# Spline interpolation varies hugely when variables are rescaled in 3d-lists ?

Dear all,

Here is a short script:

(nbx, nby) = (74, 90)

def fx(x):
return (0.5 + x/2.5)

def fy(y):
return (40*y)

zetaPlot = list_plot3d([(30 * (fx(x/nbx)-1/2)+1/2 ,  fy(y/nby), 5 * abs(zeta(fx(x/nbx) + I*fy(y/nby))))

for x in range(-nbx, nbx+1) for y in range(-nby, nby+1)],

interpolation_type = 'spline')

zetaPlot.show()


Now modify the z-coordinate: replace "5 * abs(zeta...)" by "abs(zeta...)" The resulting graph is essentially flat. Can anyone tell me what is happening there? Also, I would like to get rid of my scaling parameters 30 and 5 by using frame_aspect_ratio, to get cleaner code and a better annoted frame, but I don't seem to understand how to do it.

A great many thanks for anyone who would take the time to teach me that, it is some hours that I'm struggling with some docs and examples without having reached much --

Best, Olivier

edit retag close merge delete

Sort by » oldest newest most voted

The questions seems to split into two questions.

• Why do we get such different graphs when using list_plot3d with spline interpolation, starting from two 3D point sets whose only difference is a scaling of the z-values?

• How can we change the (x, y, z) aspect ratios when viewing a plot?

## Why are the graphs so different?

I don't have an answer here...

Here is slightly rewritten code to reproduce the problem.

nx, ny = 74, 90

def fx(x):
return 0.5 + x/2.5

def fy(y):
return 40*y

def g(x, y):
xx = 30 * (fx(x/nx) - 1/2) + 1/2
yy = fy(y/ny)
zz = 5 * abs(zeta(fx(x/nx) + I*fy(y/ny)))
return xx, yy, zz

gxyz = [g(x, y)
for x in range(-nx, nx+1)
for y in range(-ny, ny+1)]

g_plot = list_plot3d(gxyz, interpolation_type='spline')
g_plot.show()

hxyz = [(x, y, z/5) for x, y, z in gxyz]
h_plot = list_plot3d(hxyz, interpolation_type='spline')
h_plot.show(aspect_ratio=(1, 1, 10))


One would expect the graphs to be scaled versions of each other, but that's far from being the case!

This is possibly revealing a bug.

## How to apply different x, y, z scalings to a 3D plot?

Use aspect_ratio as above, adapting to the need.

For instance, to get the bounding box for g_plot closer to a cube:

g_plot.show(aspect_ratio=(3, 1, 4))

more

Ok, now I understand that aspect_ratio modifies only the rendering and has no effect on the datas produced.

C = ComplexField(200)

and replacing

zeta(fx(x/nx) + I*fy(y/ny))

by

C(zeta(fx(x/nx) + I*fy(y/ny)))

with the same output.

( 2020-07-19 16:06:48 +0100 )edit