Re: [sage-support] Re: Bessel Function Zeroes

2010-07-04 Thread Dr. David Kirkby

On 07/ 4/10 07:25 AM, Jason Grout wrote:

You could also use mpmath to calculate the roots:

http://mpmath.googlecode.com/svn/tags/0.15/doc/build/functions/bessel.html?highlight=bessel


(specifically, see the example "Roots of Bessel functions are often used:")

Jason


It would be good if how to find these was more obvious. Roots of Bessel 
functions are pretty common to want to find (at least in fields of engineering 
I've worked in). It's not obvious that one would use the Sage interface to 
mpmath to compute these.


MMA has these as BesselJZero[] and BesselYZero[]

http://reference.wolfram.com/mathematica/ref/BesselJZero.html
http://reference.wolfram.com/mathematica/ref/BesselYZero.html

If nobody beats me to it, when the OpenSolaris and 64-bit SPARC ports are 
finished and I can concentrate on other aspects of Sage, I'll look into making 
these more easily available.


Dave

--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] numerical evaluation of symbolic expressions

2010-07-04 Thread dirkd
Why is evaluating this expression problematical?

y1(x)=x^2;y2(x)=5-x;
a0=1;an=3;Delta=(an-a0)/n;p(k)=a0+(k-1/2)*Delta;
I(n)=sum(abs(y2(p(k))-y1(p(k)))*Delta,k,1,n);
N(I(10))

SAGE respons:

Traceback (most recent call last):
  File "", line 1, in 
  File "_sage_input_109.py", line 9, in 
open("___code___.py","w").write("# -*- coding: utf-8 -*-\n" +
_support_.preparse_worksheet_cell(base64.b64decode("eTEoeCk9eF4yO3kyKHgpPTUteDsKYTA9MTthbj0zO0RlbHRhPShhbi1hMCkvbjtwKGspPWEwKyhrLTEvMikqRGVsdGE7Ckkobik9c3VtKGFicyh5MihwKGspKS15MShwKGspKSkqRGVsdGEsaywxLG4pOwpOKEkoMTApKQ=="),globals())
+"\n"); execfile(os.path.abspath("___code___.py"))
  File "", line 1, in 

  File "/tmp/tmpk0DnhJ/___code___.py", line 6, in 
N(I(_sage_const_10 ))
  File "", line 1, in 

  File "/home/sage/sage/local/lib/python2.6/site-packages/sage/misc/
functional.py", line 1165, in numerical_approx
return x.numerical_approx(prec)
  File "expression.pyx", line 3797, in
sage.symbolic.expression.Expression.n (sage/symbolic/expression.cpp:
17022)
TypeError: cannot evaluate symbolic expression numerically


If I leave out the N( )-operator on the last line the block evaluates
to


1/500*sum(abs(-4*k^2 - 56*k + 329), k, 1, 10)

which can be evaluated in a new inputbox. Why not in one step?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] numerical evaluation of symbolic expressions

2010-07-04 Thread Burcin Erocal
Hi,

On Sun, 4 Jul 2010 05:36:50 -0700 (PDT)
dirkd  wrote:

> Why is evaluating this expression problematical?
> 
> y1(x)=x^2;y2(x)=5-x;
> a0=1;an=3;Delta=(an-a0)/n;p(k)=a0+(k-1/2)*Delta;
> I(n)=sum(abs(y2(p(k))-y1(p(k)))*Delta,k,1,n);
> N(I(10))
> 
> SAGE respons:

>   File "expression.pyx", line 3797, in
> sage.symbolic.expression.Expression.n (sage/symbolic/expression.cpp:
> 17022)
> TypeError: cannot evaluate symbolic expression numerically
> 
> 
> If I leave out the N( )-operator on the last line the block evaluates
> to
> 
> 
> 1/500*sum(abs(-4*k^2 - 56*k + 329), k, 1, 10)
> 
> which can be evaluated in a new inputbox. Why not in one step?

The result returned from maxima uses a symbolic function object created
on the fly. This is quite different from the sum() function
available on the command line, and unfortunately, it doesn't define a
numerical evaluation function, _evalf_().

If no one beats me to it, I will provide a symbolic sum function in the
next few days. I opened a ticket for this problem:

http://trac.sagemath.org/sage_trac/ticket/9424


Thanks for the report.

Burcin

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Why does LatticePolytope not implement a special __eq__ function?

2010-07-04 Thread Johannes
Hi list,
im just playing around with sage and LatticePolytopes and im wondering
why theres no __eq__ implementet for them.
if i have this code:
s1 = LatteciPolytope(matrix([[1,0,-1],[0,1,-1]])
s2 = LatteciPolytope(matrix([[1,0,-1],[0,1,-1]])

then s1 == s2 evals to false.
thats right in the sentence of ref-equality but in my eyes two polytopes
are equal, if they live in the same space (in this case, on the same
Lattice) and have the same edges.
Is there any reason, why its not implemented that way?

greatz Johannes

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Subclass from LatticePolytope

2010-07-04 Thread Johannes
Hi list,
i just tried to create a extended Version of LatticePolytope, but it did
not work.
I always get the following error:
Error when calling the metaclass bases function() argument 1 must be
code, not str.
i found out this is because LatticePolytope is not a class, but a function.
otherwise, the type of LatticePolytope(somePoints) is given as:
sage.geometry.lattice_polytope.LatticePolytopeClass.
How can i extend this?
Where can i find informations about this class?

greatz Johannes

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Some R integration samples - is there better way to do it?

2010-07-04 Thread Andrzej Giniewicz
Hi,

recently I have given short introductory talk about Sage and questions
about integration with R arisen. Results of quickly put together code
is now at http://sagenb.org/home/pub/2232/ - especially, the question
was: "I have variable named x in R environment and want to get its
value, or variable named x inside Sage environment and push its value
into R, but keep the name." - what I was able to think about is quick
hack with .GlobalEnv of R, but is there better way to do what is
presented in the notebook linked above? Is there some syntax like
r["x"]=[1,2,3] or sth? If there is, I haven't noticed it yet - would
be thankful for hints.

Cheers,
Andrzej.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Some R integration samples - is there better way to do it?

2010-07-04 Thread Tim Joseph Dumol
Hi Andrezj,

On Sun, Jul 4, 2010 at 11:54 PM, Andrzej Giniewicz  wrote:
> Hi,
>
> recently I have given short introductory talk about Sage and questions
> about integration with R arisen. Results of quickly put together code
> is now at http://sagenb.org/home/pub/2232/ - especially, the question
> was: "I have variable named x in R environment and want to get its
> value, or variable named x inside Sage environment and push its value
> into R, but keep the name." - what I was able to think about is quick
> hack with .GlobalEnv of R, but is there better way to do what is
> presented in the notebook linked above? Is there some syntax like
> r["x"]=[1,2,3] or sth? If there is, I haven't noticed it yet - would
> be thankful for hints.
>
> Cheers,
> Andrzej.
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

This should do what you wanted:

sage: r('x <- c(1,2,3)')
[1] 1 2 3
sage: r('x')
[1] 1 2 3
sage: sageobj(r('x')) # r('x').sage() works too
[1, 2, 3]
sage: r([1, 2, 3])
[1] 1 2 3
---
Tim Joseph Dumol 
http://timdumol.com

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Some R integration samples - is there better way to do it?

2010-07-04 Thread Tim Joseph Dumol
On Mon, Jul 5, 2010 at 12:13 AM, Tim Joseph Dumol  wrote:
> Hi Andrezj,
>
> On Sun, Jul 4, 2010 at 11:54 PM, Andrzej Giniewicz  wrote:
>> Hi,
>>
>> recently I have given short introductory talk about Sage and questions
>> about integration with R arisen. Results of quickly put together code
>> is now at http://sagenb.org/home/pub/2232/ - especially, the question
>> was: "I have variable named x in R environment and want to get its
>> value, or variable named x inside Sage environment and push its value
>> into R, but keep the name." - what I was able to think about is quick
>> hack with .GlobalEnv of R, but is there better way to do what is
>> presented in the notebook linked above? Is there some syntax like
>> r["x"]=[1,2,3] or sth? If there is, I haven't noticed it yet - would
>> be thankful for hints.
>>
>> Cheers,
>> Andrzej.
>>
>> --
>> To post to this group, send email to sage-support@googlegroups.com
>> To unsubscribe from this group, send email to 
>> sage-support+unsubscr...@googlegroups.com
>> For more options, visit this group at 
>> http://groups.google.com/group/sage-support
>> URL: http://www.sagemath.org
>>
>
> This should do what you wanted:
>
> sage: r('x <- c(1,2,3)')
> [1] 1 2 3
> sage: r('x')
> [1] 1 2 3
> sage: sageobj(r('x')) # r('x').sage() works too
> [1, 2, 3]
> sage: r([1, 2, 3])
> [1] 1 2 3

Oh, and:

sage: r.set('y', r([1,2,3]))
sage: r('y')
[1] 1 2 3

Try:

sage: r.

for more commands.
> ---
> Tim Joseph Dumol 
> http://timdumol.com
>



-- 
Tim Joseph Dumol 
http://timdumol.com

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Which python for sage?

2010-07-04 Thread Greg Kuperberg
On Jul 3, 8:33 am, William Stein  wrote:
> Sage can't switch to Python 3 until every single Python package in
> Sage is ported to Python 3.
> This is far from done.  It's possible that for some packages, nobody
> is even working on doing a port. In such cases, our only hope is to
> either do the port ourselves or remove the package from Sage, which
> may both be incredibly difficult.    I've heard Twisted may be an
> example of such a package, but there might be others.   Even numpy
> hasn't been ported to Python 3 yet, though at least there work is
> rumored to be in progress.

Of course, you understand these issues better than I do.  I didn't
even
consider that Sage has so many third-party libraries at the Python
level.
So yeah, I can see that it could take a long time to do such a
conversion.

Even so, I would suggest a more developed policy than just that you
can't
do it right now.  Certainly at first glance, Python 3 looks a really
good idea.  Maybe at second glance, the conversion cost is very high
for
many projects and you could estimate that it will take many years for
the world to switch.  (But note that the same was true of a really
great
editor called NEdit and Unicode, and the result in the long run was
that
it hurt NEdit a lot.)

In any case the all-or-nothing answer cannot be completely true.
After all,
you have interface support for packages written entirely in C or
whatever
other language.  So how could it be that if you were in Python 3, then
Python 2.* would be the one language that you can't support at all?
What would you do if you wanted to support a Python 3 package?

--
0 Greg Kuperberg
01234 Professor of Mathematics
02413 University of California, Davis
03142 http://www.math.ucdavis.edu/~greg/
04321 g...@math.ucdavis.edu

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Subclass from LatticePolytope

2010-07-04 Thread Justin C. Walker

Hi, Johannes,

On Jul 4, 2010, at 07:24 , Johannes wrote:

i just tried to create a extended Version of LatticePolytope, but it  
did

not work.
I always get the following error:
Error when calling the metaclass bases function() argument 1 must be
code, not str.
i found out this is because LatticePolytope is not a class, but a  
function.

otherwise, the type of LatticePolytope(somePoints) is given as:
sage.geometry.lattice_polytope.LatticePolytopeClass.
How can i extend this?
Where can i find informations about this class?


I can't help with the details of the Lattice Polytope code, but this  
may help.  Since I'm not sure of your understanding of the Sage  
system, I'm not sure of how much you know, so this is basic info:


In general, given a Sage (or Python) object 'x', typing 'x. 
[TAB]' (i.e., 'x.' followed by the TAB key) will give you a list of  
methods associated to 'x' (or to its type; also, not all listed items  
may be implemented for a given object).


Also, typing "str[TAB]" will give you a list of all known (global)  
names beginning with "str".


If you type something like "s1.polar?" (from your previous email),  
Sage will respond with whatever documentation is provided by the  
implementor of the "polar()" method for Lattice Polytopes.  With a  
double "??", you get documentation and possibly the code that  
implements it (if Sage can find it).  For this to work, "s1" must be  
the full name of an object, class, function, or method (sometimes  
'str[tab]?' works wonders :-}).


At the beginning of each of the latter output lists is a line  
beginning "File: ".  This line contains the full path to the source  
file where the code lives, so you can examine things like class  
definitions and function or method implementations.


HTH

Justin

--
Justin C. Walker, Curmudgeon at Large
Institute for the Absorption of Federal Funds
---
My wife 'n kids 'n dogs are gone,
I can't get Jesus on the phone,
But Ol' Milwaukee's Best is my best friend.
---


--
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Subclass from LatticePolytope

2010-07-04 Thread Johannes
thnx,
i did not know all about the sagehelp. but the ?? is a wonderfull feature.
I'll look at the code next, and i hope it helps me somehow.
gretz Johannes.
Am 04.07.2010 23:52, schrieb Justin C. Walker:
> Hi, Johannes,
>
> On Jul 4, 2010, at 07:24 , Johannes wrote:
>
>> i just tried to create a extended Version of LatticePolytope, but it did
>> not work.
>> I always get the following error:
>> Error when calling the metaclass bases function() argument 1 must be
>> code, not str.
>> i found out this is because LatticePolytope is not a class, but a
>> function.
>> otherwise, the type of LatticePolytope(somePoints) is given as:
>> sage.geometry.lattice_polytope.LatticePolytopeClass.
>> How can i extend this?
>> Where can i find informations about this class?
>
> I can't help with the details of the Lattice Polytope code, but this
> may help.  Since I'm not sure of your understanding of the Sage
> system, I'm not sure of how much you know, so this is basic info:
>
> In general, given a Sage (or Python) object 'x', typing 'x.[TAB]'
> (i.e., 'x.' followed by the TAB key) will give you a list of methods
> associated to 'x' (or to its type; also, not all listed items may be
> implemented for a given object).
>
> Also, typing "str[TAB]" will give you a list of all known (global)
> names beginning with "str".
>
> If you type something like "s1.polar?" (from your previous email),
> Sage will respond with whatever documentation is provided by the
> implementor of the "polar()" method for Lattice Polytopes.  With a
> double "??", you get documentation and possibly the code that
> implements it (if Sage can find it).  For this to work, "s1" must be
> the full name of an object, class, function, or method (sometimes
> 'str[tab]?' works wonders :-}).
>
> At the beginning of each of the latter output lists is a line
> beginning "File: ".  This line contains the full path to the source
> file where the code lives, so you can examine things like class
> definitions and function or method implementations.
>
> HTH
>
> Justin
>
> -- 
> Justin C. Walker, Curmudgeon at Large
> Institute for the Absorption of Federal Funds
> ---
> My wife 'n kids 'n dogs are gone,
> I can't get Jesus on the phone,
> But Ol' Milwaukee's Best is my best friend.
> ---
>
>

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] An argument for more direct axiom integration

2010-07-04 Thread John
I discovered the following article online (http://amca01.wordpress.com/
2010/01/08/symbolic-integration-with-an-open-source-cas/). Suggesting
that there are certain cases, in which sage fails to integrate
functions that can be integrated. The functions that the author of
this article said could not be integrated by sage, in fact, were not
integrated when I tested them today with the latest version that I
just now installed. In all fairness, Sage is very good and solves most
all of the integrals, but axiom can solve some cases where sage
cannot. For this reason, I feel it would be nice to have a more
directly integrated axiom to solve these problems and integrated what
sage cannot do normally.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] An argument for more direct axiom integration

2010-07-04 Thread William Stein
Great idea - you could add an algorithm="axiom" option to sage's
integrate command.

On Sunday, July 4, 2010, John  wrote:
> I discovered the following article online (http://amca01.wordpress.com/
> 2010/01/08/symbolic-integration-with-an-open-source-cas/). Suggesting
> that there are certain cases, in which sage fails to integrate
> functions that can be integrated. The functions that the author of
> this article said could not be integrated by sage, in fact, were not
> integrated when I tested them today with the latest version that I
> just now installed. In all fairness, Sage is very good and solves most
> all of the integrals, but axiom can solve some cases where sage
> cannot. For this reason, I feel it would be nice to have a more
> directly integrated axiom to solve these problems and integrated what
> sage cannot do normally.
>
> --
> To post to this group, send email to sage-support@googlegroups.com
> To unsubscribe from this group, send email to 
> sage-support+unsubscr...@googlegroups.com
> For more options, visit this group at 
> http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

-- 
William Stein
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 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org