[sage-support] Python Imaging Library

2008-09-15 Thread [EMAIL PROTECTED]

Hi,

I have installed Python Imaging Library (PIL) on my Linux box, I can
access it in python however I don't have access to PIL functions while
working with Sage.

My configuration: Sage 3.1.1, PIL 1.1.5, python 2.4.4

Is there any command line parameter I can pass to Sage in order to use
PIL in Sage ? Can you help me to find a solution please ?

Thanks in advance for your nice reply, have a nice day,

jerome.landre
University of Reims
France

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Maxima problems in sage 3.1.1

2008-09-15 Thread Jason Bandlow

Thanks Michael,
> Check your home
> directory for any file with an accent or Umlaut and you likely found
> the culprit you need to rename. 
This fixed the problem.  Good luck with ecls.

Cheers,
Jason



mabshoff wrote:
>
> On Sep 15, 6:34 pm, Jason Bandlow <[EMAIL PROTECTED]> wrote:
>   
>> Hello,
>>
>> I've been happily '$ sage -updgrade'ing since sage 2.10 or so, and
>> recently noticed that I couldn't use Maxima (details below).  I'm not
>> sure for how long I've had this problem.   Knowing the disclaimer that
>> applies to upgrading, I downloaded the linux 32-bit binaries for 3.1.1
>> from sagemath.org and still had the same problem.   I'm running Ubuntu
>> Hardy on an AMD laptop.
>>
>> If I try any command that calls Maxima, I have to wait for a timeout,
>> and then get an error.   Specific system information and a traceback are
>> below.
>>
>> Thanks very much for any help,
>> Jason Bandlow
>>
>> 
>
> 
>
> Hi Jason,
>
>   
>> *** - invalid byte #xFD in CHARSET:UTF-8 conversion, not a Unicode-16
>> 
>
> this is #2841 and clisp riding on the short bus. Check your home
> directory for any file with an accent or Umlaut and you likely found
> the culprit you need to rename. This has been open on the clisp end
> forever and has never been fixed. That is why we are moving to ecls,
> hopefully in the 3.1.3 release cycle.
>
>
> Cheers,
>
> Michael
> >
>
>   


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Maxima problems in sage 3.1.1

2008-09-15 Thread mabshoff



On Sep 15, 6:34 pm, Jason Bandlow <[EMAIL PROTECTED]> wrote:
> Hello,
>
> I've been happily '$ sage -updgrade'ing since sage 2.10 or so, and
> recently noticed that I couldn't use Maxima (details below).  I'm not
> sure for how long I've had this problem.   Knowing the disclaimer that
> applies to upgrading, I downloaded the linux 32-bit binaries for 3.1.1
> from sagemath.org and still had the same problem.   I'm running Ubuntu
> Hardy on an AMD laptop.
>
> If I try any command that calls Maxima, I have to wait for a timeout,
> and then get an error.   Specific system information and a traceback are
> below.
>
> Thanks very much for any help,
> Jason Bandlow
>



Hi Jason,

> *** - invalid byte #xFD in CHARSET:UTF-8 conversion, not a Unicode-16

this is #2841 and clisp riding on the short bus. Check your home
directory for any file with an accent or Umlaut and you likely found
the culprit you need to rename. This has been open on the clisp end
forever and has never been fixed. That is why we are moving to ecls,
hopefully in the 3.1.3 release cycle.


Cheers,

Michael
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: bug in sage -clone for 3.1.2.rc4?

2008-09-15 Thread mabshoff



On Sep 15, 6:27 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
> Hi:
>
> After building 3.1.2.rc4 I got the following error when I tried to create a
> clone:
>
> 
>
> SAGE build/upgrade complete!
> [EMAIL PROTECTED]:~/sagefiles/sage-3.1.2.rc4$ ./sage -clone dbl-coset
>   File "/home/wdj/sagefiles/sage-3.1.2.rc4/local/bin/sage-clone", line 71
>     echo 'Pbuild is currently broken -- defaulting to serial build.'
>                                                                    ^
> SyntaxError: invalid syntax
>
> real    0m0.043s
> user    0m0.018s
> sys     0m0.006s
>
> Does this make any sense?

Yes, it is a stupid buglet that we just fixed. It slipped by during
the review process since it was 5 am :(

> - David Joyner

Patch is up at #4131 that fixes the issue.

Cheers,

Michael
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Maxima problems in sage 3.1.1

2008-09-15 Thread Jason Bandlow

Hello,

I've been happily '$ sage -updgrade'ing since sage 2.10 or so, and
recently noticed that I couldn't use Maxima (details below).  I'm not
sure for how long I've had this problem.   Knowing the disclaimer that
applies to upgrading, I downloaded the linux 32-bit binaries for 3.1.1
from sagemath.org and still had the same problem.   I'm running Ubuntu
Hardy on an AMD laptop.

If I try any command that calls Maxima, I have to wait for a timeout,
and then get an error.   Specific system information and a traceback are
below.

Thanks very much for any help,
Jason Bandlow




[EMAIL PROTECTED]:~$ uname -a
Linux jason-laptop 2.6.24-19-generic #1 SMP Wed Aug 20 22:56:21 UTC 2008
i686 GNU/Linux

[EMAIL PROTECTED]:~$ cat /proc/cpuinfo
processor: 0
vendor_id: AuthenticAMD
cpu family: 15
model: 76
model name: Mobile AMD Sempron(tm) Processor 3500+
stepping: 2
cpu MHz: 800.000
cache size: 512 KB
fdiv_bug: no
hlt_bug: no
f00f_bug: no
coma_bug: no
fpu: yes
fpu_exception: yes
cpuid level: 1
wp: yes
flags: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca
cmov pat pse36 clflush mmx fxsr sse sse2 syscall nx mmxext fxsr_opt
rdtscp lm 3dnowext 3dnow up pni cx16 lahf_lm extapic cr8_legacy ts fid
vid ttp tm stc
bogomips: 1597.60
clflush size: 64


sage: log(4,2)
Timeout exceeded in read_nonblocking().

version: 2.0 ($Revision: 1.151 $)
command: /home/jason/sage/local/bin/maxima
args: ['/home/jason/sage/local/bin/maxima', '-p',
'/home/jason/sage/local/bin/sage-maxima.lisp']
patterns:
\(\%i[0-9]+\)
buffer (last 100 chars):
before (last 100 chars):
*** - invalid byte #xFD in CHARSET:UTF-8 conversion, not a Unicode-16
Break 1 [4]>
after: 
match: None
match_index: None
exitstatus: None
flag_eof: 0
pid: 14736
child_fd: 3
timeout: 30
delimiter: 
logfile: None
maxread: 1
searchwindowsize: None
delaybeforesend: 0
---
RuntimeError  Traceback (most recent call last)

/home/jason/Desktop/sage-3.1.1-debian32-intel-i686-Linux/ in ()

/home/jason/sage/local/lib/python2.5/site-packages/IPython/Prompts.py in
__call__(self, arg)
533
534 # and now call a possibly user-defined print mechanism
--> 535 manipulated_val = self.display(arg)
536
537 # user display hooks can change the variable to be
stored in

/home/jason/sage/local/lib/python2.5/site-packages/IPython/Prompts.py in
_display(self, arg)
559 return IPython.generics.result_display(arg)
560 except TryNext:   
--> 561 return self.shell.hooks.result_display(arg)
562
563 # Assign the default display method:

/home/jason/sage/local/lib/python2.5/site-packages/IPython/hooks.py in
__call__(self, *args, **kw)
132 #print "prio",prio,"cmd",cmd #dbg
133 try:
--> 134 ret = cmd(*args, **kw)
135 return ret
136 except ipapi.TryNext, exc:

/home/jason/sage/local/lib/python2.5/site-packages/IPython/hooks.py in
result_display(self, arg)
160
161 if self.rc.pprint:
--> 162 out = pformat(arg)
163 if '\n' in out:
164 # So that multi-line strings line up with the left
column of

/home/jason/sage/local/lib/python2.5/pprint.py in pformat(self, object)
109 def pformat(self, object):
110 sio = _StringIO()
--> 111 self._format(object, sio, 0, 0, {}, 0)
112 return sio.getvalue()
113

/home/jason/sage/local/lib/python2.5/pprint.py in _format(self, object,
stream, indent, allowance, context, level)
127 self._readable = False
128 return
--> 129 rep = self._repr(object, context, level - 1)
130 typ = _type(object)
131 sepLines = _len(rep) > (self._width - 1 - indent -
allowance)

/home/jason/sage/local/lib/python2.5/pprint.py in _repr(self, object,
context, level)
193 def _repr(self, object, context, level):
194 repr, readable, recursive = self.format(object,
context.copy(),
--> 195 self._depth, level)
196 if not readable:
197 self._readable = False

/home/jason/sage/local/lib/python2.5/pprint.py in format(self, object,
context, maxlevels, level)
205 and whether the object represents a recursive construct.
206 """
--> 207 return _safe_repr(object, context, maxlevels, level)
208
209

/home/jason/sage/local/lib/python2.5/pprint.py in _safe_repr(object,
context, maxlevels, level)
290 return format % _commajoin(components), readable, recursive
291
--> 292 rep = repr(object)
293 return rep, (rep and not rep.startswith('<')), False
294

/home/jason/Desktop/sage-3.1.1-debian32-intel-i686

[sage-support] bug in sage -clone for 3.1.2.rc4?

2008-09-15 Thread David Joyner

Hi:

After building 3.1.2.rc4 I got the following error when I tried to create a
clone:



SAGE build/upgrade complete!
[EMAIL PROTECTED]:~/sagefiles/sage-3.1.2.rc4$ ./sage -clone dbl-coset
  File "/home/wdj/sagefiles/sage-3.1.2.rc4/local/bin/sage-clone", line 71
echo 'Pbuild is currently broken -- defaulting to serial build.'
   ^
SyntaxError: invalid syntax

real0m0.043s
user0m0.018s
sys 0m0.006s


Does this make any sense?

- David Joyner

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Raising an Error resulted in a crash

2008-09-15 Thread Simon King

On Sep 16, 1:25 am, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> For Cython, you might want to use __cinit__ and __dealloc__ (which
> are guaranteed to be called exactly once in pairs).

I thought that __cinit__ and __dealloc__ is mainly good if you have
some C data structures that python doesn't know to allocate or
deallocate. So, in all my cdef'd classes i use it.

But does it make sense to use these methods in a class that only has
attributes which python knows how to deal with? Why?

Cheers
 Simon

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Raising an Error resulted in a crash

2008-09-15 Thread Simon King

Dear Robert,

I GOT IT!

On Sep 16, 1:25 am, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> No idea what Speicherzugriffsfehler means (never heard of that
> before) but __del__ might be called on a failing __init__.

Yes. I just tested, and definitely it *is* called, and this is half of
the reason for the error.

> For Cython, you might want to use __cinit__ and __dealloc__ (which
> are guaranteed to be called exactly once in pairs).

My class is pure python. More precisely, it eventually has some
attributes that are extension (cdef'd) classes, but in the above
example the error is raised before any extension class is involved.

The reason for the "invalid memory access" (thanks, Michael :) is as
follows:
1) The error is raised.
2) The __del__ method starts to work and tries to call
self.Resl.getindent() -- but self has no attribute Resl at that time.
3) The class also has a __getattr__ method. That method relies on the
existence of an attribute self.__dict -- but if the init method fails,
__dict was never initialized.
4) Now the punch line: __dict is no attribute, hence __getattr__ is
called -- infinite recursion, and finally invalid memory access after
a couple of hundred rounds.

My solution: The first thing done in the init method is now
   self.__dict = {}

Why is it a solution? Any error will be raised AFTER having defined
__dict. When __del__ refers to self.Resl, __getattr__ is called, it
refers to self.__dict (which is now defined!!) and returns None. And
that's fine.

Thank you for all your hints on debugging!

Cheers
Simon

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Raising an Error resulted in a crash

2008-09-15 Thread mabshoff



On Sep 15, 4:25 pm, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Sep 15, 2008, at 4:22 PM, Simon King wrote:
>
>
>
>
>
> > Dear Robert,
>
> > simply for testing, i raise an error as soon as the init-method of my
> > class is called. So, for the moment the code looks like this:
> > class COHO:
> >     """
> >     Docstring
> >     """
> >     def __init__(self, *args, **kwds):
> >         raise ValueError, "fooBAR..."
> >         # followed by a lots of more code
>
> > And now the reason why i am puzzled.
> > If i write a .pyx file with the above content, then everything is fine
> > (i.e., an error is raised, but no crash occurs). But with my module
> > (although the relevant (?) part of it has exactly the above form), it
> > fails:
> > sage: from cohomology import *
> > sage: H=COHO()
> > /home/king/SAGE/devel/sage-3.1.1/local/bin/sage-sage: line 216: 27343
> > Speicherzugriffsfehler  sage-ipython "$@" -c "$SAGE_STARTUP_COMMAND;"
>
> > Note that my class also has a __del__ method.
> > Could that be the reason for the "Speicherzugriffsfehler" (what is it
> > in english?)?
> > I mean, would __del__ be called if __init__ fails?
>
> No idea what Speicherzugriffsfehler means (never heard of that  
> before) but __del__ might be called on a failing __init__.

invalid memory access :)

> For Cython, you might want to use __cinit__ and __dealloc__ (which  
> are guaranteed to be called exactly once in pairs).
>
> - Robert

Cheers,

Michael
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Raising an Error resulted in a crash

2008-09-15 Thread Robert Bradshaw

On Sep 15, 2008, at 4:22 PM, Simon King wrote:

>
> Dear Robert,
>
> simply for testing, i raise an error as soon as the init-method of my
> class is called. So, for the moment the code looks like this:
> class COHO:
> """
> Docstring
> """
> def __init__(self, *args, **kwds):
> raise ValueError, "fooBAR..."
> # followed by a lots of more code
>
>
> And now the reason why i am puzzled.
> If i write a .pyx file with the above content, then everything is fine
> (i.e., an error is raised, but no crash occurs). But with my module
> (although the relevant (?) part of it has exactly the above form), it
> fails:
> sage: from cohomology import *
> sage: H=COHO()
> /home/king/SAGE/devel/sage-3.1.1/local/bin/sage-sage: line 216: 27343
> Speicherzugriffsfehler  sage-ipython "$@" -c "$SAGE_STARTUP_COMMAND;"
>
> Note that my class also has a __del__ method.
> Could that be the reason for the "Speicherzugriffsfehler" (what is it
> in english?)?
> I mean, would __del__ be called if __init__ fails?

No idea what Speicherzugriffsfehler means (never heard of that  
before) but __del__ might be called on a failing __init__.

For Cython, you might want to use __cinit__ and __dealloc__ (which  
are guaranteed to be called exactly once in pairs).

- Robert


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Raising an Error resulted in a crash

2008-09-15 Thread Simon King

Dear Robert,

simply for testing, i raise an error as soon as the init-method of my
class is called. So, for the moment the code looks like this:
class COHO:
"""
Docstring
"""
def __init__(self, *args, **kwds):
raise ValueError, "fooBAR..."
# followed by a lots of more code


And now the reason why i am puzzled.
If i write a .pyx file with the above content, then everything is fine
(i.e., an error is raised, but no crash occurs). But with my module
(although the relevant (?) part of it has exactly the above form), it
fails:
sage: from cohomology import *
sage: H=COHO()
/home/king/SAGE/devel/sage-3.1.1/local/bin/sage-sage: line 216: 27343
Speicherzugriffsfehler  sage-ipython "$@" -c "$SAGE_STARTUP_COMMAND;"

Note that my class also has a __del__ method.
Could that be the reason for the "Speicherzugriffsfehler" (what is it
in english?)?
I mean, would __del__ be called if __init__ fails?

Cheers
 Simon

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Raising an Error resulted in a crash

2008-09-15 Thread mabshoff



On Sep 15, 4:07 pm, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Sep 15, 2008, at 3:56 PM, Simon King wrote:
>
>
>
> > Dear Robert,
>
> > On Sep 16, 12:46 am, Robert Bradshaw <[EMAIL PROTECTED]>
> > wrote:
> >> Try running as sage -gdb , which will catch the error. Then you can
> >> type "bt" at the prompt to get a c traceback.
>
> > I don't understand what the following tells me.
> > When there should be an error raised, instead i get:
>
> > Program received signal SIGSEGV, Segmentation fault.
> > [Switching to Thread 46922761735376 (LWP 26484)]
> > 0x0041befe in instancemethod_call (func=0x34ba680,
> > arg=0x36ebab8,
> >     kw=0x0) at Objects/classobject.c:2477
> > 2477    Objects/classobject.c: Datei oder Verzeichnis nicht gefunden.
> >         in Objects/classobject.c
> > (gdb) bt
> > #0  0x0041befe in instancemethod_call (func=0x34ba680,
> > arg=0x36ebab8,
> >     kw=0x0) at Objects/classobject.c:2477
> > #1  0x00415913 in PyObject_Call (func=0x36ebab8,
> > arg=0x36ebab8, kw=0x0)
> >     at Objects/abstract.c:1861
> > #2  0x0047efd2 in PyEval_CallObjectWithKeywords
> > (func=0x35a4f00,
> >     arg=0x36ebab8, kw=0x0) at Python/ceval.c:3442
> > #3  0x0041dd68 in instance_getattr (inst= > out>,
> >     name=0x99a840) at Objects/classobject.c:755
> > #4  0x2aad32fd7298 in ?? ()
> > #5  0x in ?? ()
>
> > That's all. But what does it mean?
>
> Hmm... that's not a very informative traceback (just generic Python  
> calls). I would try putting some print statements in. What is the  
> return type of the function you're raising an error from?
>
> - Robert

There are a couple things you can do:

a) boil it down to a simple patch against some recent 3.1.x and I can
take a look.
b) Build the Sage library with "-O0". To do so edit $SAGE_ROOT/local/
lib/python2.5/config/Makefile and change

# Compiler options
OPT=-DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes

to

# Compiler options
OPT=-DNDEBUG -g -fwrapv -O0 -Wall -Wstrict-prototypes

Maybe that will help. Then do a "sage -ba" to rebuild the whole Sage
library

If that still does not help you can also build Python with "-O0", but
we can do that later.

Cheers,

Michael
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Raising an Error resulted in a crash

2008-09-15 Thread Robert Bradshaw

On Sep 15, 2008, at 3:56 PM, Simon King wrote:

> Dear Robert,
>
> On Sep 16, 12:46 am, Robert Bradshaw <[EMAIL PROTECTED]>
> wrote:
>> Try running as sage -gdb , which will catch the error. Then you can
>> type "bt" at the prompt to get a c traceback.
>
> I don't understand what the following tells me.
> When there should be an error raised, instead i get:
>
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread 46922761735376 (LWP 26484)]
> 0x0041befe in instancemethod_call (func=0x34ba680,
> arg=0x36ebab8,
> kw=0x0) at Objects/classobject.c:2477
> 2477Objects/classobject.c: Datei oder Verzeichnis nicht gefunden.
> in Objects/classobject.c
> (gdb) bt
> #0  0x0041befe in instancemethod_call (func=0x34ba680,
> arg=0x36ebab8,
> kw=0x0) at Objects/classobject.c:2477
> #1  0x00415913 in PyObject_Call (func=0x36ebab8,
> arg=0x36ebab8, kw=0x0)
> at Objects/abstract.c:1861
> #2  0x0047efd2 in PyEval_CallObjectWithKeywords
> (func=0x35a4f00,
> arg=0x36ebab8, kw=0x0) at Python/ceval.c:3442
> #3  0x0041dd68 in instance_getattr (inst= out>,
> name=0x99a840) at Objects/classobject.c:755
> #4  0x2aad32fd7298 in ?? ()
> #5  0x in ?? ()
>
> That's all. But what does it mean?

Hmm... that's not a very informative traceback (just generic Python  
calls). I would try putting some print statements in. What is the  
return type of the function you're raising an error from?

- Robert


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Raising an Error resulted in a crash

2008-09-15 Thread Simon King

Dear Robert,

On Sep 16, 12:46 am, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> Try running as sage -gdb , which will catch the error. Then you can
> type "bt" at the prompt to get a c traceback.

I don't understand what the following tells me.
When there should be an error raised, instead i get:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 46922761735376 (LWP 26484)]
0x0041befe in instancemethod_call (func=0x34ba680,
arg=0x36ebab8,
kw=0x0) at Objects/classobject.c:2477
2477Objects/classobject.c: Datei oder Verzeichnis nicht gefunden.
in Objects/classobject.c
(gdb) bt
#0  0x0041befe in instancemethod_call (func=0x34ba680,
arg=0x36ebab8,
kw=0x0) at Objects/classobject.c:2477
#1  0x00415913 in PyObject_Call (func=0x36ebab8,
arg=0x36ebab8, kw=0x0)
at Objects/abstract.c:1861
#2  0x0047efd2 in PyEval_CallObjectWithKeywords
(func=0x35a4f00,
arg=0x36ebab8, kw=0x0) at Python/ceval.c:3442
#3  0x0041dd68 in instance_getattr (inst=,
name=0x99a840) at Objects/classobject.c:755
#4  0x2aad32fd7298 in ?? ()
#5  0x in ?? ()

That's all. But what does it mean?

Cheers
  Simon

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Raising an Error resulted in a crash

2008-09-15 Thread Robert Bradshaw

Try running as sage -gdb , which will catch the error. Then you can  
type "bt" at the prompt to get a c traceback.

On Sep 15, 2008, at 2:41 PM, Simon King wrote:

>
> Dear team,
>
> in some Cython module, i am raising an error, as i often did without a
> problem. But this time, raising the error resulted in a crash:
> /home/king/SAGE/devel/sage-3.1.1/local/bin/sage-sage: line 216: 23605
> Speicherzugriffsfehler  sage-ipython "$@" -c "$SAGE_STARTUP_COMMAND;"
>
> Does anyone have an idea what can be the reason? Or at least where i
> may start digging?
>
> I am really puzzled, so much that i even have no idea what additional
> information might help to trac the error. Just as a test, i inserted a
> print command right before raising the error. The print command
> worked, but then Sage quit without even saying good bye.
>
> Yours
>  Simon
>
> >


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Raising an Error resulted in a crash

2008-09-15 Thread Simon King

Dear team,

in some Cython module, i am raising an error, as i often did without a
problem. But this time, raising the error resulted in a crash:
/home/king/SAGE/devel/sage-3.1.1/local/bin/sage-sage: line 216: 23605
Speicherzugriffsfehler  sage-ipython "$@" -c "$SAGE_STARTUP_COMMAND;"

Does anyone have an idea what can be the reason? Or at least where i
may start digging?

I am really puzzled, so much that i even have no idea what additional
information might help to trac the error. Just as a test, i inserted a
print command right before raising the error. The print command
worked, but then Sage quit without even saying good bye.

Yours
 Simon

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Seg fault with determinant calculation

2008-09-15 Thread phil



On Sep 15, 10:08 am, "William Stein" <[EMAIL PROTECTED]> wrote:
> How much RAM do you have?   Write to me off list if you want access
> to a machine with more :-)

Ok. I'll send you an off list message.
I'm running Sage on 64 bit Ubuntu installed in a VMWare Infrastructure
virtual machine with 6 GB of memory allocated.  The underlying
physical machine has 8 GB.  However, "free" and "top" only show about
5 GB of total memory.  Some how the kernel does not use all 6 GB that
is allocated.

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Seg fault with determinant calculation

2008-09-15 Thread Martin Albrecht

On Monday 15 September 2008, phil wrote:
>   I've been pushing the limits of determinant calculation over
> multivariate polynomial rings.  I can calculate determinants of
> matrices up to 9x9 of the form [[x_0_0, x_0_1],[x_1_0, x_1_1]] (each
> element is a single unique variable).  When I get to 10x10 is runs for
> a while the crashes with:
> Unhandled SIGSEGV: A segmentation fault occured in SAGE.
> This probably occured because a *compiled* component
> of SAGE has a bug in it (typically accessing invalid memory)
> or is not properly wrapped with _sig_on, _sig_off.
> You might want to run SAGE under gdb with 'sage -gdb' to debug this.
> SAGE will now terminate (sorry).

I'll try to reproduce the crash and see what I can do about it. You could help 
by running sage -gdb (if you have gdb installed) and send me the backtrace 
off list. Thanks.

>   9x9 matrices only take about 40 seconds.  The 10x10 calculation runs
> for a long time (>1 hr) before crashing.  This is on 64 bit Ubuntu
> with the patch in Trac #4068 (http://trac.sagemath.org/sage_trac/
> ticket/4068) applied.
>   BTW, what is the underlying algorithm used for the determinants? As
> I understand it, the naive way is O(N!) while the recursive way is
> O(N^3) for a NxN matrix.

See: 

http://groups.google.com/group/sage-devel/browse_thread/thread/7aa1bd1e945ff372/

Cheers,
Martin

-- 
name: Martin Albrecht
_pgp: http://pgp.mit.edu:11371/pks/lookup?op=get&search=0x8EF0DC99
_www: http://www.informatik.uni-bremen.de/~malb
_jab: [EMAIL PROTECTED]


--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Integral problems

2008-09-15 Thread David Joyner

On Mon, Sep 15, 2008 at 1:06 PM, Sand Wraith <[EMAIL PROTECTED]> wrote:
>
> i've find anothe way to solve my problems with rect-function:
> rect=lambda x: Piecewise([
> [(-infinity,-1),(lambda x:0)],
> [(- 1, 1),(lambda x:1)],
> [( 1, infinity),(lambda x:0)]
> ])(x);
>
> now:
> plot(rect,-4,4)
> works, and:
> f=lambda x: rect(x)*x^2;
> plot(f,-4,4)
> works too :-)


Cool! I didn't know these would work. Thanks!


>
> but now if want to use my function again, i can not:
> g(x)=1+f(x)
> so i must use only:
> g=lambda x:1+f(x)
> (and show(plot(g,-4,4),ymin=0) or numerical_integral(g,-4,4) works
> fine).
>
> definition like "g(x)=1+f(x)" is more comfort for me (
>
> On Sep 15, 8:25 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
>> On Mon, Sep 15, 2008 at 11:10 AM, Sand Wraith <[EMAIL PROTECTED]> wrote:
>>
>> > On Sep 13, 2:35 am, Jason Merrill <[EMAIL PROTECTED]> wrote:
>> >> On Sep 12, 4:48 pm, Sand Wraith <[EMAIL PROTECTED]> wrote:
>>
>> >> > Hi all! Help please again :-)
>>
>> >> > here is worksheet describes my problem:
>>
>> >> >http://75.75.6.176/home/pub/8/
>>
>> >> > so, at the last stem i have wrong result: 0 instead of 2/3.
>>
>> >> > what i am doing wrong?
>>
>> >> It looks like there are a few problems here, but the main thing is
>> >> that when you call myrect(x), it just returns 0.
>>
>> >> def rect(tau=0,t=0):
>> >>if (t==tau) or (t==-tau):
>> >>return 0.5
>> >>elif (t>-tau) and (t> >>return 1
>> >>else:
>> >>return 0;
>>
>> >> def myrect(x):
>> >>return rect(1,x);
>>
>> >> sage: myrect(x)
>> >> 0
>>
>> >> The reason is that when you compare a symbolic variable, x, to a
>> >> number, 1, and force sage to come up with a True or False answer, as
>> >> if and elif do, the answer is basically always False.
>>
>> >> sage: bool(x == 1)
>> >> False
>> >> sage: bool(x < 1)
>> >> False
>> >> sage: bool(x > 1)
>> >> False
>> >> sage: bool(x < -1)
>> >> False
>>
>> >> etc.
>>
>> >> Because of this, when you call myrect(x), things fall down to the last
>> >> branch of your definition.  When an expression appears as an argument
>> >> to a function, it is evaluated *before* the function is called.  For
>> >> instance, look at
>>
>> >> sage: plot(myrect(x),(x,-3,3)) # The line segment y == 0
>>
>> >> In this case, myrect(x) evaluates to 0 *before* plot has a chance to
>> >> pass in any values, and the same thing is happening to integral.
>>
>> >> I'd like to tell you that you can do what you want using piecewise, or
>> >> something like that, but actually I don't see any way at all to make
>> >> integral, which needs something that can act like a SymbolicExpression
>> >> as its first argument, do what you want.  Maybe someone else will
>> >> know.
>>
>> >> Regards,
>>
>> >> JM
>>
>> > I have redefine rect function:
>> > rect=Piecewise([
>> > [(-10,-1),(lambda x:0)],
>> > [(- 1, 1),(lambda x:1)],
>> > [( 1, 10),(lambda x:0)]
>> > ]);
>>
>> > and i have another two questions:
>>
>> > 1) rect.plot() - is it the only way of plotting? i'd like to use
>>
>> Yes, this is the only way to plot rect at the moment.
>>
>> > plot(rect,-4,4), but it leads to error:
>>
>> >>verbose 0 (3729: plot.py, __call__) there were 4 extra arguments
>> >>(besides  at 0xa9382cc>)
>> >>Traceback (click to the left for traceback)
>> >>...
>> >>UnboundLocalError: local variable 'G' referenced before assignment
>>
>> > 2)How can i define another function like rect*f(x) ? and plot it?
>>
>> For some reason, * is not working. You can just redefine your
>> function: for example,
>>
>> rect2 = Piecewise([[(-10,-1),(lambda x:0)], [(- 1, 1),(lambda
>> x:sin(x))], [( 1, 10),(lambda x:0)]])
>>
>>
> >
>

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Seg fault with determinant calculation

2008-09-15 Thread William Stein

On Mon, Sep 15, 2008 at 10:05 AM, phil <[EMAIL PROTECTED]> wrote:
>
>  I've been pushing the limits of determinant calculation over
> multivariate polynomial rings.  I can calculate determinants of
> matrices up to 9x9 of the form [[x_0_0, x_0_1],[x_1_0, x_1_1]] (each
> element is a single unique variable).  When I get to 10x10 is runs for
> a while the crashes with:
> Unhandled SIGSEGV: A segmentation fault occured in SAGE.
> This probably occured because a *compiled* component
> of SAGE has a bug in it (typically accessing invalid memory)
> or is not properly wrapped with _sig_on, _sig_off.
> You might want to run SAGE under gdb with 'sage -gdb' to debug this.
> SAGE will now terminate (sorry).


How much RAM do you have?   Write to me off list if you want access
to a machine with more :-)

>  9x9 matrices only take about 40 seconds.  The 10x10 calculation runs
> for a long time (>1 hr) before crashing.  This is on 64 bit Ubuntu
> with the patch in Trac #4068 (http://trac.sagemath.org/sage_trac/
> ticket/4068) applied.
>  BTW, what is the underlying algorithm used for the determinants? As
> I understand it, the naive way is O(N!) while the recursive way is
> O(N^3) for a NxN matrix.
>  Also, "occured" is misspelled in the error message.  It should be
> "occurred".
>
> >
>



-- 
William Stein
Associate Professor of Mathematics
University of Washington
http://wstein.org

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Integral problems

2008-09-15 Thread Sand Wraith

i've find anothe way to solve my problems with rect-function:
rect=lambda x: Piecewise([
[(-infinity,-1),(lambda x:0)],
[(- 1, 1),(lambda x:1)],
[( 1, infinity),(lambda x:0)]
])(x);

now:
plot(rect,-4,4)
works, and:
f=lambda x: rect(x)*x^2;
plot(f,-4,4)
works too :-)

but now if want to use my function again, i can not:
g(x)=1+f(x)
so i must use only:
g=lambda x:1+f(x)
(and show(plot(g,-4,4),ymin=0) or numerical_integral(g,-4,4) works
fine).

definition like "g(x)=1+f(x)" is more comfort for me (

On Sep 15, 8:25 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
> On Mon, Sep 15, 2008 at 11:10 AM, Sand Wraith <[EMAIL PROTECTED]> wrote:
>
> > On Sep 13, 2:35 am, Jason Merrill <[EMAIL PROTECTED]> wrote:
> >> On Sep 12, 4:48 pm, Sand Wraith <[EMAIL PROTECTED]> wrote:
>
> >> > Hi all! Help please again :-)
>
> >> > here is worksheet describes my problem:
>
> >> >http://75.75.6.176/home/pub/8/
>
> >> > so, at the last stem i have wrong result: 0 instead of 2/3.
>
> >> > what i am doing wrong?
>
> >> It looks like there are a few problems here, but the main thing is
> >> that when you call myrect(x), it just returns 0.
>
> >> def rect(tau=0,t=0):
> >>    if (t==tau) or (t==-tau):
> >>        return 0.5
> >>    elif (t>-tau) and (t >>        return 1
> >>    else:
> >>        return 0;
>
> >> def myrect(x):
> >>    return rect(1,x);
>
> >> sage: myrect(x)
> >> 0
>
> >> The reason is that when you compare a symbolic variable, x, to a
> >> number, 1, and force sage to come up with a True or False answer, as
> >> if and elif do, the answer is basically always False.
>
> >> sage: bool(x == 1)
> >> False
> >> sage: bool(x < 1)
> >> False
> >> sage: bool(x > 1)
> >> False
> >> sage: bool(x < -1)
> >> False
>
> >> etc.
>
> >> Because of this, when you call myrect(x), things fall down to the last
> >> branch of your definition.  When an expression appears as an argument
> >> to a function, it is evaluated *before* the function is called.  For
> >> instance, look at
>
> >> sage: plot(myrect(x),(x,-3,3)) # The line segment y == 0
>
> >> In this case, myrect(x) evaluates to 0 *before* plot has a chance to
> >> pass in any values, and the same thing is happening to integral.
>
> >> I'd like to tell you that you can do what you want using piecewise, or
> >> something like that, but actually I don't see any way at all to make
> >> integral, which needs something that can act like a SymbolicExpression
> >> as its first argument, do what you want.  Maybe someone else will
> >> know.
>
> >> Regards,
>
> >> JM
>
> > I have redefine rect function:
> > rect=Piecewise([
> > [(-10,-1),(lambda x:0)],
> > [(- 1, 1),(lambda x:1)],
> > [( 1, 10),(lambda x:0)]
> > ]);
>
> > and i have another two questions:
>
> > 1) rect.plot() - is it the only way of plotting? i'd like to use
>
> Yes, this is the only way to plot rect at the moment.
>
> > plot(rect,-4,4), but it leads to error:
>
> >>verbose 0 (3729: plot.py, __call__) there were 4 extra arguments
> >>(besides  at 0xa9382cc>)
> >>Traceback (click to the left for traceback)
> >>...
> >>UnboundLocalError: local variable 'G' referenced before assignment
>
> > 2)How can i define another function like rect*f(x) ? and plot it?
>
> For some reason, * is not working. You can just redefine your
> function: for example,
>
> rect2 = Piecewise([[(-10,-1),(lambda x:0)], [(- 1, 1),(lambda
> x:sin(x))], [( 1, 10),(lambda x:0)]])
>
>
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Seg fault with determinant calculation

2008-09-15 Thread phil

  I've been pushing the limits of determinant calculation over
multivariate polynomial rings.  I can calculate determinants of
matrices up to 9x9 of the form [[x_0_0, x_0_1],[x_1_0, x_1_1]] (each
element is a single unique variable).  When I get to 10x10 is runs for
a while the crashes with:
Unhandled SIGSEGV: A segmentation fault occured in SAGE.
This probably occured because a *compiled* component
of SAGE has a bug in it (typically accessing invalid memory)
or is not properly wrapped with _sig_on, _sig_off.
You might want to run SAGE under gdb with 'sage -gdb' to debug this.
SAGE will now terminate (sorry).

  9x9 matrices only take about 40 seconds.  The 10x10 calculation runs
for a long time (>1 hr) before crashing.  This is on 64 bit Ubuntu
with the patch in Trac #4068 (http://trac.sagemath.org/sage_trac/
ticket/4068) applied.
  BTW, what is the underlying algorithm used for the determinants? As
I understand it, the naive way is O(N!) while the recursive way is
O(N^3) for a NxN matrix.
  Also, "occured" is misspelled in the error message.  It should be
"occurred".

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: bug with sums of matrices

2008-09-15 Thread Craig Citro

Pierre,

You'll be happy to hear that I got the following response from the
Singular team this morning:

=

Hello Craig Citro,
thanks for the bug report.
The bug is in the gcd computation for multivariate polynomials
over a field extension: therefore it does not show up in the case
of univariate polynomials or if all coefficients are in Q.
The next Singular version (3-1-0) uses a different algorithm at that place,
which is not affected by this error.

Hans Schoenemann

==

So it looks like this will be fixed on the other end soon ...

-cc

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] jsmath typesetting for sqrt, sin, etc.

2008-09-15 Thread hjuergens

Using SAGE 3.1.1 notebook GUI in Safari 3.1.2 on Mac OS X
   var ('x')
   f = 1/sqrt(x)
   jsmath(f)
produces the output\frac{1}{\sqrt{ x }}
and does no typesetting
while
   var ('x')
   g = 1/x^2
   jsmath(g)
produces nice typset of that formular.

As soon as sqrt, sin, etc. are in the game typesetting with jsmath
does not work as expected. Is this a known bug. Do I miss some
configuration?

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: jsmath typesetting for sqrt, sin, etc.

2008-09-15 Thread Jason Grout

hjuergens wrote:
> Using SAGE 3.1.1 notebook GUI in Safari 3.1.2 on Mac OS X
>var ('x')
>f = 1/sqrt(x)
>jsmath(f)
> produces the output\frac{1}{\sqrt{ x }}
> and does no typesetting
> while
>var ('x')
>g = 1/x^2
>jsmath(g)
> produces nice typset of that formular.

A data point: on Firefox 3.0.1, Ubuntu 8.04 32-bit, both examples above 
produce typeset output.

Do you have the jsmath TeX fonts installed?  Click on the "jsmath" icon 
at the bottom of the page and check to see if it says "jsMath v3.5 (TeX 
fonts)".  If it doesn't, that may be the problem.

If you don't have the tex fonts, you might go to 
http://www.math.union.edu/~dpvc/jsMath/download/jsMath-fonts.html and 
download them and install them on your computer.

Thanks,

Jason



--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Integral problems

2008-09-15 Thread David Joyner

On Mon, Sep 15, 2008 at 11:10 AM, Sand Wraith <[EMAIL PROTECTED]> wrote:
>
>
>
> On Sep 13, 2:35 am, Jason Merrill <[EMAIL PROTECTED]> wrote:
>> On Sep 12, 4:48 pm, Sand Wraith <[EMAIL PROTECTED]> wrote:
>>
>> > Hi all! Help please again :-)
>>
>> > here is worksheet describes my problem:
>>
>> >http://75.75.6.176/home/pub/8/
>>
>> > so, at the last stem i have wrong result: 0 instead of 2/3.
>>
>> > what i am doing wrong?
>>
>> It looks like there are a few problems here, but the main thing is
>> that when you call myrect(x), it just returns 0.
>>
>> def rect(tau=0,t=0):
>>if (t==tau) or (t==-tau):
>>return 0.5
>>elif (t>-tau) and (t>return 1
>>else:
>>return 0;
>>
>> def myrect(x):
>>return rect(1,x);
>>
>> sage: myrect(x)
>> 0
>>
>> The reason is that when you compare a symbolic variable, x, to a
>> number, 1, and force sage to come up with a True or False answer, as
>> if and elif do, the answer is basically always False.
>>
>> sage: bool(x == 1)
>> False
>> sage: bool(x < 1)
>> False
>> sage: bool(x > 1)
>> False
>> sage: bool(x < -1)
>> False
>>
>> etc.
>>
>> Because of this, when you call myrect(x), things fall down to the last
>> branch of your definition.  When an expression appears as an argument
>> to a function, it is evaluated *before* the function is called.  For
>> instance, look at
>>
>> sage: plot(myrect(x),(x,-3,3)) # The line segment y == 0
>>
>> In this case, myrect(x) evaluates to 0 *before* plot has a chance to
>> pass in any values, and the same thing is happening to integral.
>>
>> I'd like to tell you that you can do what you want using piecewise, or
>> something like that, but actually I don't see any way at all to make
>> integral, which needs something that can act like a SymbolicExpression
>> as its first argument, do what you want.  Maybe someone else will
>> know.
>>
>> Regards,
>>
>> JM
>
> I have redefine rect function:
> rect=Piecewise([
> [(-10,-1),(lambda x:0)],
> [(- 1, 1),(lambda x:1)],
> [( 1, 10),(lambda x:0)]
> ]);
>
> and i have another two questions:
>
> 1) rect.plot() - is it the only way of plotting? i'd like to use


Yes, this is the only way to plot rect at the moment.


> plot(rect,-4,4), but it leads to error:
>
>>verbose 0 (3729: plot.py, __call__) there were 4 extra arguments
>>(besides  at 0xa9382cc>)
>>Traceback (click to the left for traceback)
>>...
>>UnboundLocalError: local variable 'G' referenced before assignment
>
> 2)How can i define another function like rect*f(x) ? and plot it?


For some reason, * is not working. You can just redefine your
function: for example,

rect2 = Piecewise([[(-10,-1),(lambda x:0)], [(- 1, 1),(lambda
x:sin(x))], [( 1, 10),(lambda x:0)]])


> >
>

--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Integral problems

2008-09-15 Thread Sand Wraith



On Sep 13, 2:35 am, Jason Merrill <[EMAIL PROTECTED]> wrote:
> On Sep 12, 4:48 pm, Sand Wraith <[EMAIL PROTECTED]> wrote:
>
> > Hi all! Help please again :-)
>
> > here is worksheet describes my problem:
>
> >http://75.75.6.176/home/pub/8/
>
> > so, at the last stem i have wrong result: 0 instead of 2/3.
>
> > what i am doing wrong?
>
> It looks like there are a few problems here, but the main thing is
> that when you call myrect(x), it just returns 0.
>
> def rect(tau=0,t=0):
>    if (t==tau) or (t==-tau):
>        return 0.5
>    elif (t>-tau) and (t        return 1
>    else:
>        return 0;
>
> def myrect(x):
>    return rect(1,x);
>
> sage: myrect(x)
> 0
>
> The reason is that when you compare a symbolic variable, x, to a
> number, 1, and force sage to come up with a True or False answer, as
> if and elif do, the answer is basically always False.
>
> sage: bool(x == 1)
> False
> sage: bool(x < 1)
> False
> sage: bool(x > 1)
> False
> sage: bool(x < -1)
> False
>
> etc.
>
> Because of this, when you call myrect(x), things fall down to the last
> branch of your definition.  When an expression appears as an argument
> to a function, it is evaluated *before* the function is called.  For
> instance, look at
>
> sage: plot(myrect(x),(x,-3,3)) # The line segment y == 0
>
> In this case, myrect(x) evaluates to 0 *before* plot has a chance to
> pass in any values, and the same thing is happening to integral.
>
> I'd like to tell you that you can do what you want using piecewise, or
> something like that, but actually I don't see any way at all to make
> integral, which needs something that can act like a SymbolicExpression
> as its first argument, do what you want.  Maybe someone else will
> know.
>
> Regards,
>
> JM

I have redefine rect function:
rect=Piecewise([
[(-10,-1),(lambda x:0)],
[(- 1, 1),(lambda x:1)],
[( 1, 10),(lambda x:0)]
]);

and i have another two questions:

1) rect.plot() - is it the only way of plotting? i'd like to use
plot(rect,-4,4), but it leads to error:

>verbose 0 (3729: plot.py, __call__) there were 4 extra arguments
>(besides  at 0xa9382cc>)
>Traceback (click to the left for traceback)
>...
>UnboundLocalError: local variable 'G' referenced before assignment

2)How can i define another function like rect*f(x) ? and plot it?
--~--~-~--~~~---~--~~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---