Ask Your Question

JackM's profile - activity

2022-10-05 06:11:36 +0100 received badge  Notable Question (source)
2020-03-12 14:24:18 +0100 asked a question How can I perform matrix operations in a transcendental extension of Q?

I have three variables $p_w, p_i, p_f$. I want to construct a matrix whose entries are members are rational polynomials in these variables and perform computations with this matrix (ultimately diagonalize it and obtain a general formula for its $n$-th power). But I want to do this computation symbolically, treating the three variables as transcendental elements adjoined to $\mathbb Q$. How an I do this?

2019-10-01 06:37:15 +0100 received badge  Famous Question (source)
2018-05-03 00:16:55 +0100 received badge  Nice Question (source)
2017-02-13 14:51:57 +0100 received badge  Notable Question (source)
2016-11-01 13:17:50 +0100 commented answer How to input from file?

You say "create a file", but where do I put it? If I put it in the Sage directory, it doesn't seem to see it.

2016-10-24 17:30:39 +0100 asked a question I want my plotting function to treat numbers as numbers, not variables

I'm creating a plot, like this:

density_plot(f(x, y), (x, 0, 1), (y, 0, 1))

The function f looks basically like this:

def f(x, y):
    u = vector([x, y, 1 - x - y])
    return u.norm(2)

That works. Now I introduce a vector v like this:

def f(x, y):
    u = vector([x, y, 1 - x - y])
    v = vector([5, 4, 2])
    return (u - v).norm(2)

That works. But if v is the solution of an equation, like this:

v = M.right_kernel().basis()[0]

Now Sage can't handle the subtraction u - v:

TypeError: unsupported operand parent(s) for '-': 'Vector space of dimension 3 over Symbolic Ring' and 'Vector space of degree 3 and dimension 1 over Real Field with 53 bits of precision Basis matrix:[ 1.00000000000000 0.571428571428571 1.57142857142857]'

So okay, I get that basically what's happening is that u consists of symbolic polynomials in x and y, but v consists of actual numbers, or something like that. But why is it not a problem when v is defined explicitly by vector([5, 5, 5]) or whatever? What is it about the object returned by .right_kernel().basis()[0] (which in all other respects behaves like a vector) that's so incompatible in this context?

How can I solve the matrix equation Mx = 0 in such a way that the vector I get can be subtracted from u? Note that M is singular in my case, with nullity 1, so I need to be able to get an arbitrary vector out of its nullspace.

2016-05-10 23:47:18 +0100 received badge  Popular Question (source)
2015-11-27 10:21:41 +0100 received badge  Popular Question (source)
2013-07-05 12:10:36 +0100 marked best answer .plot() displaying cycle graphs as huge pretzels

I don't agree with your very offensive criticism about pretzels.

This being said, and if you have no taste for food, you can give this a try :

sage: # Displays a Pretzel
sage: digraphs.Circuit(100).show()
sage: # Displays a calamari
sage: digraphs.Circuit(100).show(iterations=20000)

Now that I think of it, given the choice I would also chose a calamari over a pretzel.

Hence it all makes sense, after all.

Nathann

2013-07-05 12:10:29 +0100 commented answer .plot() displaying cycle graphs as huge pretzels

That said, now the vertices get grouped so close together I can't see the arcs - any way to make them longer, or increase the size of the "canvas"?

2013-07-05 12:00:18 +0100 commented answer .plot() displaying cycle graphs as huge pretzels

Thanks. Are there any guidelines on a reasonable amount of iterations to use, as a function of the number of vertices? I'm just going with vertices*2000, but it seems like this is excessive for smaller numbers of vertices - Circuit(5) does well with just 50 iterations.

2013-07-05 11:01:28 +0100 asked a question .plot() displaying cycle graphs as huge pretzels

image description

That big morass of vertices on the left is actually just a single cycle. Is there any way to get Sage to render it more sensibly? I'd use layout=planar but as you can see this isn't a simple graph, the 0 vertex is connected to itself.

I suspect this might just be Sage trying to fit the large cycle into a small space, is there some way to tell it what size image to use?

2013-07-05 10:01:37 +0100 received badge  Editor (source)
2013-07-05 10:00:49 +0100 asked a question Finer control on how digraphs are plotted

I'm drawing some digraphs:

I'd like to control the visual output of .plot() (or, if I should use a different funciton, that's fine too). I tried passing it some parameters but it just throws a warning.

I would like to:

  1. Increase the size of the graphs so I can read the numbers (figsize does this, but how can I use that without calling .save()?)
  2. Get the arrowhead to appear on the 0 -> 0 loop. (not a big deal)
  3. Change the color of the arcs, labels and nodes (making the nodes transparent, with just the numerical labels, would be great).
  4. All of the digraphs I'll be drawing will be planar, so ideally I'd like planar embeddings.
  5. Where should I turn for more sophisticated control? Roll my own .plot() from the graphics primitives? Can I find the source code for sage's graph drawing functions so I can base it on that?
2013-07-05 07:45:29 +0100 commented answer Getting to the command line in Windows

Wait, I think I've got it. So I can use the notebook in my host OS? That's neat.

2013-07-05 07:43:43 +0100 commented answer Getting to the command line in Windows

Can I switch back to the notebook from there? If I try `notebook()` I just get: Another Sage Notebook server is running, PID 1160. Opening web browser at http://localhost:8000/ ... sage: xdg-open: no method avilable for opening 'http://localhost:8000/'

2013-07-05 07:15:12 +0100 received badge  Scholar (source)
2013-07-05 07:15:12 +0100 marked best answer Getting to the command line in Windows

You can use the Sage commandline within the VM. Checkout http://wiki.sagemath.org/SageApplianc...

2013-07-04 19:39:46 +0100 received badge  Student (source)
2013-07-04 15:07:39 +0100 asked a question Getting to the command line in Windows

When I open the Sage 5.9 OVA file in VirtualBox, Fedora boots and Chromium immediately fills the VM window, allowing me to use the Sage notebook. Is there any way to use it in command line mode under Windows?