Re: [sage-support] Re: adding noise

2010-04-03 Thread Robert Bradshaw

On Apr 2, 2010, at 9:41 PM, G B wrote:

Thanks for the detailed response, Simon.  Please understand that I'm  
not being critical of Sage-- quite the contrary, I'm excited about  
what it might offer me once I master it.


I think you touch on one key to the problem-- I'm not a  
mathematician, I'm an engineer.  While most of the world would  
certainly accuse us of being sloppy dressers, mathematicians are one  
of the few groups that can legitimately accuse us of being sloppy  
thinkers.  I think that brand of sloppy thinking is what is at issue  
here, and when I say work around I mean become tolerant of.


Sage has already encouraged me to learn more about ring theory than  
I ever would have needed otherwise, but getting completely different  
results when executing plot(f(x),(x,0,2*pi)) vs. executing plot(f, 
(0,2*pi)) started playing on my patience a bit and has me wondering  
if I'm simply using an irreconcilably wrong tool for the job.  I  
think the intention of both of those statements is the same, and  
thus should yield the same result, and my suspicion is that the  
reason they don't is an artifact of the plumbing, but I may be  
missing something.


A good way to think about it is this: Python expressions are evaluated  
greedily, from the inside out. Thus


sage: plot(f(x),(x,0,2*pi))

is the same as

sage: A = f(x)# A is now sin(x) + 0.619...
sage: B = (x,0,2*pi)
sage: plot(A, B)

When you write something like sin(x), sin is actually getting called  
with the argument x, and the result is sin evaluated at the  
indeterminate x (in other words, it's not just returning the old thing  
back again). As a more concrete example.


sage: g(x) = sin(x) + sqrt(x)
sage: g(x)
sqrt(x) + sin(x)  # g was called with x and plugged in x for x
sage: g(5)
sqrt(5) + sin(5)
sage: var('y')
y
sage: g(y)
sqrt(y) + sin(y)
sage: g(x+y)
sqrt(x + y) + sin(x + y)


It's not the f(x)=sin(x)+T.get_random_element() form that troubles  
me though, for the record, I did try 'f(x)=sin(x) 
+T.get_random_element(x)'.  Expectedly, it doesn't like having an  
unwanted argument shoved down its throat.


What still feels awkward to me is how constructs like this behave:
var('x')
T=RealDistribution('gaussian',1)
f=lambda x: T.get_random_element()
g(x)=sin(x)+f(x)

To my mind, the way that is handled is particularly confusing.
[f(1),f(2),f(3)]  -- [-0.568652852118, 0.912307924442, 1.35997405644]

but,
[g(1),g(2),g(3)]  -- [sin(1) - 0.176035204293, sin(2) -  
0.176035204293, sin(3) - 0.176035204293]


In other words, calling f repeatedly gives different results each  
time, but calling g repeatedly does not.


That may be a case where the parenthetical syntax conspires with the  
overloaded meanings of function to expose my sloppy thinking, but  
it also kind of looks like a trap waiting to be triggered.


If sin(x) and f(x) are fundamentally different entities, and my  
engineering mind isn't completely convinced that they should be,


Yes, they are very different. The first are expression-like  
functions, where it makes sense to differentiate, integrate, typeset,  
and otherwise manipulate them as mathematical objects. Sin falls  
into this category. The other type are procedures which are are  
really arbitrary chunks of code which are the ones native to Python  
(and essentially every other procedural programming language). These  
are the ones that generate random numbers, test for primality, fetch  
webpages, save files, etc. Plot itself is such a function. It  
doesn't makes much sense to differentiate or typeset such functions,  
but they can be called.


Both types of functions are clearly essential, the confusion arises in  
the fact that it's possible to evaluate (and, sometimes, plot) both  
kinds. That being said, I think it should easier (and more natural) to  
try to do what you're trying to do here.


then the syntax should prevent the construction of g in such a  
manner.  Either execution of f should be deferred until g is called  
with a parameter, as I would expect, or an error should be thrown  
for providing illegal arguments to operator '+'.


The problem is that the two terms are evaluated before the + operator  
is hit, i.e.


sage: g(x) = sin(x) + f(x)

is the same as

sage: A = sin(x)   # actually calls sin (resulting in sin(x))
sage: B = f(x)   # actually calls f (resulting in 0.619)
sage: g(x) = A + B   # tries to add (which is just fine)

If I want g(x) defined as sin(x) plus the result of f(x) as x is  
defined at the definition of g, then the syntax should highlight  
that by forcing something like g(x)=sin(x) + `f(x)`


To get something deferred, which sounds like what you want, you could  
abandon the g(x) = ... syntax completely and always use lambda (or def)


sage: g = lambda x: sin(x) + f(x)

or

sage: def g(x):
...return sin(x) + f(x)


It may take some getting used to, but functions can even return other  
functions. For example, you 

[sage-support] Re: Print only outputs?

2010-04-03 Thread ma...@mendelu.cz
Another solution, different from the previous ones is to convert sws
file to pdf using sws2tex - http://bitbucket.org/whuss/sws2tex/

It should be trivial to hack the python or TeX code to remove the
content of input cells.

example of the output is http://user.mendelu.cz/marik/sage/as.pdf

Robert Marik

On 1 dub, 19:27, Eugene Goldberg omegat...@gmail.com wrote:
 Hi!

 Is it possible to print only output content of worksheet?

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

To unsubscribe, reply using remove me as the subject.


[sage-support] List of standard functions?

2010-04-03 Thread bb
I screened all of the offered documents from the sgaemath-page to find a 
list of the offered standard-functions - no success! May be there is a 
table or list about that but I just could not find it? Screening the 
index is one possibility, but does not make me really happy.


Tnx BB

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

To unsubscribe, reply using remove me as the subject.


Re: [sage-support] List of standard functions?

2010-04-03 Thread Tim Joseph Dumol
Hi,

Do you mean something like these:

http://wiki.sagemath.org/quickref

?

Otherwise, the reference manual http://sagemath.org/doc/reference/ has a
full list.

On Sat, Apr 3, 2010 at 11:32 PM, bb bblo...@arcor.de wrote:

 I screened all of the offered documents from the sgaemath-page to find a
 list of the offered standard-functions - no success! May be there is a table
 or list about that but I just could not find it? Screening the index is one
 possibility, but does not make me really happy.

 Tnx BB

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

 To unsubscribe, reply using remove me as the subject.




-- 
Tim Joseph Dumol tim (at) timdumol (dot) com
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: List of standard functions?

2010-04-03 Thread Simon King
Hi!

Question out of ignorance: What do you mean by a 'standard function'?
Is it calculus stuff such as sin and cos, or do you mean Python
functions?

If it is the latter, you may get a list of all callable objects in the
global name space by
  sage: F = [f for f in globals().values() if callable(f)]

If it is the former: Sorry, I am more into algebra, and mathematically
I am no friend of standardised knowledge.

Best regards,
Simon

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

To unsubscribe, reply using remove me as the subject.


[sage-support] Re: List of standard functions?

2010-04-03 Thread Alec Mihailovs
On Apr 3, 11:55 am, Simon King simon.k...@nuigalway.ie wrote:

   sage: F = [f for f in globals().values() if callable(f)]

I would write it as

filter(callable, globals().values())

Alec

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

To unsubscribe, reply using remove me as the subject.


[sage-support] operands and expresssion

2010-04-03 Thread pallab
let us do,

f=function('f',x)
expr=f(x)
expr.operands()

the out put is,

[x]

Is it a bug?, I expect [f(x)].

using,

f=function('f',x)
expr=2*f(x)
expr.operands()

correctly gives,

[f(x),2]

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

To unsubscribe, reply using remove me as the subject.


[sage-support] derivative instance

2010-04-03 Thread pallab
Is there any way to check whether a symbolic expression is a
derivative. Like,

isinstance(diff(f(x),x),what to put?)

gives True

and

isinstance(f(x),what to put?)

gives false, assuming f is not a derivative itself.

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

To unsubscribe, reply using remove me as the subject.


Re: [sage-support] operands and expresssion

2010-04-03 Thread Mike Hansen
On Sat, Apr 3, 2010 at 11:15 AM, pallab pallabb...@gmail.com wrote:
 let us do,

 f=function('f',x)
 expr=f(x)
 expr.operands()

 the out put is,

 [x]

 Is it a bug?,

No, it's not a bug since the operator is the function f:

sage: f.operator()
f

--Mike

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

To unsubscribe, reply using remove me as the subject.


[sage-support] Re: derivative instance

2010-04-03 Thread ma...@mendelu.cz
What kind of behavior do you expect from the following command?

isinstance(diff(sin(x),x),what to put?)

Robert

On 3 dub, 20:32, pallab pallabb...@gmail.com wrote:
 Is there any way to check whether a symbolic expression is a
 derivative. Like,

 isinstance(diff(f(x),x),what to put?)

 gives True

 and

 isinstance(f(x),what to put?)

 gives false, assuming f is not a derivative itself.

-- 
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: sageplot and includegraphics3-... SOLVED

2010-04-03 Thread ma...@mendelu.cz
Hi Dan and Georg

On 1 dub, 01:37, Dan Drake dr...@kaist.edu wrote:

 Ah, this is very nice. I was going to reply and say that rewriting
 \sageplot to parse things like \sageplot-3{...} would be very hard
 (for me, at least; I'm not much of a TeX guru) but now I can put a
 reference to this into the SageTeX manual.


I can help you to find the correct redefinition of sageplot command,
if you are interested. It should be also simple to do this
automatically by SageTeX whenever beamer class is used. But I think
that this is not a good method. WHY? If the slide contains 10 layers
and we put the graphics from the third layer, we have to generate the
graphics file 7 times! We end up with 7 identical pictures which slow
down the compilation by Sage and the resulting PDF file is too big.

The user should be encouraged to prepare pictures for PDF presentation
separately and use a convenient method to insert these pictures. For
example, there are methods which insert a picture in PDF file only
once, even if it is used on many places. But these topics are not
related to Sage and should be probably discussed somewhere on TeX
group.

Robert

 Dan

 --
 ---  Dan Drake
 -  http://mathsci.kaist.ac.kr/~drake
 ---

  signature.asc
  1KZobrazitStáhnout

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

To unsubscribe, reply using remove me as the subject.


[sage-support] Re: derivative instance

2010-04-03 Thread pallab
I do not know. If it is already evaluated to cos(x) then it should be
true. current sympy gives false, I think I
would go with it.

On Apr 3, 11:36 am, ma...@mendelu.cz ma...@mendelu.cz wrote:
 What kind of behavior do you expect from the following command?

 isinstance(diff(sin(x),x),what to put?)

 Robert

 On 3 dub, 20:32, pallab pallabb...@gmail.com wrote:

  Is there any way to check whether a symbolic expression is a
  derivative. Like,

  isinstance(diff(f(x),x),what to put?)

  gives True

  and

  isinstance(f(x),what to put?)

  gives false, assuming f is not a derivative itself.

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

To unsubscribe, reply using remove me as the subject.


[sage-support] Re: derivative instance

2010-04-03 Thread pallab
I mean...
I do not know. If it is already evaluated to cos(x) then it should be
 false (not *true*). current sympy gives false, I think I would go
with it.


On Apr 3, 11:51 am, pallab pallabb...@gmail.com wrote:


 On Apr 3, 11:36 am, ma...@mendelu.cz ma...@mendelu.cz wrote:

  What kind of behavior do you expect from the following command?

  isinstance(diff(sin(x),x),what to put?)

  Robert

  On 3 dub, 20:32, pallab pallabb...@gmail.com wrote:

   Is there any way to check whether a symbolic expression is a
   derivative. Like,

   isinstance(diff(f(x),x),what to put?)

   gives True

   and

   isinstance(f(x),what to put?)

   gives false, assuming f is not a derivative itself.

-- 
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: derivative instance

2010-04-03 Thread Alec Mihailovs
On Apr 3, 2:32 pm, pallab pallabb...@gmail.com wrote:
 Is there any way to check whether a symbolic expression is a
 derivative. Like,

 isinstance(diff(f(x),x),what to put?)

 gives True

 and

 isinstance(f(x),what to put?)

 gives false, assuming f is not a derivative itself.

One can do the following, for example,

def is_diff(expr):
try:
return isinstance(expr.operator(),
sage.symbolic.operators.FDerivativeOperator)
except (AttributeError):
return False

Alec Mihailovs

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

To unsubscribe, reply using remove me as the subject.


[sage-support] Re: Print only outputs?

2010-04-03 Thread Alec Mihailovs

On Apr 2, 11:47 pm, William Stein wst...@gmail.com wrote:

 That's pretty clever!  

Thank you!

 Is amazing how flexible the notebook is, since
 it uses HTML instead of ReST...  (yes, I know, it's flexible enough to
 support cross-site scripting attacks too).

That's the same as with other CAS. In particular, I can write a line
of code in the Maple worksheet, with autoexecute, which would format
the hard drive (erasing all files on it), immediately after opening
that worksheet, and there nothing could be done by the person opening
that worksheet to prevent that (other than opening it in a secure
mode, i.e. with switch -Z if I remember correctly, which not that many
people use.)

Alec

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

To unsubscribe, reply using remove me as the subject.


[sage-support] Is there any way to get old VMware versions?

2010-04-03 Thread Rob
I've officially given up on ever getting VirtualBox to work properly
on my netbook (I'm pretty sure it's just a memory issue), so I'd like
to go back to the last VMware version (4.1.2, I guess).

I can find where to find the source code for the old versions, but
I've looked all over sagemath.org and can't find anywhere to download
prebuilt copies.  I suppose it has to be possible theoretically to
build it from source, but that type of stuff is well beyond me.

Is there anyway to get a copy of 4.1.2?  Or, alternately, a very
detailed list of instructions written for total idiots describing how
to create one from the source code?

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

To unsubscribe, reply using remove me as the subject.


Re: [sage-support] Is there any way to get old VMware versions?

2010-04-03 Thread William Stein
Hi,

Coincidentally, I gave up on using virtualbox for sage-windows. The
next version will be vmware based.  Expect this early next week.

On Saturday, April 3, 2010, Rob furit...@gmail.com wrote:
 I've officially given up on ever getting VirtualBox to work properly
 on my netbook (I'm pretty sure it's just a memory issue), so I'd like
 to go back to the last VMware version (4.1.2, I guess).

 I can find where to find the source code for the old versions, but
 I've looked all over sagemath.org and can't find anywhere to download
 prebuilt copies.  I suppose it has to be possible theoretically to
 build it from source, but that type of stuff is well beyond me.

 Is there anyway to get a copy of 4.1.2?  Or, alternately, a very
 detailed list of instructions written for total idiots describing how
 to create one from the source code?

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

 To unsubscribe, reply using remove me as the subject.


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

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
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: operands and expresssion

2010-04-03 Thread pallab
I got it :), thanks.

On Apr 3, 11:34 am, Mike Hansen mhan...@gmail.com wrote:
 On Sat, Apr 3, 2010 at 11:15 AM, pallab pallabb...@gmail.com wrote:
  let us do,

  f=function('f',x)
  expr=f(x)
  expr.operands()

  the out put is,

  [x]

  Is it a bug?,

 No, it's not a bug since the operator is the function f:

 sage: f.operator()
 f

 --Mike

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

To unsubscribe, reply using remove me as the subject.


[sage-support] Re: Is there any way to get old VMware versions?

2010-04-03 Thread Rob
I'm VERY glad to hear that. I'll hang on until the next release then.

Thanks!

On Apr 3, 6:13 pm, William Stein wst...@gmail.com wrote:
 Hi,

 Coincidentally, I gave up on using virtualbox for sage-windows. The
 next version will be vmware based.  Expect this early next week.



 On Saturday, April 3, 2010, Rob furit...@gmail.com wrote:
  I've officially given up on ever getting VirtualBox to work properly
  on my netbook (I'm pretty sure it's just a memory issue), so I'd like
  to go back to the last VMware version (4.1.2, I guess).

  I can find where to find the source code for the old versions, but
  I've looked all over sagemath.org and can't find anywhere to download
  prebuilt copies.  I suppose it has to be possible theoretically to
  build it from source, but that type of stuff is well beyond me.

  Is there anyway to get a copy of 4.1.2?  Or, alternately, a very
  detailed list of instructions written for total idiots describing how
  to create one from the source code?

  --
  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 
  athttp://groups.google.com/group/sage-support
  URL:http://www.sagemath.org

  To unsubscribe, reply using remove me as the subject.

 --
 William Stein
 Associate Professor of Mathematics
 University of Washingtonhttp://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