Ask Your Question

Eviatar Bach's profile - activity

2019-04-13 02:02:56 -0500 received badge  Famous Question (source)
2019-03-06 05:04:39 -0500 received badge  Popular Question (source)
2018-12-03 14:29:50 -0500 received badge  Popular Question (source)
2018-11-13 04:20:27 -0500 received badge  Famous Question (source)
2018-02-07 07:26:44 -0500 received badge  Popular Question (source)
2017-10-09 10:52:10 -0500 received badge  Self-Learner (source)
2017-10-09 10:52:10 -0500 received badge  Necromancer (source)
2017-10-02 01:24:53 -0500 received badge  Famous Question (source)
2017-09-29 12:03:36 -0500 received badge  Nice Answer (source)
2017-09-17 18:48:44 -0500 received badge  Self-Learner (source)
2017-09-04 13:58:17 -0500 received badge  Famous Question (source)
2017-07-31 15:04:37 -0500 received badge  Notable Question (source)
2017-07-24 14:18:18 -0500 received badge  Famous Question (source)
2017-06-04 08:45:49 -0500 received badge  Famous Question (source)
2017-03-20 19:19:10 -0500 received badge  Good Answer (source)
2017-02-19 23:53:04 -0500 received badge  Famous Question (source)
2017-02-15 18:28:57 -0500 received badge  Notable Question (source)
2017-02-15 18:28:57 -0500 received badge  Popular Question (source)
2016-12-05 01:27:54 -0500 received badge  Nice Question (source)
2016-11-30 08:50:28 -0500 received badge  Popular Question (source)
2016-11-30 08:50:28 -0500 received badge  Notable Question (source)
2016-07-27 02:32:12 -0500 received badge  Nice Answer (source)
2016-05-25 06:00:29 -0500 received badge  Notable Question (source)
2016-05-16 23:18:07 -0500 received badge  Notable Question (source)
2016-01-01 21:48:18 -0500 received badge  Notable Question (source)
2015-12-18 13:55:28 -0500 received badge  Popular Question (source)
2015-09-19 03:11:15 -0500 received badge  Nice Answer (source)
2015-03-26 22:11:50 -0500 marked best answer How to make 1:1 matrix plots?

Hello,

I want to make a matrix_plot of an array, but it never displays correctly. How would I, for example, make each number in an array into a pixel? I find matrix_plot, in resizing, "corrupts" the image. For example, this is a plot of the Sierpinski triangle:

Sierpinski triangle

(it also does this on svg plots), and you can see the array isn't translating correctly to pixels. aspect_ratio=1 doesn't work. A sufficiently large figsize works, but I don't see why this is necessary. Isn't there another way?

Thank you.

2015-03-26 22:11:50 -0500 marked best answer DiGraph labels?

Labels don't seem to work on DiGraphs. For example:

g=DiGraph(vertex_labels=True)

g.add_edge(2,3,label="label")

g.show()

This just shows 2 and 3 as labels. Is this a bug or am I doing something wrong?

Thanks in advance.

2015-03-26 22:08:32 -0500 marked best answer Radian–degree conversion

Hello,

It seems to be unnecessarily hard to numerically convert radians to degrees in Sage. For example, how does one convert arctan(4/5) radians to degrees?

The following

n(arctan(4/5))*sage.symbolic.units.convert(units.angles.radian,units.angles.degree)

returns

121.453369600239*degree/pi

Is there a simple way to just return a numerical answer (without multiplying by 180/pi)?

2015-03-26 22:08:04 -0500 marked best answer Interact depending on other arguments

Hello,

Is it possible to have interact arguments depend on one another? For example, having the maximum of one slider depend on the former? I tried this:

@interact
def metacontrol(a=slider(5,10)):
    @interact
    def control(b=slider(0, a)):
        pass

But it doesn't work; updating the first slider deletes the second slider. It is possible with two cells, but this requires executing the cell which defeats the purpose of interact.

Thank you.

2015-03-26 22:07:36 -0500 marked best answer Tables of graphics?

I recall seeing a function that would allow one to make a table (or a series) of graphics. For example, if I wanted to display 10 plots in a series, how would I do this?

Thanks in advance.

2015-01-02 06:39:51 -0500 received badge  Notable Question (source)
2014-06-29 04:09:57 -0500 received badge  Famous Question (source)
2014-06-28 20:15:39 -0500 marked best answer Is there a way to update an expression with new variable values?

Is there a way to update an expression if the symbolic variables that it contains have been overwritten? For example,

sage: var('beta')
beta
sage: eq = x == beta
sage: beta = 1
sage: eq
x == beta

Is there a way for it to change to x == 1? I wrote the following function to do this, but I wanted to know if something similar existed already.

def update(expr):
    return expr.subs(dict(zip(expr.variables(), map(lambda v:eval(str(v)), expr.variables()))))
2014-06-28 20:15:37 -0500 marked best answer Calculating terms of a series

Is there any way to calculate terms of a series which Sage is unable to find a closed-form expression for?

For example, how do I calculate the first ten terms of a in the following example?

sage: a = sum(sqrt(x), x, 0, oo)
sage: a
sum(sqrt(x), x, 0, +Infinity)
2014-06-28 20:15:17 -0500 marked best answer How to "recover" real number from expression?

How do I separate a RealNumber from an Expression, once it is constructed?

sage: b = RealField(200)(5)
sage: type(b)
<type 'sage.rings.real_mpfr.RealNumber'>
sage: type((b^x).operands()[0])
<type 'sage.symbolic.expression.Expression'>
2014-06-28 20:15:16 -0500 marked best answer How come abs(x) works?

Hello,

I notice that abs is a Python built-in function, but it also works symbolically:

sage: abs(x)
abs(x)
sage: bool(abs(x) == abs_symbolic(x))
True
sage: preparse('abs(x)')
'abs(x)'

What's going on here? Obviously the Python function should not accept a Sage type.

2014-06-28 20:14:56 -0500 marked best answer Variables in TinyMCE

Hello,

Is there any way to fetch Sage variables from TinyMCE? This would be useful to display results of computations inline with formatted text.

2014-06-28 20:14:56 -0500 marked best answer System of nonlinear equations

Hello,

Is it possible to solve the following using Sage?

http://www.wolframalpha.com/input/?i=...x2x3-6%3D%3D0%2Cx1%5E2%2Bx2%5E2%2Bx3%5E2-14%3D%3D0%5D%2Cx1%29

Thanks in advance.

2014-06-28 20:14:44 -0500 marked best answer Eulerian Cycle of a Digraph

Hello,

Is there a function to do an Eulerian cycle of a digraph? eulerian_cycle works on undirected graphs, but not on digraphs. Basically I'm looking for an equivalent to Mathematica's EulerianCycle. Does this exist?

Thanks in advance.

2014-06-28 20:14:42 -0500 marked best answer Specific cmap

Hello,

How would I create a specific cmap, which would have a separate color value for each matrix value? For example, could I make a cmap that specifies 0:'red', 1:'green', 2:'yellow', etc? The linear interpolation cmaps don't work as I want them to because they normalize to the given range of the matrix.

Thank you.