ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 01 Aug 2012 12:52:54 -0500level/contour curves in 3Dhttps://ask.sagemath.org/question/9199/levelcontour-curves-in-3d/Is there a way to graph level curves of a function $f(x,y)$ in 3D at their respective heights? (Much like **contourplot3d** in Maple.) Thanks.
To make things clearer: what I'd like to see is a 3D plot with level curves (not surfaces). We start with a function of 2 variables (not three) and I'd like to see the 'exploded' contour plot so that the level curves are graphed at their respective z-altitudes. Makes sense?heptadecagonWed, 01 Aug 2012 12:52:54 -0500https://ask.sagemath.org/question/9199/scipy.interpolate.interp2d multivariate interpolation and list alignementhttps://ask.sagemath.org/question/9143/scipyinterpolateinterp2d-multivariate-interpolation-and-list-alignement/Given a set of (x[i],y[i],Value[i]) we can create a list or tuple and plot them with the command list_plot3d. In this way we take a 3d plot where in fact the z-axis corresponds to the value of an f(x,y). Instead of doing this, it appears that with scipy.interpolate.interp2d it is possible to avoid using the list_plot3d and create a contour-density kind of plot. As shown in the [link](http://sage.math.canterbury.ac.nz/home/pub/189/) it is feasible to do this but the fact is that it is too complicated to understand for a beginner like me. Is possible to explain this just to the simple point that someone takes the tuple and tries to create a contour-like plot?
**EDIT:**
It seems that the part of the code below is enough to make a contour plot:
import numpy, scipy.interpolate
f_interpolation = scipy.interpolate.interp2d(*zip(*data))
plot_interpolation = contour_plot(lambda x,y:
f_interpolation(x,y)[0], (30,40), (20,30), cmap='jet', contours=numpy.arange(0.1,30,5), colorbar=True)
Notice on the second line that it refers to some data obviously given before this part of the code. I found out that for this code to work one has to have fully aligned data to feed to the code above.
Example:
( 37.850629, 5.421135, 22.162571637111411),
( 37.706629, 0.421472, 5.229876952864690),
( 7.706629, 28.421472, 15.229876952864690),
If in any way the data that might be a tuple, or a list from what i understand, are not formatted as above, the code doesn't run. **How is it possible to right align all elements as well as keep them aligned in relation to the decimal place in a list?**CosmosMon, 09 Jul 2012 07:58:42 -0500https://ask.sagemath.org/question/9143/contour and function definitionhttps://ask.sagemath.org/question/8784/contour-and-function-definition/Hello
Let us consider this piece of code
-----------------
var('x,y')<br>
px=(x,-1,1)<br>
py=(y,-1,1)
<br>
<br>def V(x,y) :
<br> if (x**2+y**2 <1) :
<br> return(x+y+(abs(1-x**2-y**2))**(1/2))
<br> else:
<br> return(20)
<br>W(x,y)=x+y+(abs(1-x**2-y**2))**(1/2)
<br>
<br>r=Graphics()
<br>r+=contour_plot(W(x,y),px,py,contours=[1.70],fill=false,cmap=["red"])
<br>r+=contour_plot(V(x,y),px,py,contours=[1.50],fill=false,cmap=["magenta"])
<br>plot(r)
________________________________________________________________________
In 4.7, the level lines in magenta *and* red are displayed,
but in 4.8 only the red one appears.
+ is this change expected ?
+ how to let sage knowing the definition of the V function ?
lgSun, 11 Mar 2012 07:18:22 -0500https://ask.sagemath.org/question/8784/