Ask Your Question

Eviatar Bach's profile - activity

2023-03-29 18:46:55 +0200 received badge  Famous Question (source)
2022-07-04 10:22:02 +0200 received badge  Favorite Question (source)
2021-11-25 07:03:16 +0200 received badge  Famous Question (source)
2021-04-12 01:39:09 +0200 received badge  Notable Question (source)
2021-01-08 21:55:18 +0200 received badge  Famous Question (source)
2020-10-15 11:49:01 +0200 received badge  Self-Learner (source)
2020-10-15 11:49:00 +0200 received badge  Self-Learner (source)
2020-07-19 23:36:16 +0200 received badge  Good Question (source)
2020-07-03 02:04:21 +0200 received badge  Notable Question (source)
2020-05-01 22:02:13 +0200 received badge  Nice Question (source)
2019-04-13 09:02:56 +0200 received badge  Famous Question (source)
2019-03-06 12:04:39 +0200 received badge  Popular Question (source)
2018-12-03 21:29:50 +0200 received badge  Popular Question (source)
2018-11-13 11:20:27 +0200 received badge  Famous Question (source)
2018-02-07 14:26:44 +0200 received badge  Popular Question (source)
2017-10-09 17:52:10 +0200 received badge  Necromancer (source)
2017-10-09 17:52:10 +0200 received badge  Self-Learner (source)
2017-10-02 08:24:53 +0200 received badge  Famous Question (source)
2017-09-29 19:03:36 +0200 received badge  Nice Answer (source)
2017-09-18 01:48:44 +0200 received badge  Self-Learner (source)
2017-09-04 20:58:17 +0200 received badge  Famous Question (source)
2017-07-31 22:04:37 +0200 received badge  Notable Question (source)
2017-07-24 21:18:18 +0200 received badge  Famous Question (source)
2017-06-04 15:45:49 +0200 received badge  Famous Question (source)
2017-03-21 01:19:10 +0200 received badge  Good Answer (source)
2017-02-20 06:53:04 +0200 received badge  Famous Question (source)
2017-02-16 01:28:57 +0200 received badge  Notable Question (source)
2017-02-16 01:28:57 +0200 received badge  Popular Question (source)
2016-12-05 08:27:54 +0200 received badge  Nice Question (source)
2016-11-30 15:50:28 +0200 received badge  Notable Question (source)
2016-11-30 15:50:28 +0200 received badge  Popular Question (source)
2016-07-27 09:32:12 +0200 received badge  Nice Answer (source)
2016-05-25 13:00:29 +0200 received badge  Notable Question (source)
2016-05-17 06:18:07 +0200 received badge  Notable Question (source)
2016-01-02 04:48:18 +0200 received badge  Notable Question (source)
2015-12-18 20:55:28 +0200 received badge  Popular Question (source)
2015-09-19 10:11:15 +0200 received badge  Nice Answer (source)
2015-03-27 04:12:11 +0200 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'>
2015-03-27 04:11:58 +0200 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.

2015-03-27 04:11:58 +0200 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.

2015-03-27 04:11:50 +0200 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-27 04:11:50 +0200 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-27 04:08:59 +0200 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()))))
2015-03-27 04:08:56 +0200 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)
2015-03-27 04:08:32 +0200 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-27 04:08:25 +0200 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.

2015-03-27 04:08:04 +0200 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-27 04:07:36 +0200 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-03-27 04:07:23 +0200 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.

2015-03-27 04:07:05 +0200 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.