Ask Your Question

ebs's profile - activity

2018-10-07 17:44:02 -0500 received badge  Notable Question (source)
2018-06-25 07:52:22 -0500 received badge  Notable Question (source)
2018-04-06 10:25:59 -0500 received badge  Famous Question (source)
2017-09-04 15:30:54 -0500 received badge  Famous Question (source)
2017-01-24 04:31:44 -0500 received badge  Notable Question (source)
2016-08-23 15:11:44 -0500 received badge  Famous Question (source)
2016-05-11 09:34:27 -0500 received badge  Popular Question (source)
2016-05-02 13:28:46 -0500 received badge  Notable Question (source)
2015-07-20 10:17:47 -0500 received badge  Famous Question (source)
2015-07-05 14:07:46 -0500 received badge  Famous Question (source)
2015-05-27 22:22:08 -0500 received badge  Notable Question (source)
2015-03-26 09:59:26 -0500 received badge  Popular Question (source)
2015-03-08 04:44:45 -0500 received badge  Popular Question (source)
2015-02-06 12:05:40 -0500 received badge  Taxonomist
2014-06-28 20:15:23 -0500 marked best answer showing an external image in sage notbook

Is there an easy way to show an image stored in local drive (or a website) in sage notebook?

The only way I know is using matplotlib:

import matplotlib.pyplot as plt
import matplotlib.image as mpimg

img=mpimg.imread('<location of image file')
plt.imshow(img)
frame = plt.gca()
frame.axes.get_xaxis().set_visible(False)
frame.axes.get_yaxis().set_visible(False)
plt.savefig("temp.png")

but, it is a roundabout way and shows the unecessary black border around the image.

2014-06-28 20:15:17 -0500 marked best answer Forming a solid from a set of intersecting planes

suppose I have equations of planes in 3D space in the form:

$A_ix + B_iy + C_iz = D_i$ for some values of i

how can use sage to find the solid enclosed by them? I need a plot of the surface of this solid. Actually I have many such sets of planes each forming a solid like this.(all concentric)

For example:

planes at x = -1, 1 in yz plane; planes at y = -1, 1 in xz plane and planes at z = -1, 1 in xy plane intersect and form a unit cube centred at the origin.

ty ndomes! But, its taking very long. I have like 12 or more equations (seen a maximum of 30 but can be more). I am now thinking of a different approach. We can easily make a function:

def inside(point , planes):
    if the point is inside all the planes:
        return 1
    else:
        return 0

so, now is there a good function in sagemath that can show all the region in space for which f(point) gives 1. (yea, its okay if the solids are filled as long as they're transparent enough. . Naively Taking lots of points and finding this solid(Like monte carlo) is very inefficient

Actually the program is taking very long time for these equations.

[-x - y - 1 == 0, -x - z - 1 == 0, -x + z - 1 == 0, -x + y - 1 == 0, -y- z - 1== 0, -y + z - 1 == 0, y - z - 1 == 0, y + z - 1 == 0, x - y - 1== 0, x - z - 1 == 0, x + z - 1 == 0, x + y - 1 == 0]

so, check it once. Thanks!

2014-06-28 20:15:17 -0500 marked best answer sage stopped working suddenly

I didn't do anything to the sage install.(I have upgraded by system yesterday) And suddenly today sage stopped working and this is being displayed.

/opt/sage/local/lib/libpython2.7.so.1.0(+0x10b0de)[0x7f38414160de]
/opt/sage/local/lib/libpython2.7.so.1.0(+0x10b353)[0x7f3841416353]
/opt/sage/local/lib/libpython2.7.so.1.0(+0x10b8bc)[0x7f38414168bc]
/opt/sage/local/lib/libpython2.7.so.1.0(PyImport_ImportModuleLevel+0x3a)[0x7f3841416e2a]
/opt/sage/local/lib/libpython2.7.so.1.0(+0xeb52f)[0x7f38413f652f]
/opt/sage/local/lib/libpython2.7.so.1.0(PyObject_Call+0x4e)[0x7f384135690e]
/opt/sage/local/lib/libpython2.7.so.1.0(PyEval_CallObjectWithKeywords+0x47)[0x7f38413f7ff7]
/opt/sage/local/lib/libpython2.7.so.1.0(PyEval_EvalFrameEx+0x1f1d)[0x7f38413fa49d]
/opt/sage/local/lib/libpython2.7.so.1.0(PyEval_EvalCodeEx+0x848)[0x7f38413fee68]
/opt/sage/local/lib/libpython2.7.so.1.0(PyEval_EvalCode+0x32)[0x7f38413fefa2]
/opt/sage/local/lib/libpython2.7.so.1.0(PyRun_FileExFlags+0xaa)[0x7f38414207ca]
/opt/sage/local/lib/libpython2.7.so.1.0(PyRun_SimpleFileExFlags+0xdb)[0x7f38414211fb]
/opt/sage/local/lib/libpython2.7.so.1.0(Py_Main+0xb82)[0x7f3841436342]
/lib/libc.so.6(__libc_start_main+0xf5)[0x7f3840673455]
python[0x4006b1]

------------------------------------------------------------------------
Unhandled SIGBUS: A bus error occurred in Sage.
This probably occurred because a *compiled* component of Sage has a bug
in it and is not properly wrapped with sig_on(), sig_off(). You might
want to run Sage under gdb with 'sage -gdb' to debug this.
Sage will now terminate.
------------------------------------------------------------------------
/opt/sage/spkg/bin/sage: line 671: 10989 Bus error               sage-notebook "$@"

I am using arch linux x86_64 running sage 5.0.1(manually compiled). How can I get it working again?

THis is the output of sage -gdb:

----------------------------------------------------------------------
| Sage Version 5.0, Release Date: 2012-05-14                         |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
/opt/sage/local/bin/sage-ipython
GNU gdb (GDB) 7.4.1
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-unknown-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /opt/sage/local/bin/python...(no debugging symbols found)...done.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/libthread_db.so.1".
Python 2.7.2 (default, May 19 2012, 19:46:00) 
[GCC 4.7.0 20120505 (prerelease)] on linux3
Type "help", "copyright", "credits" or "license" for more information.

Program received signal SIGBUS, Bus error.
0x00007ffff30b674d in ?? ()
   from /opt/sage/local/lib/python2.7/lib-dynload/_ctypes.so
2014-06-28 20:15:00 -0500 marked best answer fitting a curve to a straight line

How can I use sage to fit some points like

x = [1, 3, 4...] y = [1.2, 4.5, 3.6, ...]

to a straight line using method of least squares And make a plot of the points and the line?

2014-06-28 20:14:58 -0500 marked best answer question about plotting points and calculating the average slope

I have a list points to plot like:

X = [3.2467532467532467, 3.236245954692557, 3.215434083601286, 3.1746031746031744, 3.125, 3.0864197530864197, 3.048780487804878, 3.003003003003003, 2.9239766081871346, 2.840909090909091, 2.8011204481792715, 2.7624309392265194, 2.73224043715847, 2.680965147453083, 2.6525198938992043]

Y = [1.449645784571558, 1.4733737963401687, 1.4065612375015262, 1.7345137207779688, 1.8754959195583569, 2.1035354414847736, 2.1388130187811201, 2.3224700713378144, 2.6092616151384149, 2.9660818973522378, 3.1351199784336701, 3.2953129727168911, 3.4245247041968971, 3.5986044560957482, 3.7007780808250552]

how can I plot X and Y? plot(Y, X) returns ValueError: too many values to unpack

And I must also find the average slope. how to find that?

2014-06-28 20:14:55 -0500 marked best answer Finding complex roots numerically using sage

Can sage find complex roots numerically for equations like

cos(cos(cos(cos(x)))) == sin(sin(sin(sin(x))))

if so, how?

2014-06-28 20:14:55 -0500 marked best answer How to make typeset output in sage display properly?

When there are complicated equations , especially with a lot of fractions, the output in sage is bad. Some of it is cut(some lower portion of the output). For example:

image description

How can I fix this?

2014-06-28 20:14:55 -0500 marked best answer sage 4.7 does not build and run in new ubuntu 11 amd64 install!

Hi! I had to format my computer and reinstall ubuntu 11.04 but when I reinstalled, and tried to build sage, it shows errors and when I try to click on sage, a terminal window opens for fraction of a second and closes. after that nothing happens.

I can't attach install.log, so I pasted it into internet clipboard. link text and this is written in dochtml.log and a new empty file is created with name '?@@@8 (invalid encoding)'

/home/bhavani-shankar/apps/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/bin/sage-sage: line 952: /home/bhavani-shankar/apps/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/local/bin/python: cannot execute binary file

here are the first lines from install.log:

/bin/ls: cannot access bzip2-*-install: No such file or directory
/bin/ls: cannot access dir-*-install: No such file or directory
/bin/ls: cannot access prereq-*-install: No such file or directory
make[1]: Entering directory `/home/bhavani-shankar/apps/sage-4.7-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/spkg'
standard/deps:143: warning: overriding commands for target `installed/'
standard/deps:140: warning: ignoring old commands for target `installed/'
standard/deps:146: warning: overriding commands for target `installed/'
standard/deps:143: warning: ignoring old commands for target `installed/'
make[1]: Circular installed/ <- installed/ dependency dropped.
make[1]: Circular installed/ <- installed/ dependency dropped.
make[1]: Circular installed/ <- installed/ dependency dropped.

please help!

2014-06-28 20:14:52 -0500 marked best answer Finding all the roots at once numerically

I want to calculate the roots of equations like

tanh(ax) = x

numerically. But the problem is sage gives option of finding just one root provided I give it the interval where the root may be found.

(tanh(1.5*x)==x).find_root(0.5,2)

But sometimes the interval is not so obvious and I need to know all the numerical roots at once (If the number of roots are finite that is). Is There a way to do that?

2014-06-28 20:14:51 -0500 marked best answer converting expressions into latex code

latex( (lim((sin(tan(x))-tan(sin(x)))/x^7,x=0)))

returns the latex code of the answer ie -1/30 but I want the latex code of the limit unevaluated so that I can generate an image of the question from it. How can I do this?

2014-06-28 20:14:51 -0500 marked best answer creating a fourier series animation

Hello, I want to create an animation of sum((-1)^(n-1)sin(nx)/n,n,1 , k)

and show that as the number of terms 'k' in the partial sums increase, the sum converges to x/2 i.e looks more and more like the graph of x/2.

My first try is

a = animate([(sum((-1)^(n-1)sin(nx)/n,n,1 , k))] for k in range (1,50,1))

But that returns me an error

Traceback (click to the left of this block for traceback) ... AttributeError: 'int' object has no attribute '_maxima_'

Also I want to include a static graph of x/2 in the background of the animation so that it is easy to observe that the series converges to x/2. how to do this?

2014-06-28 20:14:49 -0500 marked best answer I'm unable to start notebook in ubuntu 10.10 amd64

I have just managed to install ubuntu and then sage a few days ago. Therefore I am an absolute beginner.

When I was using sage, due to external power issues, the computer suddenly switched off and after that, I am unable to open sage notebook. Its showing an error.

----------------------------------------------------------------------
| Sage Version 4.6.2, Release Date: 2011-02-25                       |
| Type notebook() for the GUI, and license() for information.        |
----------------------------------------------------------------------
sage: notebook()
The notebook files are stored in: sage_notebook.sagenb
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)

/home/bhavanishankar/.sage/<ipython console> in <module>()

/home/bhavanishankar/Applications/sage-4.6.2-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/devel/sagenb/sagenb/notebook/notebook_object.pyc in __call__(self, *args, **kwds)
    215     """
    216     def __call__(self, *args, **kwds):
--> 217         return self.notebook(*args, **kwds)
    218 
    219     notebook = run_notebook.notebook_twisted

/home/bhavanishankar/Applications/sage-4.6.2-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/devel/sagenb/sagenb/notebook/run_notebook.pyc in notebook_twisted(self, directory, port, interface, address, port_tries, secure, reset, accounts, require_login, server_pool, ulimit, timeout, open_viewer, sagetex_path, start_path, fork, quiet, subnets)
    403     if open_viewer:
    404         "Open viewer automatically isn't fully implemented.  You have to manually open your web browser to the above URL."
--> 405     return run(port, subnets)
    406 
    407 

/home/bhavanishankar/Applications/sage-4.6.2-linux-64bit-ubuntu_10.04.1_lts-x86_64-Linux/devel/sagenb/sagenb/notebook/run_notebook.pyc in run(port, subnets)
    366                 checkPID(pidfile)
    367             except SystemExit as e:
--> 368                 pid = int(open(pidfile).read())
    369                 if str(e).startswith('Another twistd server is running,'):
    370                     sys.exit("""\

ValueError: invalid literal for int() with base 10: ''
2014-06-28 20:12:47 -0500 marked best answer Strange problem with double integrals

I need to calculate a double of integral a large expression numerically. But, I found a strange error. The code:

def doubleIntegral():
    def f2(theta):
        def f1(phi):
            return theta*phi/pi
        return numerical_integral(f1,0,2*pi)[0]
    return numerical_integral(f2,0,pi)

works. but

a = theta*phi/pi  # Suppose this is a huge expression that came out of previous calculations

def doubleIntegral():
    def f2(theta):
        def f1(phi):
            return a
        return numerical_integral(f1,0,2*pi)[0]
    return numerical_integral(f2,0,pi)

doesn't work

unable to simplify to float approximation
unable to simplify to float approximation
.
.
.

What is going on? And how can I fix this?

2014-06-28 20:12:46 -0500 marked best answer 3d contour plotting in sage

It seems there isn't a function in sagemath which can plot contours of a function $f(x, y, z)$ as transparent layers in 3d space like in mayavi.

Is there an alternate way to achieve the same effect in sage?

2014-06-06 01:52:30 -0500 received badge  Famous Question (source)
2014-05-19 18:13:58 -0500 received badge  Notable Question (source)
2014-05-13 05:20:48 -0500 received badge  Nice Question (source)
2014-04-13 21:41:02 -0500 received badge  Popular Question (source)
2013-11-17 21:47:25 -0500 received badge  Popular Question (source)