Ask Your Question

amdall's profile - activity

2018-04-19 07:22:11 +0200 commented answer How does list_plot3d interpret nxn matrices?

As a side note, the behavior of list_plot3d and point3d on matrices do not seem related.

2018-04-19 07:22:00 +0200 commented answer How does list_plot3d interpret nxn matrices?

That makes sense. And it also serves as a natural 3D extension to the output obtained from calling plot or matrix_plot an an $n \times n$ matrix.

2018-04-19 06:50:30 +0200 received badge  Scholar (source)
2018-04-18 20:34:16 +0200 asked a question How does list_plot3d interpret nxn matrices?

From the documentation of list_plot3d

INPUT:

v - something that defines a set of points in 3 space, for example:

  • a matrix
  • a list of 3-tuples
  • a list of lists (all of the same length) - this is treated the same as a matrix.

Intuitively I would guess that the function would only accept $3 \times n$ matrices and/or their transposes, but the first example on the document page is a plot of a five by five matrix

n = 5 
m = matrix(RDF, n, [(i+j)%n for i in [1..n] for j in [1..n]])
p = list_plot3d(m)
p

Question: How does list_plot3d interpret this $5 \times 5$ matrix as a set of points in 3-space?

One might suspect that list_plot3d handles matrices the same was as, for example, point3d but this is not the case. For example, the points visualized by point3d do not lie on the surface given by list_plot3d in the above example as witnessed by

p + point3d(m, size=33)
2018-04-17 00:22:52 +0200 received badge  Supporter (source)
2018-04-16 17:49:14 +0200 commented question Correct input for list_plot3d(..., interpolation='spline')

Here's an example (if I understand correctly) of some points having 'nice' x and y coordinates: pts=[(0,0,1),(1,0,2),(0,1,2),(1,1,5)]. Using pts instead of the six points given in the post yields the same TypeError. Can you get a smooth surface from any point set? A single functioning example would be of great help. But I guess I'm off to read the source code: /scipy/interpolate//_fitpack_impl.pyc

2018-04-16 14:46:14 +0200 received badge  Student (source)
2018-04-16 14:19:24 +0200 received badge  Editor (source)
2018-04-16 14:05:11 +0200 commented answer Correct input for list_plot3d(..., interpolation='spline')

Thanks for the answer, but I don't get it yet. Shouldn't the spline approximation through six points in a plane be the plane itself? Also, the same TypeError is thrown if I nudge one of the points off of the plane (e.g. the last point is changed to (3,2,0)), so planarity doesn't seem to be the root cause of the error.

2018-04-15 20:06:03 +0200 asked a question Correct input for list_plot3d(..., interpolation='spline')

I'm trying to construct smooth surfaces from lists of points in 3-space using list_plot3d and the spline option, but without success. For example, the input

list_plot3d ([(-1, 2, 3), (2, -1, 3), (3, -1, 2), (-1 ,3 ,2), (2, 3, -1), (3, 2, -1)], interpolation_type='spline')

returns the error

TypeError: m >= (kx+1)(ky+1) must hold

The following returns the expected piecewise linear surface suggesting that there is a special restriction on the input when using the spline option.

list_plot3d ([(-1, 2, 3), (2, -1, 3), (3, -1, 2), (-1 ,3 ,2), (2, 3, -1), (3, 2, -1)])

Question: What is the correct input to obtain a best fit polynomial surface going through the six points in $\mathbb{R}^3$?

Edit: As pointed out by @slelievre, since these six points lie in a common plane, the corresponding surface should be the plane containing the points. So why does Sage throw an error instead of this plane?