Ask Your Question

Thomas's profile - activity

2023-12-04 03:11:04 +0100 received badge  Notable Question (source)
2023-12-04 03:11:04 +0100 received badge  Popular Question (source)
2022-03-21 03:25:25 +0100 received badge  Popular Question (source)
2021-05-31 18:11:17 +0100 received badge  Famous Question (source)
2018-09-27 16:21:24 +0100 received badge  Popular Question (source)
2018-06-05 19:41:29 +0100 received badge  Good Question (source)
2017-06-16 20:43:19 +0100 received badge  Notable Question (source)
2016-04-19 12:57:51 +0100 commented answer Bug in matrix multiplication and inversion?

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

2016-04-19 12:57:15 +0100 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 16:06:07 +0100 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 13:15:19 +0100 received badge  Popular Question (source)
2016-01-07 20:55:53 +0100 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 18:18:04 +0100 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 18:14:59 +0100 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 18:14:59 +0100 received badge  Commentator
2016-01-07 16:36:07 +0100 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 22:35:59 +0100 received badge  Nice Question (source)
2016-01-06 22:35:56 +0100 received badge  Good Answer (source)
2016-01-06 14:53:18 +0100 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-24 00:01:23 +0100 received badge  Taxonomist
2015-04-02 15:21:13 +0100 received badge  Nice Answer (source)
2015-04-01 12:19:25 +0100 received badge  Self-Learner (source)
2015-04-01 12:18:37 +0100 received badge  Teacher (source)
2015-04-01 12:12:17 +0100 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 12:10:43 +0100 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 12:03:33 +0100 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 17:49:51 +0100 received badge  Popular Question (source)
2014-08-31 17:49:51 +0100 received badge  Notable Question (source)
2014-08-31 17:47:03 +0100 commented answer Black box numerical optimization of a convex function

Thanks a lot for the detailed explanation!

2014-08-26 18:20:18 +0100 received badge  Nice Question (source)
2014-08-21 11:20:21 +0100 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 12:43:57 +0100 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-29 03:15:31 +0100 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-29 03:12:46 +0100 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-07 03:39:57 +0100 received badge  Citizen Patrol (source)
2014-02-07 03:39:18 +0100 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.