[sage-support] Some Math Resources that may be of interest

2008-12-03 Thread Tim Lahey

Hi,

I ran across the Imperial Collge Metric project which looked
at mathematics education. An archive of some old work
is at:

http://metric1.ma.imperial.ac.uk/

In particular interest is an Intro to Mathematica,
http://metric1.ma.imperial.ac.uk/mathematica/

and the PDF:
http://metric1.ma.imperial.ac.uk/mathematica/download/Course.pdf

We might want to do something similar as an Intro to Sage since
it does a good job of covering a lot of things a student might
be interested in doing.

Cheers,

Tim.

---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://www.linkedin.com/in/timlahey

smime.p7s
Description: S/MIME cryptographic signature


[sage-support] Re: Groups, Rings, Fields?

2008-12-03 Thread Tim Lahey


On Dec 3, 2008, at 10:26 PM, Jeffrey Straszheim wrote:



Tim Lahey wrote:

Hi,

I'm an engineer by training, so my knowledge of
mathematics is very applied. A lot of things in
Sage deal with Groups, Rings, and Fields so I'd
like to broaden and improve my mathematics knowledge.
Could someone suggest a good introductory reference
(and possibly an intermediate one) so I can better
understand what Sage is doing?

Thanks,

Tim.


If you're an applied maths guy, I would suggest _Algebra_ by Michael
Artin.  It provides plenty of concrete examples of the abstract stuff
and why it is useful.  It is not comprehensive, but the topics it
chooses are well developed, and you'll never have to ask, "Why does  
this
theorem matter?"  It will get you started on groups, rings, and  
fields.




Oh, thanks a lot. I'll look for it. I prefer applied math texts so I
definitely appreciate the recommendation.

Cheers,

Tim.

---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://www.linkedin.com/in/timlahey

smime.p7s
Description: S/MIME cryptographic signature


[sage-support] Re: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Jason Grout

Robert Bradshaw wrote:

> I already wrote such a thing, see http://hg.sagemath.org/sage-main/ 
> file/5be1d5ad8339/sage/misc/parser.pyx . To implement hold, one would  
> modify the preparser to do something like
> 
> hold(...) -> SR("...", no_simplification=True)
> 
> and of course make sure it propagates the no_simplification (or  
> whatever it's called) flag so that when it's printed it doesn't  
> simplify itself with maxima. This would of course only work for  
> symbolic expressions, not arbitrary chunks of Python code. (Arbitrary  
> chunks of Python code could be handled as well, using the ast and  
> compile modules, but that's a whole different type type of thing, and  
> one couldn't expect to pass them to maxima.)

Yep, this is exactly the sort of thing I was imagining.


> Modifying the preparser is not something that should be IMHO taken  
> lightly.


I agree that modifying the preparser should only be done after very 
carefully weighing the advantages and disadvantages!

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: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Robert Bradshaw

On Dec 3, 2008, at 7:38 PM, Jason Grout wrote:

>
> Robert Bradshaw wrote:
>> On Dec 3, 2008, at 10:42 AM, Jason Grout wrote:
>>
>>> So, bringing up an issue that has come up before, there is no  
>>> way  to do
>>> the equivalent of the Hold or HoldAll commands in Mma?  See
>>> http://reference.wolfram.com/mathematica/ref/Hold.html? 
>>> q=Hold&lang=en
>>> for example.
>>
>> Not without some preparsing magic, and even then it might be tricky
>> as there is not a simple one-to-one correspondence between the python
>> parse tree and the mathematical expression.
>
> Huh, maybe that's why it's so natural in Mathematica; their entire
> language is literally a parse tree for the mathematical expression.
>
> Okay, here's some brainstorming that may not even make sense, or  
> may be
> completely obvious...
>
> You know a lot more about the python parsing trees than I do, but  
> maybe
> we could only pay attention to the subexpression tree formed by Sage
> symbolic components?  For example, surely the ginac parse tree is  
> fairly
> close to the mathematical expression.
>
> Maybe the preparser could set a flag that tells any new symbolic
> composition whether it should try to simplify itself or whether it
> should just hold an inert copy of its arguments.  Or maybe even  
> better,
> we could attack the problem at the coercion level (since that is the
> level that things are combined, like addition, etc.)  If a global flag
> is set, then something in the coercion system somehow uses inert  
> form of
> operators, that basically just construct an expression tree, but  
> doesn't
> evaluate the tree.

I am not a fan of slowing down every arithmetic operation (even by a  
dozen clock cycles) to add checking this flag into the coercion model.

> I guess I'm saying that one way to do things would be to have Sage
> construct an expression tree before doing anything, then evaluate the
> expression tree if it needs to, or it can just return the tree.   
> Wow, it
> seems like a lot of work; I guess it's basically replacing the python
> parser.

I already wrote such a thing, see http://hg.sagemath.org/sage-main/ 
file/5be1d5ad8339/sage/misc/parser.pyx . To implement hold, one would  
modify the preparser to do something like

hold(...) -> SR("...", no_simplification=True)

and of course make sure it propagates the no_simplification (or  
whatever it's called) flag so that when it's printed it doesn't  
simplify itself with maxima. This would of course only work for  
symbolic expressions, not arbitrary chunks of Python code. (Arbitrary  
chunks of Python code could be handled as well, using the ast and  
compile modules, but that's a whole different type type of thing, and  
one couldn't expect to pass them to maxima.)

Modifying the preparser is not something that should be IMHO taken  
lightly.

- 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: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Tim Lahey


On Dec 3, 2008, at 11:15 PM, Robert Bradshaw wrote:




This requires good working knowledge of python style, which is even
rarer than good working knowledge of English :).

Of all the options, I think passing a keyword like "unevaluated=True"
is the best one so far. It's certainly going to be the less common
desired behavior, and I think.

sage: latex(integral(x+x, x, unevaluated=True))
'\int 2x dx'

is natural despite having simplified the x+x.



+1

This fits with my previous suggestion. A named option ensures that it
will only be called if explicitly asked for. However, we need to have
a command to evaluate it at a later point in the calculations.

Cheers,

Tim.

---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://www.linkedin.com/in/timlahey

smime.p7s
Description: S/MIME cryptographic signature


[sage-support] Re: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Robert Bradshaw

On Dec 3, 2008, at 7:54 PM, Jason Grout wrote:

> Robert Bradshaw wrote:
>
>>> Another way to do it might be to have classes like Integrate (as
>>> opposed
>>> to functions), that represent an integral.
>>
>> I'm not a fan of making such a distinction based on the
>> capitalization of the first letter, but it would make sense to have
>> integral (the noun) be unevaluated, and integrate (the verb) actually
>> do the work.
>
> That presupposes a good working knowledge of the English language (at
> least the subset having to do with mathematics), which may not be a  
> bad
> thing, but also puts up another barrier to new users.  I know that
> probably half of my ODE class would say that the verb associated with
> "derivative" is "derive" (well, at least at the start of the semester;
> hopefully they don't have that association anymore).
>
> The nice thing about the capital letter is that there is only one
> command name, and a very systematic tweak that changes it from  
> active to
> inert.  Actually, since python style is to have camel-case class  
> names,
> but lowercase functions, using camelcase for the inert versions
> (constructing a class object) would fit rather nicely.  In other  
> words,
> Integrate constructs an integral object, while integrate is a function
> that you call and it returns an answer.

This requires good working knowledge of python style, which is even  
rarer than good working knowledge of English :).

Of all the options, I think passing a keyword like "unevaluated=True"  
is the best one so far. It's certainly going to be the less common  
desired behavior, and I think.

sage: latex(integral(x+x, x, unevaluated=True))
'\int 2x dx'

is natural despite having simplified the x+x.

- 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: f(x)=abs(x); f(vector([1,2,3])) gives error

2008-12-03 Thread Robert Bradshaw

On Dec 2, 2008, at 2:10 PM, Scott Walck wrote:

> Hello,
>
> Is there a reason why I cannot do
>
> f(x)=abs(x)
> f(vector([1,2,3]))
>
> Many related things work fine:
>
> abs(vector([1,2,3]))   # works
>
> def f(x): return abs(x)
> f(vector([1,2,3]))  # works
>
> Session below shows the trouble.

[...]

> sage: f(x)=abs(x)
> sage: f
> x |--> abs(x)
> sage: f(-3)
> 3
> sage: f(v)



Yes. f(x) is a symbolic function, and can only handle the kind of  
objects maxima can handle (and that we have written an interface  
for). Things will become more flexible with Pynac symbolics.

- 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: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Jason Grout

Robert Bradshaw wrote:

>> Another way to do it might be to have classes like Integrate (as  
>> opposed
>> to functions), that represent an integral.
> 
> I'm not a fan of making such a distinction based on the  
> capitalization of the first letter, but it would make sense to have  
> integral (the noun) be unevaluated, and integrate (the verb) actually  
> do the work.
> 


That presupposes a good working knowledge of the English language (at 
least the subset having to do with mathematics), which may not be a bad 
thing, but also puts up another barrier to new users.  I know that 
probably half of my ODE class would say that the verb associated with 
"derivative" is "derive" (well, at least at the start of the semester; 
hopefully they don't have that association anymore).

The nice thing about the capital letter is that there is only one 
command name, and a very systematic tweak that changes it from active to 
inert.  Actually, since python style is to have camel-case class names, 
but lowercase functions, using camelcase for the inert versions 
(constructing a class object) would fit rather nicely.  In other words, 
Integrate constructs an integral object, while integrate is a function 
that you call and it returns an answer.

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: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Jason Grout

Robert Bradshaw wrote:
> On Dec 3, 2008, at 10:42 AM, Jason Grout wrote:
> 
>> Robert Bradshaw wrote:
>>> On Dec 3, 2008, at 5:55 AM, Stan Schymanski wrote:
>>>
 Dear all,

 Could anyone tell me how to controll the order in which arguments  
 are
 evaluated when they are passed to python functions? It seems that  
 the
 functions are evaluated first and then the variables are  
 substituted,
 which leads to failures in the following example:
>>> To answer the original question, Python doesn't give control over
>>> this. Arguments are always evaluated before passed to the function.
>>> (What one can do, as Jason demonstrated, is pass in a function to be
>>> evaluated later).
>> So, bringing up an issue that has come up before, there is no way  
>> to do
>> the equivalent of the Hold or HoldAll commands in Mma?  See
>> http://reference.wolfram.com/mathematica/ref/Hold.html?q=Hold&lang=en
>> for example.
> 
> Not without some preparsing magic, and even then it might be tricky  
> as there is not a simple one-to-one correspondence between the python  
> parse tree and the mathematical expression.
> 


Huh, maybe that's why it's so natural in Mathematica; their entire 
language is literally a parse tree for the mathematical expression.

Okay, here's some brainstorming that may not even make sense, or may be 
completely obvious...

You know a lot more about the python parsing trees than I do, but maybe 
we could only pay attention to the subexpression tree formed by Sage 
symbolic components?  For example, surely the ginac parse tree is fairly 
close to the mathematical expression.

Maybe the preparser could set a flag that tells any new symbolic 
composition whether it should try to simplify itself or whether it 
should just hold an inert copy of its arguments.  Or maybe even better, 
we could attack the problem at the coercion level (since that is the 
level that things are combined, like addition, etc.)  If a global flag 
is set, then something in the coercion system somehow uses inert form of 
operators, that basically just construct an expression tree, but doesn't 
evaluate the tree.

I guess I'm saying that one way to do things would be to have Sage 
construct an expression tree before doing anything, then evaluate the 
expression tree if it needs to, or it can just return the tree.  Wow, it 
seems like a lot of work; I guess it's basically replacing the python 
parser.

I hope at least some of that makes sense.

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: Groups, Rings, Fields?

2008-12-03 Thread Jeffrey Straszheim

Tim Lahey wrote:
> Hi,
>
> I'm an engineer by training, so my knowledge of
> mathematics is very applied. A lot of things in
> Sage deal with Groups, Rings, and Fields so I'd
> like to broaden and improve my mathematics knowledge.
> Could someone suggest a good introductory reference
> (and possibly an intermediate one) so I can better
> understand what Sage is doing?
>
> Thanks,
>
> Tim.
>   
If you're an applied maths guy, I would suggest _Algebra_ by Michael 
Artin.  It provides plenty of concrete examples of the abstract stuff 
and why it is useful.  It is not comprehensive, but the topics it 
chooses are well developed, and you'll never have to ask, "Why does this 
theorem matter?"  It will get you started on groups, rings, and fields.

Jeffrey

--~--~-~--~~~---~--~~
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: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Jason Grout

Tim Lahey wrote:
>> I'm not a fan of making such a distinction based on the
>> capitalization of the first letter, but it would make sense to have
>> integral (the noun) be unevaluated, and integrate (the verb) actually
>> do the work.

That would make sense to me.  There should be an easy way to convert 
between the two.


> I'm definitely in favour of the basic idea. Another approach would be
> to have an option to pass to the integrate function to hold the evaluation
> which is evaluated after calling a second function.

I thought about that, but if you want an entire expression to be 
unevaluated, you have to pass this argument to every function inside the 
expression (nested all the way down to the basic levels that are okay to 
evaluate).  Doing things top-down makes it a lot easier to not evaluate 
an entire subexpression, but you have to catch things at the preparse 
stage to do that.

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: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Tim Lahey


On Dec 3, 2008, at 9:58 PM, Robert Bradshaw wrote:



On Dec 3, 2008, at 10:42 AM, Jason Grout wrote:




So, bringing up an issue that has come up before, there is no way
to do
the equivalent of the Hold or HoldAll commands in Mma?  See
http://reference.wolfram.com/mathematica/ref/Hold.html?q=Hold&lang=en
for example.


Not without some preparsing magic, and even then it might be tricky
as there is not a simple one-to-one correspondence between the python
parse tree and the mathematical expression.


It'd still be nice if there were a way to be able to create and deal
with unevaluated symbolic expressions (for example, if I want to  
print

an integral sign by doing latex(hold(integrate(...))) ).  I guess we
could add yet another feature to the preparser if there was enough
demand.

Another way to do it might be to have classes like Integrate (as
opposed
to functions), that represent an integral.


I'm not a fan of making such a distinction based on the
capitalization of the first letter, but it would make sense to have
integral (the noun) be unevaluated, and integrate (the verb) actually
do the work.


I'm definitely in favour of the basic idea. Another approach would be
to have an option to pass to the integrate function to hold the  
evaluation

which is evaluated after calling a second function.

Cheers,

Tim.

---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://www.linkedin.com/in/timlahey

smime.p7s
Description: S/MIME cryptographic signature


[sage-support] Re: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Robert Bradshaw

On Dec 3, 2008, at 10:42 AM, Jason Grout wrote:

> Robert Bradshaw wrote:
>> On Dec 3, 2008, at 5:55 AM, Stan Schymanski wrote:
>>
>>> Dear all,
>>>
>>> Could anyone tell me how to controll the order in which arguments  
>>> are
>>> evaluated when they are passed to python functions? It seems that  
>>> the
>>> functions are evaluated first and then the variables are  
>>> substituted,
>>> which leads to failures in the following example:
>>
>> To answer the original question, Python doesn't give control over
>> this. Arguments are always evaluated before passed to the function.
>> (What one can do, as Jason demonstrated, is pass in a function to be
>> evaluated later).
>
> So, bringing up an issue that has come up before, there is no way  
> to do
> the equivalent of the Hold or HoldAll commands in Mma?  See
> http://reference.wolfram.com/mathematica/ref/Hold.html?q=Hold&lang=en
> for example.

Not without some preparsing magic, and even then it might be tricky  
as there is not a simple one-to-one correspondence between the python  
parse tree and the mathematical expression.

> It'd still be nice if there were a way to be able to create and deal
> with unevaluated symbolic expressions (for example, if I want to print
> an integral sign by doing latex(hold(integrate(...))) ).  I guess we
> could add yet another feature to the preparser if there was enough  
> demand.
>
> Another way to do it might be to have classes like Integrate (as  
> opposed
> to functions), that represent an integral.

I'm not a fan of making such a distinction based on the  
capitalization of the first letter, but it would make sense to have  
integral (the noun) be unevaluated, and integrate (the verb) actually  
do the work.

> That still wouldn't prevent
> something like Integral(2+3,(x,0,3)) being simplified to
> Integral(5,(x,0,3)), though.

No, it wouldn't.

- 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: parametric_plot3d with imaginary numbers

2008-12-03 Thread acardh

Thanks!!!

On Dec 3, 6:28 am, Marshall Hampton <[EMAIL PROTECTED]> wrote:
> Mathematica does have some extra abilities in 3D graphics compared
> with Sage.  We do have the infrastructure in place to catch up though,
> I hope to help with things like this soon.
>
> I think for your example Sage isn't handling the multiple roots
> properly; I'm not sure how to really fix that but I did do the
> following and got closer:
>
> u, v = var('u,v')
> assume(u>0)
> p15 = sum([parametric_plot3d((u*cos(v),u*sin(v),imaginary(u^(1/5.0)*exp
> (I*v+q*2*I*pi/5))), (u,0,2), (v,0,2*pi), opacity = .5, rgbcolor =
> (0,1,0), frame = False) for q in range(5)])
> show(p15)
>
> which I think is pretty close to the mathematica plot except it
> includes the entire surface by default.
>
> Hope that helps,
> M. Hampton
>
> On Dec 2, 7:20 pm, acardh <[EMAIL PROTECTED]> wrote:
>
> > Hi,
>
> > I am not sure why I am not getting the same 3D image than the one at
> > the bottom of the next 
> > page:http://reference.wolfram.com/mathematica/ref/ParametricPlot3D.html
>
> > I am using these commands:
> > u, v = var('u,v')
> > parametric_plot3d((u*cos(v),u*sin(v),imaginary(u*exp((I*v)^5)^(1/5))),
> > (u,0,2), (v,0,2*pi))
--~--~-~--~~~---~--~~
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: server issues

2008-12-03 Thread kcrisman

> Care to open a ticket to update the docstring? I think it would be
> good to mention that on low memory systems one should set some timeout
> since otherwise Sage will gobble up all available memory if there are
> many users.

This is now # 4691.

--~--~-~--~~~---~--~~
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: Is interact partly broken in 3.1.4 (or before)?

2008-12-03 Thread kcrisman


> > If my init.sage contains implicit_multiplication(True), then with an
> > interact in the first cell I get an error message about EMBEDDED_MODE
> > not supporting implicit multiplication; the rest evaluate normally.
> > I should point out that the cells in question do not ask for any
> > implicit multiplication, nor use it.  Without this init.sage,
> > everything is fine.
>
> Yes, IIRC it proved very difficult to make implicit multiplication
> work in the notebook, so that is why the error message was changed/
> created. I personally dislike even the existence of the option to use
> implicit multiplication since it introduces subtle bugs like you are
> hitting. We are not testing anything with implicit multiplication
> active, so there are probably plenty more issues well hidden
> somewhere.

Yes, I am aware of this discussion regarding implicit multiplication
in the notebook and elsewhere.

>
> You should post the exact example so that someone can look into the
> problem.

http://sagenb.org:8000/home/pub/93/

I tried every input type for the interacts I could think of, and one
by one, when that type was the first cell, it wouldn't evaluate.

Incidentally, this is not just covering up the bug I ran into before.
That is, when the line about no implicit multiplication for the
notebook in the preparser is commented out, my previous problem does
not seem to show up, but the current problem does go away.  Uncomment
again, only the new problem is back.  That is a good sign.

- kcrisman
--~--~-~--~~~---~--~~
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: server issues

2008-12-03 Thread mabshoff

On Dec 3, 10:59 am, kcrisman <[EMAIL PROTECTED]> wrote:

Hi,

> Just wanted to follow up on this for the collective good...

Yep, that seems like a good idea.



> > c) could easily. Did you set the timeout parameter for the server?
>
> >       timeout       -- (default: 0) seconds until idle worksheet sessions
> >                              automatically timeout, i.e., the corresponding
> >                              Sage session terminates.  0 means 'never 
> > timeout'.
>
> That seems to have been the other main problem, and we fixed it.

Care to open a ticket to update the docstring? I think it would be
good to mention that on low memory systems one should set some timeout
since otherwise Sage will gobble up all available memory if there are
many users.

> So now I have a healthy class of 30 students successfully using Sage
> to explore chaos in calculus!  They sometimes get slowdowns when there
> are a number of them on it, but never the total logout except when a
> local switch is broken, which is of course not Sage-related.  Even
> under quite constrained conditions, it seems to be working quite
> nicely.  Imagine how well a Sage lite would work ;)
>
> Thanks,
> - kcrisman

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: Is interact partly broken in 3.1.4 (or before)?

2008-12-03 Thread mabshoff



On Dec 3, 12:52 pm, kcrisman <[EMAIL PROTECTED]> wrote:

Hi,

> > Weirdly, I cannot now reproduce the disappearing slider issue, even
> > though it was consistent a few days ago with 3.1.4+.  If it crops up
> > again I will report back.
>
> Okay, I can replicate this again - with a different error message.
>
> If my init.sage contains implicit_multiplication(True), then with an
> interact in the first cell I get an error message about EMBEDDED_MODE
> not supporting implicit multiplication; the rest evaluate normally.
> I should point out that the cells in question do not ask for any
> implicit multiplication, nor use it.  Without this init.sage,
> everything is fine.

Yes, IIRC it proved very difficult to make implicit multiplication
work in the notebook, so that is why the error message was changed/
created. I personally dislike even the existence of the option to use
implicit multiplication since it introduces subtle bugs like you are
hitting. We are not testing anything with implicit multiplication
active, so there are probably plenty more issues well hidden
somewhere.

> This only happens with more recent versions, and of course doesn't
> happen on sagenb.org since implicit_multiplication is False there.  I
> don't know why this is happening - should preparser error messages be
> showing up if I don't ask anything to be multiplied implicitly? - or
> if it's related to my previous issue.

You should post the exact example so that someone can look into the
problem.

> Thanks,
> - kcrisman

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: What is "Warning sND"?

2008-12-03 Thread mabshoff



Simon King wrote:
> Dear Sage supporters,

Hi,

> as usual, I messed up some Cython module. There was no complaint when
> I included it, but when I called some constructor, I got three times
> the line
>   Warning sND: Backtracking

We have backtracking code, but grepping around does not reveal
anything related to "sND"

> Then, Sage did not react on Ctrl-C. But it was running with almost
> 100% CPU time. I had to kill it.
>
> What does that Warning mean, and is there a typical reason for the
> error?

Without any specifics it seems pointless to speculate. I have never
seen this or anything even remotely close before. What are you doing
with "some Cython module"? It sounds very much like it is something in
your code.

> Yours,
> Simon

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: Multivariate integration in Sage

2008-12-03 Thread Vijay

Jason: Perfect; thank you.  This is exactly what I was looking for.
I am just too lazy to evaluate a multivariate probability density
function manually.

Regards,

- vijay

On Dec 3, 3:30 pm, Jason Grout <[EMAIL PROTECTED]> wrote:
> Vijay wrote:
> > Hi: Is there a way to do multivariate integration in Sage?
> > I tried to look in the FAQ and other documents but could
> > not find a suitable answer.  The closest I came to was the module
> > sage.crypto.mq.mpolynomialsystem, but I don't think this
> > is what I am looking for.
>
> Could you give us an example session you'd like to have work in Sage?
>
> Note that you can integrate an expression with multiple variables
> symbolically:
>
> sage: var('x,y')
> (x, y)
> sage: f=x^2+y^3
> sage: f.integrate(x).integrate(y)
> x*y^4/4 + x^3*y/3
> sage: integrate(f,x)
> x*y^3 + x^3/3
> sage: integrate(f,y)
> y^4/4 + x^2*y
> sage: integrate(integrate(f,x),y)
> x*y^4/4 + x^3*y/3
>
> 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: Multivariate integration in Sage

2008-12-03 Thread Jason Grout

Vijay wrote:
> Hi: Is there a way to do multivariate integration in Sage?
> I tried to look in the FAQ and other documents but could
> not find a suitable answer.  The closest I came to was the module
> sage.crypto.mq.mpolynomialsystem, but I don't think this
> is what I am looking for.
>

Could you give us an example session you'd like to have work in Sage?

Note that you can integrate an expression with multiple variables 
symbolically:

sage: var('x,y')
(x, y)
sage: f=x^2+y^3
sage: f.integrate(x).integrate(y)
x*y^4/4 + x^3*y/3
sage: integrate(f,x)
x*y^3 + x^3/3
sage: integrate(f,y)
y^4/4 + x^2*y
sage: integrate(integrate(f,x),y)
x*y^4/4 + x^3*y/3


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] Multivariate integration in Sage

2008-12-03 Thread Vijay

Hi: Is there a way to do multivariate integration in Sage?
I tried to look in the FAQ and other documents but could
not find a suitable answer.  The closest I came to was the module
sage.crypto.mq.mpolynomialsystem, but I don't think this
is what I am looking for.

Thanks.
--~--~-~--~~~---~--~~
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: Is interact partly broken in 3.1.4 (or before)?

2008-12-03 Thread kcrisman



> Weirdly, I cannot now reproduce the disappearing slider issue, even
> though it was consistent a few days ago with 3.1.4+.  If it crops up
> again I will report back.
>

Okay, I can replicate this again - with a different error message.

If my init.sage contains implicit_multiplication(True), then with an
interact in the first cell I get an error message about EMBEDDED_MODE
not supporting implicit multiplication; the rest evaluate normally.
I should point out that the cells in question do not ask for any
implicit multiplication, nor use it.  Without this init.sage,
everything is fine.

This only happens with more recent versions, and of course doesn't
happen on sagenb.org since implicit_multiplication is False there.  I
don't know why this is happening - should preparser error messages be
showing up if I don't ask anything to be multiplied implicitly? - or
if it's related to my previous issue.

Thanks,
- kcrisman
--~--~-~--~~~---~--~~
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: number field question

2008-12-03 Thread Carl Witty

On Nov 30, 1:27 pm, Alex Raichev <[EMAIL PROTECTED]> wrote:
> > It would be helpful if you could give a more concrete example, e.g., a 
> > session
> > where you have some elements, and finally want to do something with them.
>
> That's good idea, William.  Let me back up to and change my question
> to a more fundamental one.  How does one compute in QQbar with Sage?
> For example, how about factoring a polynomial, computing a radical
> ideal, or computing a variety (see below)?  I get the same error for
> all these: "no conversion of this ring to a Singular ring defined".
>
> Alex

None of these things are implemented for polynomials over QQbar; and
as far as I know there are no plans to implement them.

Simpler variants of a couple of your problems are implemented:

For univariate polynomials, you can find the roots with .roots
(ring=QQbar), and it's trivial to compute the factorization from
there.

You can compute the variety (over QQbar) of a zero-dimensional ideal
of polynomials with rational coefficients, using .variety(ring=QQbar).

It would be great to have more functionality implemented for
polynomials over QQbar; is that something you would be interested in
contributing?

Carl
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
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?hl=en
-~--~~~~--~~--~--~---



[sage-support] Re: number field question

2008-12-03 Thread Carl Witty

On Nov 27, 6:23 pm, Alex Raichev <[EMAIL PROTECTED]> wrote:
> Hi all:
>
> I have a list c of elements of QQbar and want to form the field
> generated by QQ and the elements of c.  What's the easiest way to do
> this?
>      I looked through section 29.1 Number Fields of the Sage reference
> manual, but couldn't find a simple solution using the functions
> mentioned there.

You want number_field_elements_from_algebraics(c) (or maybe
number_field_elements_from_algebraics(c, minimal=True), if you care
about getting the smallest possible number field).

Carl

--~--~-~--~~~---~--~~
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: sage and tkinter?

2008-12-03 Thread mabshoff



On Dec 3, 11:56 am, "David Joyner" <[EMAIL PROTECTED]> wrote:
> I wonder if this should be mentioned in install.tex somewhere?

I don't see any reason. Getting some extension $FOO to work will
greatly depend on the system for example and that is not the roll of
install.tex.

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: questions about types.

2008-12-03 Thread Jason Grout

Jason Grout wrote:
> Simon King wrote:
>> Dear Jason,
>>
>> On Dec 3, 7:54 pm, Jason Grout <[EMAIL PROTECTED]> wrote:
>>> Wow, Sage will redefine symbols that are already existing to accommodate
>>> what should be a dummy variable?  This looks seriously wrong and looks
>>> like it could really mess things up.
>> I don't think so. Admittedly I don't like that x is pre-defined, but
>> here it is something else.



This is getting off-topic (I'm the one to blame), so I'll take it over 
to sage-devel, where it probably belongs anyway.

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: sage and tkinter?

2008-12-03 Thread David Joyner

I wonder if this should be mentioned in install.tex somewhere?


On Wed, Dec 3, 2008 at 2:48 PM, mabshoff
<[EMAIL PROTECTED]> wrote:
>
>
> To reiterate: if you don't have the tcl/tk development libraries
> installed the extension will fail to build. The system python had
> working bindings since that python was build in the presence of those
> dev libraries. Since those aren't needed at runtime for python they
> are usually not installed as a dependency. "sage -f ..." only worked
> because you installed the right dev packages in the meantime.
>
>> Sometimes during Python compilation, it looks to see if a certain
>> library is available,
>
> Nope, no looking involved, python's build system just "does" :)
>
>>  and if it is it compiles the corresponding
>> module, and otherwise simply doesn't. This is what it does, for
>> instance, with OpenSSL, and sounds like the same thing with tkinter.
>> This matches the behavior we're seeing at least.
>
> Python attempts to build the extension and if it fails is just moves
> on. On most systems at least some extensions are broken, so this is
> business as usual.
>
>> - 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: sage and tkinter?

2008-12-03 Thread mabshoff



On Dec 3, 10:54 am, Robert Bradshaw <[EMAIL PROTECTED]>
wrote:
> On Dec 3, 2008, at 10:48 AM, David Joyner wrote:
>
> > But tcl/tk is not a python package. tkinter is the python interface to
> > it and it is included with every python distribution (including  
> > Sage's).
> > The problem is that to import it, tkinter.py looks for tcl/tk using  
> > some
> > magic I couldn't figure out.
>
> > Adrian's suggestion (or William's, and I think now Adam had the  
> > right idea too)
> > worked: reinstall  Sage's Python using sage -f.
>
> > Thanks to all of you for your help.

To reiterate: if you don't have the tcl/tk development libraries
installed the extension will fail to build. The system python had
working bindings since that python was build in the presence of those
dev libraries. Since those aren't needed at runtime for python they
are usually not installed as a dependency. "sage -f ..." only worked
because you installed the right dev packages in the meantime.

> Sometimes during Python compilation, it looks to see if a certain  
> library is available,

Nope, no looking involved, python's build system just "does" :)

>  and if it is it compiles the corresponding  
> module, and otherwise simply doesn't. This is what it does, for  
> instance, with OpenSSL, and sounds like the same thing with tkinter.  
> This matches the behavior we're seeing at least.

Python attempts to build the extension and if it fails is just moves
on. On most systems at least some extensions are broken, so this is
business as usual.

> - 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] What is "Warning sND"?

2008-12-03 Thread Simon King

Dear Sage supporters,

as usual, I messed up some Cython module. There was no complaint when
I included it, but when I called some constructor, I got three times
the line
  Warning sND: Backtracking

Then, Sage did not react on Ctrl-C. But it was running with almost
100% CPU time. I had to kill it.

What does that Warning mean, and is there a typical reason for the
error?

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: questions about types.

2008-12-03 Thread Jason Grout

Simon King wrote:
> Dear Jason,
> 
> On Dec 3, 7:54 pm, Jason Grout <[EMAIL PROTECTED]> wrote:
>> Wow, Sage will redefine symbols that are already existing to accommodate
>> what should be a dummy variable?  This looks seriously wrong and looks
>> like it could really mess things up.
> 
> I don't think so. Admittedly I don't like that x is pre-defined, but
> here it is something else.
> There are Sage constructions which define various things in one line.
> For example,
>  sage: R.=QQ[]
> both defines R *and* z (the latter of type Polynomial_rational_dense).

In this case, z is not being used as a dummy variable.  I think it makes 
a lot of sense to define z globally when z is on the right, versus 
defining z just locally when you have R = QQ['z']


> 
> Similarly, doing
>  sage: R(z)=sin(z)
> both defines R *and* z (the latter of type SymbolicVariable).

In this case, mathematical convention says that z is a dummy variable; 
it should not matter what I call the thing inside the parentheses, and 
it certainly shouldn't affect stuff outside of the function.

Maybe part of the huge difference in my mind is that R(z) = sin(z) tries 
to follow a deeply-ingrained mathematical convention, while R. is 
defining new notation.

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: questions about types.

2008-12-03 Thread Simon King

PS:

sage: R.=QQ[]
sage: type(R)

sage: type(z)

sage: R=sin(z)
sage: type(R)

sage: type(z)

sage: R(z)=sin(z)
sage: type(R)

sage: type(z)


That's all consistent! R respectively z get a new meaning if and only
if they appear on the left side of an assignment.
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: questions about types.

2008-12-03 Thread Jason Grout

Jason Grout wrote:
> Robert Bradshaw wrote:
>> On Dec 3, 2008, at 10:28 AM, adrian wrote:
>>
>>> In the following code:
>>> sage: x=CC['x'].gen()
>>> sage: type(x)
>>> >> 'sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_d 
>>> ense_field'>
>>> sage: f(x)=sin(x)
>>> sage: type(x)
>>> 
>>>
>>> Is this intended?
>> Yes. Otherwise one would need to write var('x') before writing f(x) =  
>> sin(x).
> 
> Wow, Sage will redefine symbols that are already existing to accommodate 
> what should be a dummy variable?  This looks seriously wrong and looks 
> like it could really mess things up.
> 
> For example:
> 
> sage: f(sage) = sin(sage)
> sage: type(sage)
> 
> 
> sage: f(i) = i^2
> sage: type(i)
> 
> sage: i^2
> i^2
> 
> I would strongly prefer that this is wrapped so that a local symbolic 
> variable is used that is not tied to anything, or even just so that the 
> value of x is reset after the function is assigned.  Are we using 
> sage.calculus.calculus.var in the code so that we don't inject into the 
> global namespace, just like the docstring of var says?


To be more clear, currently we have:


sage: preparse('f(x)=sin(x)') 

'_=var("x");f=symbolic_expression(sin(x)).function(x)'

I would strongly prefer this to be

sage: 
_=sage.calculus.calculus.var("y");f=symbolic_expression(sin(_)).function(_)
sage: f
y |--> sin(y)

(or instead of "_", use whatever you can for a temporary variable)

Is there something terrible that would happen in that case?

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: questions about types.

2008-12-03 Thread Simon King

Dear Jason,

On Dec 3, 7:54 pm, Jason Grout <[EMAIL PROTECTED]> wrote:
> Wow, Sage will redefine symbols that are already existing to accommodate
> what should be a dummy variable?  This looks seriously wrong and looks
> like it could really mess things up.

I don't think so. Admittedly I don't like that x is pre-defined, but
here it is something else.
There are Sage constructions which define various things in one line.
For example,
 sage: R.=QQ[]
both defines R *and* z (the latter of type Polynomial_rational_dense).

Similarly, doing
 sage: R(z)=sin(z)
both defines R *and* z (the latter of type SymbolicVariable).

And note that even the notation is consistent: In both examples, you
have two things on the left side of the assignment (R and z) -- and
both things get a (new) assignment.
 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: server issues

2008-12-03 Thread kcrisman

Just wanted to follow up on this for the collective good...

> >> How much memory do you allocate to the virtual server?  Are you sure
> >> that all the memory is being used up?
>
> > My sysadmin says probably 512 MB.
>
> That is not enough.  Could you allocate, say... 4GB instead?

We upped to 1 GB, I believe, and that seems to have helped immensely -
in fact, it is now faster for me to calculate on that copy of Sage and
render on my computer than to do both on my own computer (which is old
and small).  So for a not-big class, not too much memory still works.

>
> c) could easily. Did you set the timeout parameter for the server?
>
>       timeout       -- (default: 0) seconds until idle worksheet sessions
>                              automatically timeout, i.e., the corresponding
>                              Sage session terminates.  0 means 'never 
> timeout'.

That seems to have been the other main problem, and we fixed it.

>
> They are not dumb, and it is very interesting thinking about a
> concrete example of the notebook being used in a constrained environment.

So now I have a healthy class of 30 students successfully using Sage
to explore chaos in calculus!  They sometimes get slowdowns when there
are a number of them on it, but never the total logout except when a
local switch is broken, which is of course not Sage-related.  Even
under quite constrained conditions, it seems to be working quite
nicely.  Imagine how well a Sage lite would work ;)

Thanks,
- kcrisman


--~--~-~--~~~---~--~~
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: A limit question.

2008-12-03 Thread Robert Bradshaw

On Dec 3, 2008, at 10:33 AM, adrian wrote:

> sage: limit(x*0,x=oo)
> 0
> sage: limit(x*oo,x=0)
> 0
>
> This seems wrong to me; and probably the problem is that x*oo should
> not be allowed to begin with...

sage: x*oo
(+Infinity)*x

Yeah, that is worrisome...

- 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: questions about types.

2008-12-03 Thread Jason Grout

Robert Bradshaw wrote:
> On Dec 3, 2008, at 10:28 AM, adrian wrote:
> 
>> In the following code:
>> sage: x=CC['x'].gen()
>> sage: type(x)
>> > 'sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_d 
>> ense_field'>
>> sage: f(x)=sin(x)
>> sage: type(x)
>> 
>>
>> Is this intended?
> 
> Yes. Otherwise one would need to write var('x') before writing f(x) =  
> sin(x).

Wow, Sage will redefine symbols that are already existing to accommodate 
what should be a dummy variable?  This looks seriously wrong and looks 
like it could really mess things up.

For example:

sage: f(sage) = sin(sage)
sage: type(sage)


sage: f(i) = i^2
sage: type(i)

sage: i^2
i^2

I would strongly prefer that this is wrapped so that a local symbolic 
variable is used that is not tied to anything, or even just so that the 
value of x is reset after the function is assigned.  Are we using 
sage.calculus.calculus.var in the code so that we don't inject into the 
global namespace, just like the docstring of var says?

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: sage and tkinter?

2008-12-03 Thread Robert Bradshaw

On Dec 3, 2008, at 10:48 AM, David Joyner wrote:

> But tcl/tk is not a python package. tkinter is the python interface to
> it and it is included with every python distribution (including  
> Sage's).
> The problem is that to import it, tkinter.py looks for tcl/tk using  
> some
> magic I couldn't figure out.
>
> Adrian's suggestion (or William's, and I think now Adam had the  
> right idea too)
> worked: reinstall  Sage's Python using sage -f.
>
> Thanks to all of you for your help.

Sometimes during Python compilation, it looks to see if a certain  
library is available, and if it is it compiles the corresponding  
module, and otherwise simply doesn't. This is what it does, for  
instance, with OpenSSL, and sounds like the same thing with tkinter.  
This matches the behavior we're seeing at least.

- 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: sage and tkinter?

2008-12-03 Thread David Joyner

But tcl/tk is not a python package. tkinter is the python interface to
it and it is included with every python distribution (including Sage's).
The problem is that to import it, tkinter.py looks for tcl/tk using some
magic I couldn't figure out.

Adrian's suggestion (or William's, and I think now Adam had the right idea too)
worked: reinstall  Sage's Python using sage -f.

Thanks to all of you for your help.


On Wed, Dec 3, 2008 at 1:26 PM, Robert Bradshaw
<[EMAIL PROTECTED]> wrote:
>
>
> You could also try installing tcl/tk into sage's copy of python, e.g.
> with sage -python path/to/tk/setup.py install . Trying to let the
> Sage Python see the system Python's libraries may result in binary
> incompatibilities (the versions and flags used to compile them must
> match, which they probably don't).
>
> - 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: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Jason Grout

Robert Bradshaw wrote:
> On Dec 3, 2008, at 5:55 AM, Stan Schymanski wrote:
> 
>> Dear all,
>>
>> Could anyone tell me how to controll the order in which arguments are
>> evaluated when they are passed to python functions? It seems that the
>> functions are evaluated first and then the variables are substituted,
>> which leads to failures in the following example:
> 
> To answer the original question, Python doesn't give control over  
> this. Arguments are always evaluated before passed to the function.  
> (What one can do, as Jason demonstrated, is pass in a function to be  
> evaluated later).

So, bringing up an issue that has come up before, there is no way to do 
the equivalent of the Hold or HoldAll commands in Mma?  See 
http://reference.wolfram.com/mathematica/ref/Hold.html?q=Hold&lang=en 
for example.

It'd still be nice if there were a way to be able to create and deal 
with unevaluated symbolic expressions (for example, if I want to print 
an integral sign by doing latex(hold(integrate(...))) ).  I guess we 
could add yet another feature to the preparser if there was enough demand.

Another way to do it might be to have classes like Integrate (as opposed 
to functions), that represent an integral.  That still wouldn't prevent 
something like Integral(2+3,(x,0,3)) being simplified to 
Integral(5,(x,0,3)), though.

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: questions about types.

2008-12-03 Thread Robert Bradshaw

On Dec 3, 2008, at 10:28 AM, adrian wrote:

> In the following code:
> sage: x=CC['x'].gen()
> sage: type(x)
>  'sage.rings.polynomial.polynomial_element_generic.Polynomial_generic_d 
> ense_field'>
> sage: f(x)=sin(x)
> sage: type(x)
> 
>
> Is this intended?

Yes. Otherwise one would need to write var('x') before writing f(x) =  
sin(x).

- 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: sage and tkinter?

2008-12-03 Thread David Joyner

Thanks Adrian - that worked perfectly!

On Wed, Dec 3, 2008 at 1:07 PM, adrian <[EMAIL PROTECTED]> wrote:
>
> I came accross the same thing a while ago.  In the post "GUI for sage"
> http://groups.google.com/group/sage-support/browse_thread/thread/6cea70d6be0436fa/582b7f836eee9816?lnk=gst&q=tk#582b7f836eee9816
> , William Stein suggested the following:
>
> (1) Make sure you've installed the tk devel package.it's called
>  tk8.4-dev under Ubuntu.(Make sure the tk version is at least
> 8.3.)
>
> (2) Make sure SAGE's Python has Tk support included.   It will
> if you built Python yourself and already had tk8.0-dev installed.
> Otherwise, you'll have to rebuild the Python interpreter included in
> SAGE:
>  sage -i sage -f python-2.5.1.p3
> Here I got the version number as the latest Python package
> listed at SAGE_ROOT/spkg/installed.  One could also look at
>  http://sagemath.org/packages/standard/
>
> I think the order of the  last command is wrong, though, it should be:
> sage -f -i python-2.5.2.p8
>
> (at least with the latest version of the packages)
>
> Hope this helps.
>
> -Adrian
> On Dec 3, 9:11 am, Jaap Spies <[EMAIL PROTECTED]> wrote:
>> David Joyner wrote:
>> > System wide, it works fine:
>>
>> For me it works:
>>
>> --
>> | Sage Version 3.2.1, Release Date: 2008-12-01   |
>> | Type notebook() for the GUI, and license() for information.|
>> --
>>
>> sage: import Tkinter
>>
>> sage: import _tkinter
>>
>> sage:
>>
>> Jaap
> >
>

--~--~-~--~~~---~--~~
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: sage and tkinter?

2008-12-03 Thread Robert Bradshaw

On Dec 3, 2008, at 7:48 AM, David Joyner wrote:

> System wide, it works fine:
>
> [EMAIL PROTECTED]:~/sagefiles/sage-3.2.rc0$ python
> Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22)
> [GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 import _tkinter
 import Tkinter
>
> In Sage it doesn't:
>
> [EMAIL PROTECTED]:~/sagefiles/sage-3.2.rc0$ ./sage -python
> Python 2.5.2 (r252:60911, Nov 12 2008, 08:12:38)
> [GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
> Type "help", "copyright", "credits" or "license" for more information.
 import _tkinter
> Traceback (most recent call last):
>   File "", line 1, in 
> ImportError: No module named _tkinter

>
> I wonder how to modify the Sage python copy of tkinter so that
> it sees the path to the system tcl/tk installation. It's probably a
> matter of adding a path somewhere or modifying an environmental
> variable.

You could also try installing tcl/tk into sage's copy of python, e.g.  
with sage -python path/to/tk/setup.py install . Trying to let the  
Sage Python see the system Python's libraries may result in binary  
incompatibilities (the versions and flags used to compile them must  
match, which they probably don't).

- 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] A limit question.

2008-12-03 Thread adrian

sage: limit(x*0,x=oo)
0
sage: limit(x*oo,x=0)
0

This seems wrong to me; and probably the problem is that x*oo should
not be allowed to begin with...

-Adrian.
--~--~-~--~~~---~--~~
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: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Robert Bradshaw

On Dec 3, 2008, at 5:55 AM, Stan Schymanski wrote:

> Dear all,
>
> Could anyone tell me how to controll the order in which arguments are
> evaluated when they are passed to python functions? It seems that the
> functions are evaluated first and then the variables are substituted,
> which leads to failures in the following example:

To answer the original question, Python doesn't give control over  
this. Arguments are always evaluated before passed to the function.  
(What one can do, as Jason demonstrated, is pass in a function to be  
evaluated later).

- 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] questions about types.

2008-12-03 Thread adrian

In the following code:
sage: x=CC['x'].gen()
sage: type(x)

sage: f(x)=sin(x)
sage: type(x)


Is this intended?

--~--~-~--~~~---~--~~
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: Error when launching Sage

2008-12-03 Thread adrian

I got the same problem.  In ubuntu amd 64 hardy, I got the following
missing:

pebs ssse3 pge clflush sep syscall vme tsc est vmx xtpr nx
constant_tsc pat bts lm msr fpu fxsr tm pae arch_perfmon acpi cx8 mce
de mca pse rep_good ht apic dca monitor lahf_lm tm2 ss ds_cpl pbe cx16
pse36 mtrr dts

shall I do something?

-Adrian.
On Nov 28, 12:57 pm, Jeffrey Straszheim <[EMAIL PROTECTED]>
wrote:
> That appears to have worked.
>
> Thank you.
>
>
>
> > You have hit a bug introduce by accident via #3761.
>
> > Edit the file $SAGE_ROOT/local/lib/sage-flags.txt and remove the "nx"
> > and "up" flag.
> > 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: sage and tkinter?

2008-12-03 Thread adrian

I came accross the same thing a while ago.  In the post "GUI for sage"
http://groups.google.com/group/sage-support/browse_thread/thread/6cea70d6be0436fa/582b7f836eee9816?lnk=gst&q=tk#582b7f836eee9816
, William Stein suggested the following:

(1) Make sure you've installed the tk devel package.it's called
 tk8.4-dev under Ubuntu.(Make sure the tk version is at least
8.3.)

(2) Make sure SAGE's Python has Tk support included.   It will
if you built Python yourself and already had tk8.0-dev installed.
Otherwise, you'll have to rebuild the Python interpreter included in
SAGE:
  sage -i sage -f python-2.5.1.p3
Here I got the version number as the latest Python package
listed at SAGE_ROOT/spkg/installed.  One could also look at
  http://sagemath.org/packages/standard/

I think the order of the  last command is wrong, though, it should be:
sage -f -i python-2.5.2.p8

(at least with the latest version of the packages)

Hope this helps.

-Adrian
On Dec 3, 9:11 am, Jaap Spies <[EMAIL PROTECTED]> wrote:
> David Joyner wrote:
> > System wide, it works fine:
>
> For me it works:
>
> --
> | Sage Version 3.2.1, Release Date: 2008-12-01   |
> | Type notebook() for the GUI, and license() for information.|
> --
>
> sage: import Tkinter
>
> sage: import _tkinter
>
> sage:
>
> Jaap
--~--~-~--~~~---~--~~
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: Factorization class

2008-12-03 Thread Tim Lahey

Ah,

I think I see what you're doing. Thanks for the explanation.

Cheers,

Tim.


On Dec 3, 2008, at 6:04 AM, Simon King wrote:



Dear Tim,

perhaps the following is a better explanation.

In the above situation, "for X in F" yields a list of pairs (x-1,2),  
(x

+1,2) etc. In particular, X is not a polynomial. It is a pair, formed
by a polynomial and a number.

Hence, I am *not* applying a function called "Factorization" to some
polynomial. "Factorization" is the constructor for an object of type
. It takes as
input a list of pairs.

"Factorization" does *not* try to factorize the input any further! So,
if you feed it with a reducible polynomial, it simply swallows it:
sage: Factorization([(x^2+2*x+1,3)])
(x^2 + 2*x + 1)^3

And when I define Factorization([X]), the output is guaranteed to
coincide with (X[0]^X[1]).factor(), by construction of X.
Yours,
   Simon




smime.p7s
Description: S/MIME cryptographic signature


[sage-support] Re: sage and tkinter?

2008-12-03 Thread Jaap Spies

David Joyner wrote:
> System wide, it works fine:
> 

For me it works:

--
| Sage Version 3.2.1, Release Date: 2008-12-01   |
| Type notebook() for the GUI, and license() for information.|
--

sage: import Tkinter

sage: import _tkinter

sage:


Jaap


--~--~-~--~~~---~--~~
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: FYI............"broken web link"

2008-12-03 Thread Harald Schilly

Uhm, thx. I didn't thought about the mirrors. This is the correct url:
http://www.sagemath.org/doc/paper-letter/

It's also outdated, I should find the updates ;)

H

On Dec 3, 12:57 am, "Kevin Loranger" <[EMAIL PROTECTED]> wrote:
> http://modular.math.washington.edu/sage/paper-letter/
>
> Kevin
--~--~-~--~~~---~--~~
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: sage and tkinter?

2008-12-03 Thread David Joyner

System wide, it works fine:

[EMAIL PROTECTED]:~/sagefiles/sage-3.2.rc0$ python
Python 2.5.2 (r252:60911, Jul 31 2008, 17:31:22)
[GCC 4.2.3 (Ubuntu 4.2.3-2ubuntu7)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _tkinter
>>> import Tkinter

In Sage it doesn't:

[EMAIL PROTECTED]:~/sagefiles/sage-3.2.rc0$ ./sage -python
Python 2.5.2 (r252:60911, Nov 12 2008, 08:12:38)
[GCC 4.2.4 (Ubuntu 4.2.4-1ubuntu3)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import _tkinter
Traceback (most recent call last):
  File "", line 1, in 
ImportError: No module named _tkinter
>>>

I wonder how to modify the Sage python copy of tkinter so that
it sees the path to the system tcl/tk installation. It's probably a
matter of adding a path somewhere or modifying an environmental
variable.



On Wed, Dec 3, 2008 at 10:43 AM, Adam Webb <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> Do you have tcl-devel and tk-devel installed? I would expect that
> these are also needed when python is being built.
>
> Adam
>
> On Dec 3, 2:50 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
>> Hi:
>>
>> I wonder if anyone here knows how to get sage's python to recognize
>> tcl/tk? In other words, I would like
>> sage: import _tkinter
>> and
>> sage: import Tkinter
>> to work and not raise an ImportError.
>>
>> BTW, tcl/tk 8,4 is installed:
>>
>> [EMAIL PROTECTED]:~/sagefiles/sage-3.2.rc0$ whereis tcl
>> tcl: /usr/lib/tcl8.4 /usr/lib64/tcl8.4 /usr/include/tcl8.4
>>
>> - 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: sage and tkinter?

2008-12-03 Thread Adam Webb

Hi,

Do you have tcl-devel and tk-devel installed? I would expect that
these are also needed when python is being built.

Adam

On Dec 3, 2:50 pm, "David Joyner" <[EMAIL PROTECTED]> wrote:
> Hi:
>
> I wonder if anyone here knows how to get sage's python to recognize
> tcl/tk? In other words, I would like
> sage: import _tkinter
> and
> sage: import Tkinter
> to work and not raise an ImportError.
>
> BTW, tcl/tk 8,4 is installed:
>
> [EMAIL PROTECTED]:~/sagefiles/sage-3.2.rc0$ whereis tcl
> tcl: /usr/lib/tcl8.4 /usr/lib64/tcl8.4 /usr/include/tcl8.4
>
> - 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: passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Jason Grout

Stan Schymanski wrote:
> Dear all,
> 
> Could anyone tell me how to controll the order in which arguments are
> evaluated when they are passed to python functions? It seems that the
> functions are evaluated first and then the variables are substituted,
> which leads to failures in the following example:
> 
> var('c')
> 
> def piece(c,x):
> if x < 1.:
> return c*x^2
> if x >= 1.:
> return 1/x-c
> 
> plot(piece(0.2,x),0,2)
> Traceback (click to the left for traceback)
> ...
> TypeError: no way to make fast_float from None
> 
> numerical_integral(piece(0.2,x),0,2)
> Traceback (click to the left for traceback)
> ...
> TypeError: a float is required
> 
> How can I get sage to substitute the values for x before calling piece
> (0.2,x)?

You are correct.  In both of these cases, you are calling piece(0.2,x) 
and putting that result in for the first argument of plot and 
numerical_integral.  Instead, you want the first argument to be a call 
to piece(0.2,x), so put a function in that returns piece, rather than 
putting piece in there that returns an expression.

There are several ways to do this (these below are not comprehensive):

Note that I define your function slightly more efficiently (I only 
compare x once)

sage: def piece(c,x):
: if x<1.:
: return c*x^2
: else:
: return 1/x-c
:

Now I put in the first argument a function which calls piece for every 
input value.

sage: plot(lambda x: piece(0.2,x), 0, 2)

Another way to do it is to use the partial function in the functools 
module.  This basically does the same thing as above, but seems more 
efficient.

sage: from functools import partial
sage: piece02 = partial(piece, 0.2)
sage: piece02(2)
0.300
sage: plot(piece02, 0, 2)


Unfortunately, we haven't extended fast_float to handle an if statement, 
so fast_float won't work on the above example.  Well, except that we 
could use fast_float inside of our piecewise function.

sage: f1 = lambda x: piece(0.2,x)
sage: f2 = partial(piece,0.2)
sage: from sage.ext.fast_eval import fast_float
sage: subf1 = fast_float(c*x^2, 'c', 'x')
sage: subf2 = fast_float(1/x-c, 'c', 'x')
sage: def piece_ff(c,x):
: if xhttp://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] passing arguments to python functions in numerical_integral, plot etc.

2008-12-03 Thread Stan Schymanski

Dear all,

Could anyone tell me how to controll the order in which arguments are
evaluated when they are passed to python functions? It seems that the
functions are evaluated first and then the variables are substituted,
which leads to failures in the following example:

var('c')

def piece(c,x):
if x < 1.:
return c*x^2
if x >= 1.:
return 1/x-c

plot(piece(0.2,x),0,2)
Traceback (click to the left for traceback)
...
TypeError: no way to make fast_float from None

numerical_integral(piece(0.2,x),0,2)
Traceback (click to the left for traceback)
...
TypeError: a float is required

How can I get sage to substitute the values for x before calling piece
(0.2,x)?

Thanks for your help!

Stan
--~--~-~--~~~---~--~~
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] sage and tkinter?

2008-12-03 Thread David Joyner

Hi:

I wonder if anyone here knows how to get sage's python to recognize
tcl/tk? In other words, I would like
sage: import _tkinter
and
sage: import Tkinter
to work and not raise an ImportError.

BTW, tcl/tk 8,4 is installed:

[EMAIL PROTECTED]:~/sagefiles/sage-3.2.rc0$ whereis tcl
tcl: /usr/lib/tcl8.4 /usr/lib64/tcl8.4 /usr/include/tcl8.4

- 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: parametric_plot3d with imaginary numbers

2008-12-03 Thread Marshall Hampton

Mathematica does have some extra abilities in 3D graphics compared
with Sage.  We do have the infrastructure in place to catch up though,
I hope to help with things like this soon.

I think for your example Sage isn't handling the multiple roots
properly; I'm not sure how to really fix that but I did do the
following and got closer:

u, v = var('u,v')
assume(u>0)
p15 = sum([parametric_plot3d((u*cos(v),u*sin(v),imaginary(u^(1/5.0)*exp
(I*v+q*2*I*pi/5))), (u,0,2), (v,0,2*pi), opacity = .5, rgbcolor =
(0,1,0), frame = False) for q in range(5)])
show(p15)

which I think is pretty close to the mathematica plot except it
includes the entire surface by default.

Hope that helps,
M. Hampton

On Dec 2, 7:20 pm, acardh <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I am not sure why I am not getting the same 3D image than the one at
> the bottom of the next 
> page:http://reference.wolfram.com/mathematica/ref/ParametricPlot3D.html
>
> I am using these commands:
> u, v = var('u,v')
> parametric_plot3d((u*cos(v),u*sin(v),imaginary(u*exp((I*v)^5)^(1/5))),
> (u,0,2), (v,0,2*pi))
--~--~-~--~~~---~--~~
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: Factorization class

2008-12-03 Thread John Cremona

Does this help?

sage: n=factorial(30)
sage: [Factorization([pe]) for pe in n.factor()]
[2^26, 3^14, 5^7, 7^4, 11^2, 13^2, 17, 19, 23, 29]


sage: x = polygen(GF(3))
sage: f = cyclotomic_polynomial(120)(x)
sage: [Factorization([pe]) for pe in f.factor()]

[(x^4 + x^2 + x + 1)^2,
 (x^4 + x^2 + 2*x + 1)^2,
 (x^4 + x^3 + x^2 + 1)^2,
 (x^4 + 2*x^3 + x^2 + 1)^2]

John Cremona

On Dec 3, 9:57 am, Tim Lahey <[EMAIL PROTECTED]> wrote:
> On Dec 3, 2008, at 4:50 AM, Simon King wrote:
>
>
>
>
>
> > Dear Tim,
>
> > On Dec 3, 7:15 am, Tim Lahey <[EMAIL PROTECTED]> wrote:
> > 
> >> No, because I want instead of something like
> >> [(x-2,2),(x-3,3)]
>
> >> I'd like
> >> [(x-2)^2,(x-3)^3]
>
> > You may do this:
> > Start with a factorization of something:
> >sage: f=factor(16200)
> >sage: f
> >2^3 * 3^4 * 5^2
>
> > "for X in f" means that X runs over the pairs (2,3), (3,4), (5,2). And
> > out of such pairs you can construct a factorization for each prime
> > power, i.e.:
> >sage: [Factorization([X]) for X in f]
> >[2^3, 3^4, 5^2]
> > Is this what you wanted?
>
> Yes, and it's what someone else told me earlier in this thread. However,
> in the case of polynomials one has to be careful that it isn't expanded
> when raising to the power.
>
> Thanks,
>
> Tim.
>
> ---
> Tim Lahey
> PhD Candidate, Systems Design Engineering
> University of Waterloohttp://www.linkedin.com/in/timlahey
>
>  smime.p7s
> 3KViewDownload
--~--~-~--~~~---~--~~
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: Factorization class

2008-12-03 Thread Simon King

Dear Tim,

perhaps the following is a better explanation.

In the above situation, "for X in F" yields a list of pairs (x-1,2), (x
+1,2) etc. In particular, X is not a polynomial. It is a pair, formed
by a polynomial and a number.

Hence, I am *not* applying a function called "Factorization" to some
polynomial. "Factorization" is the constructor for an object of type
. It takes as
input a list of pairs.

"Factorization" does *not* try to factorize the input any further! So,
if you feed it with a reducible polynomial, it simply swallows it:
sage: Factorization([(x^2+2*x+1,3)])
(x^2 + 2*x + 1)^3

And when I define Factorization([X]), the output is guaranteed to
coincide with (X[0]^X[1]).factor(), by construction of X.
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: Factorization class

2008-12-03 Thread Simon King

Dear Tim,

On Dec 3, 10:57 am, Tim Lahey <[EMAIL PROTECTED]> wrote:
-- snip --
> Yes, and it's what someone else told me earlier in this thread.

Where? I only found your own suggestion [(i^j).factor() for i,j in f].
But this is likely not a good idea, because
 * i^j is computed (may take time),
 * the result is factorized (may take even more time), and
 * eventually only yields what you already knew, namely i and j.

> However,
> in the case of polynomials one has to be careful that it isn't expanded
> when raising to the power.

No. It works the same way.
sage: R. = ZZ[]
sage: f = x**10-1
sage: F = (f^2).factor() ; F
(x - 1)^2 * (x + 1)^2 * (x^4 - x^3 + x^2 - x + 1)^2 * (x^4 + x^3 + x^2
+ x + 1)^2
sage: [Factorization([X]) for X in F]
[(x - 1)^2,
 (x + 1)^2,
 (x^4 - x^3 + x^2 - x + 1)^2,
 (x^4 + x^3 + x^2 + x + 1)^2]

You see the difference? Your suggestion was to compute X[0]^X[1] and
then to apply factorization to it. My suggestion was to simply
*define* (not compute!!) the factorization.
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: Factorization class

2008-12-03 Thread Tim Lahey


On Dec 3, 2008, at 4:50 AM, Simon King wrote:



Dear Tim,

On Dec 3, 7:15 am, Tim Lahey <[EMAIL PROTECTED]> wrote:


No, because I want instead of something like
[(x-2,2),(x-3,3)]

I'd like
[(x-2)^2,(x-3)^3]


You may do this:
Start with a factorization of something:
   sage: f=factor(16200)
   sage: f
   2^3 * 3^4 * 5^2

"for X in f" means that X runs over the pairs (2,3), (3,4), (5,2). And
out of such pairs you can construct a factorization for each prime
power, i.e.:
   sage: [Factorization([X]) for X in f]
   [2^3, 3^4, 5^2]
Is this what you wanted?


Yes, and it's what someone else told me earlier in this thread. However,
in the case of polynomials one has to be careful that it isn't expanded
when raising to the power.  

Thanks,

Tim.

---
Tim Lahey
PhD Candidate, Systems Design Engineering
University of Waterloo
http://www.linkedin.com/in/timlahey

smime.p7s
Description: S/MIME cryptographic signature


[sage-support] Re: Factorization class

2008-12-03 Thread Simon King

Dear Tim,

On Dec 3, 7:15 am, Tim Lahey <[EMAIL PROTECTED]> wrote:

> No, because I want instead of something like
> [(x-2,2),(x-3,3)]
>
> I'd like
> [(x-2)^2,(x-3)^3]

You may do this:
Start with a factorization of something:
sage: f=factor(16200)
sage: f
2^3 * 3^4 * 5^2

"for X in f" means that X runs over the pairs (2,3), (3,4), (5,2). And
out of such pairs you can construct a factorization for each prime
power, i.e.:
sage: [Factorization([X]) for X in f]
[2^3, 3^4, 5^2]

Is this what you wanted?
Best regards,
   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: prevent complex numbers ?

2008-12-03 Thread Burcin Erocal

On Tue, 2 Dec 2008 15:11:19 -0800 (PST)
Stan Schymanski <[EMAIL PROTECTED]> wrote:

> 
> Hi Robert,
> 
> On Dec 2, 5:50 am, Robert Bradshaw <[EMAIL PROTECTED]>
> wrote:
> 
> > Are you saying you would like to pass in a domain when creating the
> > variables? Something like
> >
> > sage: var('omega', domain=RR)
> 
> YES, that would be great.

This is on the todo list for the pynac symbolics:

http://wiki.sagemath.org/symbolics/pynac_todo

as

 * symbol domains (ginac supports real, complex, integer) 

I hope to start working on pynac again in a couple of weeks.


Cheers,

Burcin

--~--~-~--~~~---~--~~
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 numerical_integral?

2008-12-03 Thread Stan Schymanski

Dear Robert,

Thanks a lot for the ultra-quick solution! Sorry about that, should have 
looked more closely at the docstring.

Cheers
Stan

Robert Bradshaw wrote:
> No, it's an inconsistency in the interface. numerical_integral  
> assumes a single free variable, so it doesn't accept that as an  
> option. See the docstring. The error should be much better.
>
> sage: numerical_integral(250*cos(pi*x/180)^1.8 + 170.35,0,18)
> (7435.2795815640275, 8.2548185859776822e-11)
>
> - 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: bug in numerical_integral?

2008-12-03 Thread Robert Bradshaw

On Dec 3, 2008, at 12:46 AM, Stan Schymanski wrote:

>
> There seems to be a bug in numerical_integral in sage 3.2:
>
> --
> | Sage Version 3.2, Release Date: 2008-11-20 |
> | Type notebook() for the GUI, and license() for information.|
> --
>
> sage: numerical_integral(250*cos(pi*x/180)^1.8 + 170.35,x,
> 0,18)
> ERROR: An unexpected error occurred while tokenizing input
> The following traceback may be corrupted or invalid
> The error message is: ('EOF in multi-line statement', (308, 0))
>
> -- 
> -
> TypeError Traceback (most recent call
> last)
>
> /Users/sschym/ in ()
>
> /Users/sschym/Programs/sage/local/lib/python2.5/site-packages/sage/ 
> gsl/
> integration.so in sage.gsl.integration.numerical_integral (sage/gsl/
> integration.c:1989)()
>
> TypeError: invalid integration algorithm
>
>
> Or is this a problem with my installation of sage?

No, it's an inconsistency in the interface. numerical_integral  
assumes a single free variable, so it doesn't accept that as an  
option. See the docstring. The error should be much better.

sage: numerical_integral(250*cos(pi*x/180)^1.8 + 170.35,0,18)
(7435.2795815640275, 8.2548185859776822e-11)

- 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] bug in numerical_integral?

2008-12-03 Thread Stan Schymanski

There seems to be a bug in numerical_integral in sage 3.2:

--
| Sage Version 3.2, Release Date: 2008-11-20 |
| Type notebook() for the GUI, and license() for information.|
--

sage: numerical_integral(250*cos(pi*x/180)^1.8 + 170.35,x,
0,18)
ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (308, 0))

---
TypeError Traceback (most recent call
last)

/Users/sschym/ in ()

/Users/sschym/Programs/sage/local/lib/python2.5/site-packages/sage/gsl/
integration.so in sage.gsl.integration.numerical_integral (sage/gsl/
integration.c:1989)()

TypeError: invalid integration algorithm


Or is this a problem with my installation of sage?

Cheers
Stan
--~--~-~--~~~---~--~~
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] numerical evaluation of integral?

2008-12-03 Thread Stan Schymanski

Dear all,

I would like to evaluate a symbolic equation containing an integral
numerically:
((integrate(250*cos(pi*x/180)^1.8 + 170.35,x,0,18)/a_v)(a_v=1)).n()
does not work. Is there a way of doing this? The real equation is a
lot longer than the above, so I am looking for a simple automatic way.
Usually, if I substitute all symbolic variables with numerical values,
the function just evaluates to a number, but if I have a symbolic
integral in there, it does not work.

Thanks for your help!

Stan
--~--~-~--~~~---~--~~
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
-~--~~~~--~~--~--~---