Ask Your Question

Cosmos's profile - activity

2017-09-04 15:26:29 -0600 received badge  Notable Question (source)
2016-07-05 09:47:46 -0600 received badge  Student (source)
2016-07-04 07:10:04 -0600 received badge  Famous Question (source)
2015-03-12 06:18:35 -0600 received badge  Popular Question (source)
2015-01-22 14:32:08 -0600 received badge  Notable Question (source)
2014-06-29 13:56:33 -0600 received badge  Famous Question (source)
2014-06-29 13:56:33 -0600 received badge  Popular Question (source)
2014-06-29 13:56:33 -0600 received badge  Notable Question (source)
2014-04-29 03:54:23 -0600 received badge  Popular Question (source)
2012-07-11 23:58:12 -0600 commented question sage crashes while interpolating

I didn't see your comment earlier. The binary version of sage was upgraded today and after this the problem i had was gone. Now however big the matrix is it doesn't crash. EDIT: It finally crashed again in sage 5.1

2012-07-11 02:29:36 -0600 asked a question sage crashes while interpolating
f_interpolation = scipy.interpolate.interp2d(*zip(*matrix(A)),kind='cubic')
               plot_interpolation = contour_plot(lambda x,y:
                   f_interpolation(x,y)[0], (22.423,22.439),(37.07,37.08) ,cmap='jet', contours=numpy.arange(0,1400,100), colorbar=True)

               plot_all = plot_interpolation

               plot_all.show(,axes_labels=["m", "m"])

I am running this command to interpolate the data contained in matrix(A). matrix(A) is 1800 x 3 dense matrix over Real Double Field. Sage crashes everytime i do this both in a quad core Amd with 8GB of ram(kubuntu 12.04 64bit, in both the binary and compiled from source versions) and a netbook Lenovo s9e with Intel Atom and 1GB of ram(kubuntu 12.04 32bit, binary version of sage).It returns this message:

/home/user/Sage/sage-5.0.1/local/lib/libcsage.so(print_backtrace+0\
x31)[0x7fc18b464ea9]
/home/user/Sage/sage-5.0.1/local/lib/libcsage.so(sigdie+0x14)[0x7f\
c18b464edb]
/home/user/Sage/sage-5.0.1/local/lib/libcsage.so(sage_signal_handl\
er+0x20c)[0x7fc18b464b06]
/lib/x86_64-linux-gnu/libpthread.so.0(+0xfcb0)[0x7fc18f3f4cb0]
/home/user/Sage/sage-5.0.1/local/lib/python2.7/site-packages/scipy\
/interpolate/_fitpack.so(fprank_+0xdb0)[0x7fc15d29f4e0]
/home/user/Sage/sage-5.0.1/local/lib/python2.7/site-packages/scipy\
/interpolate/_fitpack.so(fpsurf_+0x67b8)[0x7fc15d2990d8]
/home/user/Sage/sage-5.0.1/local/lib/python2.7/site-packages/scipy\
/interpolate/_fitpack.so(surfit_+0xa08)[0x7fc15d289c18]
/home/user/Sage/sage-5.0.1/local/lib/python2.7/site-packages/scipy\
/interpolate/_fitpack.so(+0x4c7b)[0x7fc15d26cc7b]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyEval_Ev\
alFrameEx+0x53a5)[0x7fc18f6f0e45]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyEval_Ev\
alCodeEx+0x855)[0x7fc18f6f2a95]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyEval_Ev\
alFrameEx+0x5420)[0x7fc18f6f0ec0]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyEval_Ev\
alCodeEx+0x855)[0x7fc18f6f2a95]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(+0x73843)\
[0x7fc18f675843]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyObject_\
Call+0x53)[0x7fc18f64d7a3]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(+0x58f1f)\
[0x7fc18f65af1f]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyObject_\
Call+0x53)[0x7fc18f64d7a3]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(+0xac660)\
[0x7fc18f6ae660]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(+0xa8458)\
[0x7fc18f6aa458]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyObject_\
Call+0x53)[0x7fc18f64d7a3]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyEval_Ev\
alFrameEx+0x2b2a)[0x7fc18f6ee5ca]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyEval_Ev\
alCodeEx+0x855)[0x7fc18f6f2a95]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(+0x7374c)\
[0x7fc18f67574c]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyObject_\
Call+0x53)[0x7fc18f64d7a3]
/home/user/Sage/sage-5.0.1/local/lib/libpython2.7.so.1.0(PyEval_Ev ...
(more)
2012-07-09 13:44:52 -0600 received badge  Editor (source)
2012-07-09 07:58:42 -0600 asked a question scipy.interpolate.interp2d 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 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?

2012-07-07 11:07:06 -0600 received badge  Supporter (source)
2012-07-07 11:06:57 -0600 commented question Using solve() to find positive real solutions to a complex equation

Is there any kind of workaround to at least remove automatically the complex solutions from the solutions so the don't mix with real roots? For example i was trying to make a list of real solutions of an equation and half of the list finally came out to be complex numbers.

2012-07-06 07:54:10 -0600 asked a question generate_plot_points for multiple variable functions and contour_plot

Is there a default sage function to generate all (x,y,f(x,y)) values the program uses to draw a multivariable function or the contours of let's say a f(x,y)=C ? I am new to sage and could only find that generate_plot_points works only for one variable functions.

Example from documentation:

sage: from sage.plot.plot import generate_plot_points
sage: generate_plot_points(sin, (0, pi), plot_points=2, adaptive_recursion=0)

I guess one could solve symbolically let's say a contour equation and then create the values i talk about like discussed here:

sage: var('x,y')
(x, y)
sage: solve(y^2 - x^3 - x == 0, [y])
[y == -sqrt(x)*sqrt(x^2 + 1), y == sqrt(x)*sqrt(x^2 + 1)]

then just plot each of those two above and combine them. But this could become really cumbersome since one could have a terribly complicated equation. So can this be done currently or someone needs a workaround to achieve this? excuse my english :)

2012-07-04 20:39:03 -0600 commented answer get coordinates and function value as list

Thank you for your reply. I think now i can make a more general question on the subject.When we ask sage to plot a function doesn't it replace (x,y) with values,it gets the values of the function and then plots it? Is there a way instead of asking from the program to plot the values it just calculated, to just create a list or some other construct with all the values (so that we don't have to create it ourselves each time)? Something like x_coordinates_column,y_coordinates_column,Function_value_column. Let's use this example: We have a f(x,y)=sin(x)*cos(y) and we want the contours sin(x)*cos(y)=k where k is a real number we can change as we like. I would like to have a consrtuct as described above with x_values,y_values,k.

2012-07-04 09:32:33 -0600 asked a question get coordinates and function value as list

I am quite new in sage as well as in programming, so please if you explain this, please do it thouroughly.

Let's assume we have a simple function like F(x,y)=x+y. Is it possible to create a list, something like (x,y,F)? To make clearer a list in the form of (value_of_x_coordinate,value_of_y_coordinate,value_of_function) for instance (1,1,2) or (1,2,3). If this is possible, how can we transform the coordinates x,y by operating somehow on the list e.g adding on both x and y, a number N.