Re: [sage-devel] Sage Notebook broken in my fresh installation

2012-12-17 Thread David Roe
It looks like a permissions error on that file.  Does the user you're
running Sage as have permission to open '/home/knsam/.sage/sage_
notebook.sagenb/home/admin/history.pickle'?  What does
ls -l /home/knsam/.sage/sage_notebook.sagenb/home/admin/history.pickle
report?
David


On Sun, Dec 16, 2012 at 6:13 AM, Kannappan Sampath wrote:

> Hello!
>
> For some reason, when I try to run notebook on my Sage, the cells don't
> respond at all! Can someone please help?
>
> Here is a part of the clutter I saw on the terminal (every other part of
> the clutter seems to be the same message:
>
> 2012-12-16 16:31:54+0530 [-] WSGI application error
> Traceback (most recent call last):
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/python/threadpool.py",
> line 190, in _worker
> o = self.q.get()
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/python/context.py",
> line 118, in callWithContext
> return self.currentContext().callWithContext(ctx, func, *args, **kw)
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/python/context.py",
> line 83, in callWithContext
> self.contexts.pop()
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/web/wsgi.py",
> line 340, in run
> self.started = True
> ---  ---
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/web/wsgi.py",
> line 315, in run
> appIterator = self.application(self.environ, self.startResponse)
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1701, in __call__
> return self.wsgi_app(environ, start_response)
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1689, in wsgi_app
> response = self.make_response(self.handle_exception(e))
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1687, in wsgi_app
> response = self.full_dispatch_request()
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1360, in full_dispatch_request
> rv = self.handle_user_exception(e)
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1358, in full_dispatch_request
> rv = self.dispatch_request()
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1344, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
>   File "/usr/lib/sagemath/devel/sagenb/flask_version/decorators.py", line
> 22, in wrapper
> return f(*args, **kwds)
>   File "/usr/lib/sagemath/devel/sagenb/flask_version/worksheet.py", line
> 46, in wrapper
> return f(username, id, **kwds)
>   File "/usr/lib/sagemath/devel/sagenb/flask_version/worksheet.py", line
> 134, in wrapper
> return f(*args, **kwds)
>   File "/usr/lib/sagemath/devel/sagenb/flask_version/worksheet.py", line
> 457, in worksheet_cell_update
> g.notebook.add_to_user_history(H, g.username)
>   File "/usr/lib/sagemath/devel/sagenb/sagenb/notebook/notebook.py", line
> 711, in add_to_user_history
> history = self.user_history(username)
>   File "/usr/lib/sagemath/devel/sagenb/sagenb/notebook/notebook.py", line
> 693, in user_history
> for hunk in self.__storage.load_user_history(username):
>   File
> "/usr/lib/sagemath/devel/sagenb/sagenb/storage/filesystem_storage.py", line
> 311, in load_user_history
> return self._load(filename)
>   File
> "/usr/lib/sagemath/devel/sagenb/sagenb/storage/filesystem_storage.py", line
> 166, in _load
> with open(self._abspath(filename)) as f:
> exceptions.IOError: [Errno 13] Permission denied:
> '/home/knsam/.sage/sage_notebook.sagenb/home/admin/history.pickle'
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To post to this group, send email to sage-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-devel+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




[sage-devel] Why does - (x > 100) return -x > -100 ?

2012-12-17 Thread Sébastien Labbé
Hi sage-devel,

I was using symbolic inequalities because I was lazy to do them by hand. It 
works well for multiplication and addition :

sage: 10 * (x > 100)
10*x > 1000 
sage: 10 + (x > 100)
x + 10 > 110

But not for multiplication by a negative number :

sage: - (x > 100)   
-x > -100

Do you consider this to be a bug? I would prefer the answer "-x < -100" to 
preserve the space of solutions. Do you?

Similarly, but I don't know what should be the result (0=0?) :

sage: 0 * (x > 100) 
0 > 0   

Sébastien

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




[sage-devel] Re: Why does - (x > 100) return -x > -100 ?

2012-12-17 Thread Travis Scrimshaw
Hey Sebastien,

But not for multiplication by a negative number :
>
> sage: - (x > 100)   
> -x > -100
>
> Do you consider this to be a bug? I would prefer the answer "-x < -100" to 
> preserve the space of solutions. Do you?
>
>  
The result is not what I would expect. However, I will let someone more 
versed with the symbolic ring officially call it a bug.

It's also not just negation, but honest multiplication:

   sage: (-1)*(x > 100)
   -x > -100
   sage: ZZ(-1)*(x > 100) 
   -x > -100
   sage: SR(-1)*SR(x > 100)
   -x > -100

Best,
Travis
 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




Re: [sage-devel] Re: Why does - (x > 100) return -x > -100 ?

2012-12-17 Thread Benjamin Jones
On Mon, Dec 17, 2012 at 5:32 PM, Travis Scrimshaw wrote:

> Hey Sebastien,
>
> But not for multiplication by a negative number :
>>
>> sage: - (x > 100)
>> -x > -100
>>
>> Do you consider this to be a bug? I would prefer the answer "-x < -100"
>> to preserve the space of solutions. Do you?
>>
>>
> The result is not what I would expect. However, I will let someone more
> versed with the symbolic ring officially call it a bug.
>
> It's also not just negation, but honest multiplication:
>
>sage: (-1)*(x > 100)
>-x > -100
>sage: ZZ(-1)*(x > 100)
>-x > -100
>sage: SR(-1)*SR(x > 100)
>-x > -100
>
> Best,
> Travis
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To post to this group, send email to sage-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-devel+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>
>
>

It's hard to tell from the implementation if this behavior is intentional,
unintentional, or a bug. The implementation is just that multiplication
maps over relational operators like ==, <, <=, etc. But I think it's not
possible in the current framework to make multiplication preserve the truth
of a statement, e.g.

if y > 0 is true,
is x*(y > 0) true or false?

You can't decide unless you know more about x. If you want to make
multiplying by elements in SR preserve truth of a statement you have to
decide this.

The same question has come up on ask.sagemath:
http://ask.sagemath.org/question/1656/multiplying-an-inequality-by-1

--
Benjamin Jones

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




Re: [sage-devel] Re: Why does - (x > 100) return -x > -100 ?

2012-12-17 Thread Benjamin Jones
On Mon, Dec 17, 2012 at 6:10 PM, Benjamin Jones
 wrote:
>
>
> On Mon, Dec 17, 2012 at 5:32 PM, Travis Scrimshaw  wrote:
>>
>> Hey Sebastien,
>>
>>> But not for multiplication by a negative number :
>>>
>>> sage: - (x > 100)
>>> -x > -100
>>>
>>> Do you consider this to be a bug? I would prefer the answer "-x < -100" to 
>>> preserve the space of solutions. Do you?
>>>
>>
>> The result is not what I would expect. However, I will let someone more 
>> versed with the symbolic ring officially call it a bug.
>>
>> It's also not just negation, but honest multiplication:
>>
>>sage: (-1)*(x > 100)
>>-x > -100
>>sage: ZZ(-1)*(x > 100)
>>-x > -100
>>sage: SR(-1)*SR(x > 100)
>>-x > -100
>>
>> Best,
>> Travis
>>
>>
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sage-devel" group.
>> To post to this group, send email to sage-devel@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> sage-devel+unsubscr...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>>
>>
>
>
> It's hard to tell from the implementation if this behavior is intentional, 
> unintentional, or a bug. The implementation is just that multiplication maps 
> over relational operators like ==, <, <=, etc. But I think it's not possible 
> in the current framework to make multiplication preserve the truth of a 
> statement, e.g.
>
> if y > 0 is true,
> is x*(y > 0) true or false?
>
> You can't decide unless you know more about x. If you want to make 
> multiplying by elements in SR preserve truth of a statement you have to 
> decide this.
>
> The same question has come up on ask.sagemath: 
> http://ask.sagemath.org/question/1656/multiplying-an-inequality-by-1
>
> --
> Benjamin Jones

Sorry for the noise..  I meant to say (at the top) that from the
implementation (of sage.symbolic.expression.Expression._mul_) it's
pretty clear that this behavior *is* intentional, not a bug, but
that's not to say it's desirable in all situations.

--
Benjamin Jones

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




Re: [sage-devel] Sage Notebook broken in my fresh installation

2012-12-17 Thread Kannappan Sampath
Oh, yeah! I don't have permission to that file (as knsam!):

-rwx-- 1 root root 18931 Dec 13 18:09
/home/knsam/.sage/sage_notebook.sagenb/home/admin/history.pickle

But, how do I fix this, chmod?

On Tue, Dec 18, 2012 at 1:58 AM, David Roe  wrote:

> ls -l /home/knsam/.sage/sage_notebook.sagenb/home/admin/history.pickle
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




Re: [sage-devel] Sage Notebook broken in my fresh installation

2012-12-17 Thread David Roe
Yeah.  You should chmod or chown the whole .sage directory.
David


On Mon, Dec 17, 2012 at 10:27 PM, Kannappan Sampath wrote:

> Oh, yeah! I don't have permission to that file (as knsam!):
>
> -rwx-- 1 root root 18931 Dec 13 18:09
> /home/knsam/.sage/sage_notebook.sagenb/home/admin/history.pickle
>
> But, how do I fix this, chmod?
>
> On Tue, Dec 18, 2012 at 1:58 AM, David Roe  wrote:
>
>> ls -l /home/knsam/.sage/sage_notebook.sagenb/home/admin/history.pickle
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To post to this group, send email to sage-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-devel+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




Re: [sage-devel] Sage Notebook broken in my fresh installation

2012-12-17 Thread Kannappan Sampath
Done! But, I think the installation procedure must take care of this but I
cannot be sure whether every one feels that way.


On Tue, Dec 18, 2012 at 8:59 AM, David Roe  wrote:

> Yeah.  You should chmod or chown the whole .sage directory.
> David
>
>
> On Mon, Dec 17, 2012 at 10:27 PM, Kannappan Sampath wrote:
>
>> Oh, yeah! I don't have permission to that file (as knsam!):
>>
>> -rwx-- 1 root root 18931 Dec 13 18:09
>> /home/knsam/.sage/sage_notebook.sagenb/home/admin/history.pickle
>>
>> But, how do I fix this, chmod?
>>
>> On Tue, Dec 18, 2012 at 1:58 AM, David Roe  wrote:
>>
>>> ls -l /home/knsam/.sage/sage_notebook.sagenb/home/admin/history.pickle
>>>
>>
>>  --
>> You received this message because you are subscribed to the Google Groups
>> "sage-devel" group.
>> To post to this group, send email to sage-devel@googlegroups.com.
>> To unsubscribe from this group, send email to
>> sage-devel+unsubscr...@googlegroups.com.
>> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>>
>>
>>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To post to this group, send email to sage-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-devel+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




[sage-devel] Re: Why does - (x > 100) return -x > -100 ?

2012-12-17 Thread P Purkayastha

On 12/18/2012 10:10 AM, Benjamin Jones wrote:

if y > 0 is true,
is x*(y > 0) true or false?


Why is this kind of operation (+,-,*, etc) distributive over comparison 
operators? Is this distributive operation well defined in general, maybe 
according to some theory?


--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.




Re: [sage-devel] Sage Notebook broken in my fresh installation

2012-12-17 Thread Jan Groenewald
Hi

It looks like you are running the PPA version. One upgrade (5.1 -> 5.4)
caused a problem by creating a few root-owned files (update-manager did not
honour DOT_SAGE, so we added HOME afterwards as well).

It may have created two or three files as root in the process. You can get
rid of them with

cd; sudo find .sage -uid 0

and add to that "-exec rm -f '{}' \" to remove them; or set the owner back
to yourself with chmod.

This problem is not present in the new PPA, but once it happened you need
to fix these permissions.

Regards,
Jan


On 16 December 2012 13:13, Kannappan Sampath  wrote:

> Hello!
>
> For some reason, when I try to run notebook on my Sage, the cells don't
> respond at all! Can someone please help?
>
> Here is a part of the clutter I saw on the terminal (every other part of
> the clutter seems to be the same message:
>
> 2012-12-16 16:31:54+0530 [-] WSGI application error
> Traceback (most recent call last):
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/python/threadpool.py",
> line 190, in _worker
> o = self.q.get()
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/python/context.py",
> line 118, in callWithContext
> return self.currentContext().callWithContext(ctx, func, *args, **kw)
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/python/context.py",
> line 83, in callWithContext
> self.contexts.pop()
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/web/wsgi.py",
> line 340, in run
> self.started = True
> ---  ---
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Twisted-12.1.0-py2.7-linux-x86_64.egg/twisted/web/wsgi.py",
> line 315, in run
> appIterator = self.application(self.environ, self.startResponse)
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1701, in __call__
> return self.wsgi_app(environ, start_response)
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1689, in wsgi_app
> response = self.make_response(self.handle_exception(e))
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1687, in wsgi_app
> response = self.full_dispatch_request()
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1360, in full_dispatch_request
> rv = self.handle_user_exception(e)
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1358, in full_dispatch_request
> rv = self.dispatch_request()
>   File
> "/usr/lib/sagemath/local/lib/python2.7/site-packages/Flask-0.9-py2.7.egg/flask/app.py",
> line 1344, in dispatch_request
> return self.view_functions[rule.endpoint](**req.view_args)
>   File "/usr/lib/sagemath/devel/sagenb/flask_version/decorators.py", line
> 22, in wrapper
> return f(*args, **kwds)
>   File "/usr/lib/sagemath/devel/sagenb/flask_version/worksheet.py", line
> 46, in wrapper
> return f(username, id, **kwds)
>   File "/usr/lib/sagemath/devel/sagenb/flask_version/worksheet.py", line
> 134, in wrapper
> return f(*args, **kwds)
>   File "/usr/lib/sagemath/devel/sagenb/flask_version/worksheet.py", line
> 457, in worksheet_cell_update
> g.notebook.add_to_user_history(H, g.username)
>   File "/usr/lib/sagemath/devel/sagenb/sagenb/notebook/notebook.py", line
> 711, in add_to_user_history
> history = self.user_history(username)
>   File "/usr/lib/sagemath/devel/sagenb/sagenb/notebook/notebook.py", line
> 693, in user_history
> for hunk in self.__storage.load_user_history(username):
>   File
> "/usr/lib/sagemath/devel/sagenb/sagenb/storage/filesystem_storage.py", line
> 311, in load_user_history
> return self._load(filename)
>   File
> "/usr/lib/sagemath/devel/sagenb/sagenb/storage/filesystem_storage.py", line
> 166, in _load
> with open(self._abspath(filename)) as f:
> exceptions.IOError: [Errno 13] Permission denied:
> '/home/knsam/.sage/sage_notebook.sagenb/home/admin/history.pickle'
>
> Thank you!
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-devel" group.
> To post to this group, send email to sage-devel@googlegroups.com.
> To unsubscribe from this group, send email to
> sage-devel+unsubscr...@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-devel?hl=en.
>
>
>



-- 
  .~.
  /V\ Jan Groenewald
 /( )\www.aims.ac.za
 ^^-^^

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.googl

Re: [sage-devel] Re: Why does - (x > 100) return -x > -100 ?

2012-12-17 Thread Benjamin Jones
On Mon, Dec 17, 2012 at 9:32 PM, P Purkayastha  wrote:

> On 12/18/2012 10:10 AM, Benjamin Jones wrote:
>
>> if y > 0 is true,
>> is x*(y > 0) true or false?
>>
>
> Why is this kind of operation (+,-,*, etc) distributive over comparison
> operators? Is this distributive operation well defined in general, maybe
> according to some theory?
>
>
If you think about the comparison operators as type constructors (for the
SR type), it's useful for them to be functors. In other words, it's useful
to be able to map over them, e.g. map the function that is multiplication
by a constant element of SR over a comparison:

sage: y = var('y')
sage: x * (y > 0)
x*y > 0

Just like applying the operator (x*_) over a list [ y, 0 ].

Another example:

sage: f(x) = x + 1
sage: y = var('y')
sage: expr = y > 0
sage: f(expr)
(y > 0) + 1

If > was a functor, you would expect to get f(y) > f(0), which is y + 1 >
1. And indeed,

sage: (y > 0) + 1
y + 1 > 1

So things look consistent. This even works for non-linear functions:

sage: f(x) = x^2+1
sage: f(y > 0)
(y > 0)^2 + 1
sage: (y > 0)^2 + 1
y^2 + 1 > 1

--
Benjamin Jones

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To post to this group, send email to sage-devel@googlegroups.com.
To unsubscribe from this group, send email to 
sage-devel+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel?hl=en.