Ask Your Question

Thomas's profile - activity

2018-09-27 09:21:24 -0500 received badge  Popular Question (source)
2018-06-05 12:41:29 -0500 received badge  Good Question (source)
2017-06-16 13:43:19 -0500 received badge  Notable Question (source)
2016-04-19 05:57:51 -0500 commented answer Bug in matrix multiplication and inversion?

... and by the way, Mathematica just does it.

2016-04-19 05:57:15 -0500 commented answer Bug in matrix multiplication and inversion?

OK thanks. I did actually try simplify on the difference, but not simplify_full()

2016-04-18 09:06:07 -0500 asked a question Bug in matrix multiplication and inversion?

I'm using sage 7.1 and this code here returns false.

M = matrix ([[sqrt(1-1/2),1/2],[1,-sqrt(1-1/2)]])
N = matrix ([[sqrt(1-1/3),1],[1/3,-sqrt(1-1/3)]])
(M*N).inverse() == N.inverse()*M.inverse()

What is going on?

2016-04-04 06:15:19 -0500 received badge  Popular Question (source)
2016-01-07 13:55:53 -0500 commented answer Sage 6.10 not working again on MacOS

OK, thanks. It works now. So the directory is not relocatable after first start?

2016-01-07 11:18:04 -0500 answered a question Sage 6.10 not working again on MacOS

The temporary solution is to NOT RENAME the SageMath folder. Watch this:

➜  ~  cd SageMath
➜  SageMath git:(develop) ./sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.10, Release Date: 2015-12-18                    │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
The Sage installation tree has moved
from /Users/tom/sage
  to /Users/tom/SageMath
Updating various hardcoded paths...
(Please wait at most a few minutes.)
DO NOT INTERRUPT THIS.
Done updating paths.
sage:
Exiting Sage (CPU time 0m0.02s, Wall time 0m5.30s).
➜  SageMath git:(develop) cd ..
➜  ~  mv SageMath sage
➜  ~  cd sage
➜  sage git:(develop) ./sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.10, Release Date: 2015-12-18                    │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
The Sage installation tree has moved
from /Users/tom/SageMath
  to /Users/tom/sage
Updating various hardcoded paths...
(Please wait at most a few minutes.)
DO NOT INTERRUPT THIS.
Done updating paths.
Traceback (most recent call last):
  File "/Users/tom/sage/src/bin/sage-ipython", line 8, in <module>
    from sage.repl.readline_extra_commands import *
ImportError: dlopen(/Users/tom/sage/local/lib/python2.7/site-packages/sage/repl/readline_extra_commands.so, 2): Library not loaded: /Users/tom/SageMath/local/lib/libreadline.6.dylib
  Referenced from: /Users/tom/sage/local/lib/python2.7/site-packages/sage/repl/readline_extra_commands.so
  Reason: image not found
➜  sage git:(develop) cd ..
➜  ~  mv sage sagebla
➜  ~  cd sagebla
➜  sagebla git:(develop) ./sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.10, Release Date: 2015-12-18                    │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
The Sage installation tree has moved
from /Users/tom/sage
  to /Users/tom/sagebla
Updating various hardcoded paths...
(Please wait at most a few minutes.)
DO NOT INTERRUPT THIS.
Done updating paths.
Traceback (most recent call last):
  File "/Users/tom/sagebla/src/bin/sage-ipython", line 8, in <module>
    from sage.repl.readline_extra_commands import *
ImportError: dlopen(/Users/tom/sagebla/local/lib/python2.7/site-packages/sage/repl/readline_extra_commands.so, 2): Library not loaded: /Users/tom/SageMath/local/lib/libreadline.6.dylib
  Referenced from: /Users/tom/sagebla/local/lib/python2.7/site-packages/sage/repl/readline_extra_commands.so
  Reason: image not found
2016-01-07 11:14:59 -0500 received badge  Commentator
2016-01-07 11:14:59 -0500 commented answer Sage 6.10 not working again on MacOS

OK, reproducably, If I rename the folder from SageMath to just "sage" I get this error.

2016-01-07 09:36:07 -0500 commented answer Sage 6.10 not working again on MacOS

I did exactly this in the correct order. On the first start it also patched a lot of binaries (lots of stuff scrolling) and then yielded this error. Let me try again.

2016-01-06 15:35:59 -0500 received badge  Nice Question (source)
2016-01-06 15:35:56 -0500 received badge  Good Answer (source)
2016-01-06 07:53:18 -0500 asked a question Sage 6.10 not working again on MacOS

There was a problem with Sage and MacOS El Capitan which was solved here: http://trac.sagemath.org/ticket/19370 For quite a while I used beta 1 of 6.10 which worked fine. Today I decided to move to 6.10 and it's back to non-working. What's going on?

✗ sage
┌────────────────────────────────────────────────────────────────────┐
│ SageMath Version 6.10, Release Date: 2015-12-18                    │
│ Type "notebook()" for the browser-based notebook interface.        │
│ Type "help()" for help.                                            │
└────────────────────────────────────────────────────────────────────┘
Traceback (most recent call last):
  File "/Users/tom/sage/src/bin/sage-ipython", line 8, in <module>
    from sage.repl.readline_extra_commands import *
ImportError: dlopen(/Users/tom/sage/local/lib/python2.7/site-packages/sage/repl/readline_extra_commands.so, 2): Library not loaded: /Users/buildslave-sage/slave/binary_pkg/build/source/SageMath/jc4b6yulaujayb9sr94ia88eourzeqip0oidma/local/lib/libtinfo.5.dylib
  Referenced from: /Users/tom/sage/local/lib/libreadline.6.dylib
  Reason: image not found
2015-04-23 17:01:23 -0500 received badge  Taxonomist
2015-04-02 08:21:13 -0500 received badge  Nice Answer (source)
2015-04-01 05:19:25 -0500 received badge  Self-Learner (source)
2015-04-01 05:18:37 -0500 received badge  Teacher (source)
2015-04-01 05:12:17 -0500 answered a question Test if an inequality is feasible under assumptions

This seems to be the answer: http://trac.sagemath.org/ticket/6515

2015-04-01 05:10:43 -0500 answered a question Sage nb code won't run now: vector.transpose() throws error.

It seems that a vector doesn't know if it is a row or a column vector. When you have a vector such as

 v = vector((uniform(-10,10),uniform(-10,10),uniform(-10,10)))

then

 v.row()

and

 v.column()

give it to you as row or column vectors. This must have been a change made to sage since your notebook was created. So to solve your problem, remove the transpose and relpace it with row or column if necessary.

2015-04-01 05:03:33 -0500 asked a question Test if an inequality is feasible under assumptions

I want to test if an inequality system is feasible under non-negativity assumptions. I run into the problem that the assumptions seem not be used by the inequality solver. Here is a minimal example

sage: (l1,l2) = var("l1 l2")
sage: assume (l1>=0)
sage: assume (l2>=0)
sage: solve (l1*l2<0, [l1,l2])
[[l1 < 0, 0 < l2], [0 < l1, l2 < 0]]

Is it possible to have the solver use the assumptions and determine infeasibility of the system?

2014-08-31 10:49:51 -0500 received badge  Notable Question (source)
2014-08-31 10:49:51 -0500 received badge  Popular Question (source)
2014-08-31 10:47:03 -0500 commented answer Black box numerical optimization of a convex function

Thanks a lot for the detailed explanation!

2014-08-26 11:20:18 -0500 received badge  Nice Question (source)
2014-08-21 04:20:21 -0500 commented question How to plot histogram from list?

R is good for visualizing statistics. It is included in sage: http://ask.sagemath.org/question/7805/how-to-use-r-with-sage/

2014-08-19 05:43:57 -0500 asked a question Black box numerical optimization of a convex function

I would like to numerically optimize a convex function without using any of its internals, that is, a python function. Is there an implementation of this in sage? I tried sage.numerical.optimize.find_local_minimum but it fails internally with a

TypeError: unable to find a common ring for all elements

My function to optimize is in fact the second largest eigenvalue of a matrix that is constructed from one parameter. Here it is in all gory detail:

def binaryStrings(k):
    for i in range(2**k):
        s = str(bin(i))[2:]
        yield "0"^(k-len(s)) + s;

def hammingDistanceInt (a,b):
    return bin(a^^b).count("1")

def cubeAdjacency (k):
    # Note: We would like to use QQ instead of CDF, but this will
    # result in inexact computations failing due to rounding later
    # (Yes it does!)
    # https://groups.google.com/forum/#!topic/sage-support/3IIbu0OBJX4
    return matrix(CDF, 2^k, 2^k, lambda i, j: 1 if hammingDistanceInt(i,j)==1 else 0);

def hemmeckeFiberAdjacency (k, p1):
    p2 = (1 - 4*k*p1)/2;
    M = p1 * block_diagonal_matrix (cubeAdjacency(k),cubeAdjacency(k));
    M[0,2^k] = p2
    M[2^k,0] = p2
    rowsums = M * vector ([1]*2^(k+1))
    M += diagonal_matrix(vector([1]*2^(k+1))-rowsums);
    return M

def slem(k,p):
    e = map(abs, hemmeckeFiberAdjacency(k,p).eigenvalues())
    e.sort();
    return e[-2];

def slem4(p): return slem(4,p)
plot(slem4, [0,1/16]) # Works fine
sage.numerical.optimize.find_local_minimum(slem4, [0,1/16]) # Type error
2014-06-28 20:15:31 -0500 marked best answer Which variables are automagically defined in the sage shell?

I'm using the sage-5.5 command line and some variables are automatically declared. For instance I can do

f = x^2

but not

f = t^2

My question: How does this come about? Which variables are defined like this? Where is this documented?

2014-06-28 20:12:46 -0500 marked best answer Reinstall sage-mode after emacs upgrade

Hi, I'm trying to reinstall sage mode after an upgrade of emacs (modules need to be byte-compiled with the new version of emacs).

sage -i sage-mode-0.6

tells me that it is already installed and does nothing.

2014-02-06 20:39:57 -0500 received badge  Citizen Patrol (source)
2014-02-06 20:39:18 -0500 commented question Sage and disk usage on MacOS Mavericks

Hmm, turns out that sage.app folder was only around 3GB, not 6. Space disappears in 6GB packages, though.

2014-02-06 09:02:05 -0500 asked a question Sage and disk usage on MacOS Mavericks

This is not really a sage question, but maybe somebody knows the answer anyway. I have installed sage.app on MacOS Mavericks. The unpacked application is roughly 6GB in size. Say after installation I have X GB free disk space. I now run sage in a terminal with

/Applications/Sage-6.0.app/Contents/Resources/sage/sage

Sage starts and does its usual little startup mambo, checking that all the paths are in order and such. After that, I have X-6 GB free disk space (as shown in Finder). When I quit sage, the disk space does not return, it seems gone. When I start sage the next day, I have X-12GB free disk space, but that seems to be it, on day three I don't lose any additional space. Even better, after a week or so not using sage, the 6GB packages come back one per day. What's the reason for this, and can I prevent it?

I suspect that it has to do with MobileBackups and TimeMachine. If there was a huge change on my disk, I would see this in TimeMachine backup sizes, but they are small, like 500MB a day or so. Could it be that the MobileBackups mechanism which is independent of time machine makes a snapshot of the entire Application when something changes? What could this change be? Does the sage.app folder change on every startup? Is TimeMachine smart enough to backup only the presumably small changed file, but MobileBackups keeps a copy of the entire sage.app Folder?

2013-12-07 05:53:51 -0500 received badge  Famous Question (source)
2013-01-03 02:44:27 -0500 marked best answer Which variables are automagically defined in the sage shell?

See sage/all.py and sage/all_cmdline.py in the devel/sage directory. In addition to x, we define oo to be infinity, e to be the base of the natural log, i to be a certain root of $x^2-1=0$, ZZ to be the integers, and some other things - and of course lots and lots of functions.