Ask Your Question

staffan's profile - activity

2011-10-28 09:34:40 -0600 commented answer Using javascript towards regular Sage cluster

Thx a lot Jason, I'll have a look at that, looks nifty ! So would it be feasible to layer with Sage graphics?

2011-10-28 03:14:50 -0600 asked a question Using javascript towards regular Sage cluster

ive been thinking how we could get more interactivity; and I actually got processing.js to work inside Sage. Scroll down and move the mouse around in the gray box (pun intended) to see what happens.

So can I get Sage to communicate with external javascrip libraries and how is it done for jquery, jsMath in Sage?

2011-06-03 17:58:06 -0600 received badge  Necromancer (source)
2011-06-03 03:42:03 -0600 answered a question image processing in sage

To upload an image to reside in the Sages DATA directory for this particular worksheet you just select "upload" from the Data menu. It can be local or on your PC

Here is a correct version which should work when you have uploaded the picture.

import pylab; import numpy

img=pylab.imread(DATA + 'NbW-STEM.jpg')

print "Image dtype: %s"%(img.dtype)
print "Image size: %6d"%(img.size)
print "Image shape: %3dx%3d"%(img.shape[0],img.shape[1])
print "Max value %1.2f at pixel %6d"%(img.max(),img.argmax())
print "Min value %1.2f at pixel %6d"%(img.min(),img.argmin())
print "Variance: %1.5f\nStandard deviation: %1.5f"%(img.var(),img.std())
2011-06-03 00:44:08 -0600 answered a question image processing in sage

Funny I also used this example and I might give some ideas. you have to upload the image to Sage before running the code, so this:


fails. when using Numpy and Scipy in Sage try to use

import numpy as np
import scipy as sp

For your own sense and Sage. There are a tremendous amount of libraries so its easier not to get confused when you at least know the top level modeule. Then I got a simple example by getting Lena from scipy. Do you want to have a verbatim solution, which I don't recommend or do you want one which uses the strength of Sage and Python?

2011-06-02 23:59:46 -0600 answered a question Enumerate isomrphic subgraphs of graph vertex labeled

All graphs in Sage support iteration over its major subcomponents, at least vertices and to create a graph from its adjacency matrix

mg= Graph(adj) mg.is_isomorphic(mg) -> True

# graph from adjency matrix
adj= Matrix ([ [0, 1, 1], [1, 0, 1], [1, 1, 0] ])
mg= Graph(adj)
mg.is_isomorphic(mg) -> True

If are you looking for the isomorphic subgraphs of the one you specify with the adj. graph you can usemg.subgraph_search_iterator().

too see how it might be used here. If you post the source as suggested above we could get a more detailed answer.

Here is a simple example of looking for the simplest graph, with zero vertices:

eg = Graph()
[p for p in mg.subgraph_search_iterator(eg)]
2011-06-02 22:19:36 -0600 received badge  Necromancer (source)
2011-06-02 22:19:36 -0600 received badge  Teacher (source)
2011-06-02 21:39:41 -0600 answered a question Install trouble, can anyone help?

As far as I remember, I had no problems installing Sage on Windows XP at home using VMWare. But at work we had some problems with Vista's security and access model, so me and an another guy had to find out about the Vista security system and then we got it up and running.

The combination Sage and Vista was unstable on my PC at least. So I would recommend either upgrading to Windows 7.n or trying the LiveCD which is a bit smaller in size.

But if you decide to go ahead and install on Vista be sure you install and use VMWare to start Sage. There is also a thread on the google forum, which contains several posting related to Windows Vista.

2011-02-15 10:05:30 -0600 answered a question Badly formatted Cayley Table

I think you need to either use default values for the first argument or specify a list of exactly two letters

here is the first way:

identity = matrix(ZZ, [[1,0], [0,1]])
G.cayley_table(elements=[identity, -identity])

The other you can see by using ?, eg G.cayley_table?

Question mark is your best friend when learning Sage

2011-02-02 23:45:37 -0600 received badge  Supporter (source)