ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 05 Sep 2017 11:31:34 +0200Empty graph using implicit_plot3d with contour-optionhttps://ask.sagemath.org/question/38741/empty-graph-using-implicit_plot3d-with-contour-option/Hello everybody,
I wanted to make an isosurface plot from a 3d matrix, which contains random values from 0 to 1 at an equally spaced 3d grid.
Therefore I generated random numbers, and reshaped them in a 3d matrix. I interpolated the 3d matrix linearly with the RegularGridInterpolator from scipy. To make a 3D plot of it I am using the implicit_plot3d function of sage with a given contour value.
I get no errors, but in the end the graph is empty, which should not be in my opinion.
Here is my code:
from scipy.interpolate import griddata
import numpy as np
from mpl_toolkits.mplot3d import axes3d
import matplotlib.pyplot as plt
from matplotlib import cm
import scipy.interpolate
numbers=np.random.random_sample((1000,)) #generate random numbers
#print numbers
data = np.reshape(numbers, (10, 10, 10)) #reshape the numbers on a 3D matrix
#print data
xi = yi = zi = np.linspace(1, 10, 10)
interp = scipy.interpolate.RegularGridInterpolator((xi,yi,zi), data) #interpolate the 3d matrix with a function
#print xi
var('x,y,z')
#test = implicit_plot3d(interp,(x,1,10),(y,1,10),(z,1,10),contour=0.5)
test = implicit_plot3d(interp==0.5,(x,1,10), (y,1,10),(z,1,10),plot_points=60, color='seagreen')
test.show() #plot the the function at a certain value
#a=(5.,5.,2.)
#interp(a)
Any ideas on that?
Thank you very much!osTue, 05 Sep 2017 11:31:34 +0200https://ask.sagemath.org/question/38741/Polynomial interpolationhttps://ask.sagemath.org/question/34008/polynomial-interpolation/I wanted to do find the polynomial function in multivariable with set of data points. Something similar to the one done in mathematica that is the function **InterpolatePolynomial**. In one variable there is the function in sage called
.lagrange_polynomial which works pretty good. I was wonder if there is something in multivariable ? AnupamsageMon, 04 Jul 2016 09:19:07 +0200https://ask.sagemath.org/question/34008/