[sage-support] Re: An integral solved by Mathematica, but not by Sage

2011-08-21 Thread achrzesz
sage: (integrate( exp(-x^2/2)/sqrt(2*pi) * sign(x-1), x, -oo, 1 )
+integrate( exp(-x^2/2)/sqrt(2*pi) * sign(x-1), x, 1,
oo )).simplify_full()

-erf(1/2*sqrt(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


[sage-support] Is "x (x)" impossible with all implicit_multiplication levels? (Please help decode warning get.)

2011-08-21 Thread Chris Seberino
I want "x (x)" to return x^2.  It doesn't seem to work with any
implicit_multiplication level.   What does the following error mean?
Does it mean this will get fixed in a future version?

sage: x (x)
/usr/local/sage-4.7/local/lib/python2.6/site-packages/IPython/iplib.py:
2073: DeprecationWarning: Substitution using function-call syntax and
unnamed arguments is deprecated and will be removed from a future
release of Sage; you can use named arguments instead, like EXPR(x=...,
y=...)
  exec code_obj in self.user_global_ns, self.user_ns
x

cs

-- 
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: Is "x (x)" impossible with all implicit_multiplication levels? (Please help decode warning get.)

2011-08-21 Thread Simon King
Hi  Chris

On 21 Aug., 17:19, Chris Seberino  wrote:
> I want "x (x)" to return x^2.  It doesn't seem to work with any
> implicit_multiplication level.

The use of implicit multiplication is a very improper way to talk with
a CAS, IMHO. You met one of the reasons why it is improper and error
prone.

If you have an object that is directly followed by parentheses, then
in Python, which is the underlying language of Sage,  it means
function evaluation. Hence, when you write f(x) then you normally do
NOT want to multiply f and x, but typically f is a function and you
want to evaluate it at the point x.

And that's why it is a bad idea to drop the * in a multiplication.
When you write x(2+3), do you mean "x (a function) evaluated at 5"? Or
do you mean "x multiplied with 5"? How could Sage possibly know? So,
in case of doubt, better be clear and write x*(2+3), or write x(2+3)
and mean function evalutation.

>  What does the following error mean?

It is not an error but a deprecation warning.

> Does it mean this will get fixed in a future version?

No, since it is not a bug. You asked for function evaluation (without
being aware of), and you got function evaluation: x evaluated at x is
x.

The warning seems to tell that the current rules for substituting some
variable in a symbolic expression will actually be more rigid soon.

If  f is a function with two variables x,y, and you want to substitute
2 for x and 3 for y, then currently you can do f(2,3) -- but you get a
warning telling you that you should better write f(x=2,y=3), and that
soon you will not only get a (harmless) warning but an actual error.

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


[sage-support] Re: Is "x (x)" impossible with all implicit_multiplication levels? (Please help decode warning get.)

2011-08-21 Thread Simon King
On 21 Aug., 20:03, Simon King  wrote:
> If  f is a function with two variables x,y, and you want to substitute
> 2 for x and 3 for y...

I meant to say "If f is a symbolic expression...". If it is a properly
defined function in two variables x,y, then f(2,3) is fine.

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


Re: [sage-support] Matplotlib: An apparent error

2011-08-21 Thread William Stein
On Sunday, August 21, 2011, Owen Densmore  wrote:
> I work with a group, many of whom use the numpy, scipy, matplotlib stack,
while I much prefer using Sage.  So I modified Sage to let me use the
matplotlib GUI which is not include in the standard Sage release.
> To do so, I followed the instructions for installing the matplotlib
backend
> http://wiki.sagemath.org/sage_matlab
> .. which for me required only setting the two env variables and running
> sage -i matplotlib
> To test this out, I actually installed the numpy, scipy, matplotlib as
well, and in both, ran this test from a Machine Learning book, using
"ipython" and "sage" command line .. i.e. no arguments like -pylab etc:
>

Obvious question: are you using exactly the same versions of numpy, etc., in
both of your tests?


> import numpy as np
> import matplotlib.pyplot as plt
> import os
> os.chdir(os.path.expanduser("~/src/ML/2 Linear"))
> pima = np.loadtxt('./pima-indians-diabetes.data',delimiter=',')
> indices0 = np.where(pima[:,8]==0)
> indices1 = np.where(pima[:,8]==1)
> plt.plot(pima[indices0,0],pima[indices0,1],'go');
> plt.plot(pima[indices1,0],pima[indices1,1],'rx');
> plt.show()
>
> The results look alike, but the axes appear to lack the lowest decimal
value.  So for 10, 11, 12 ... I see 1, 1, 1!
> The dataset is on this public site:
http://archive.ics.uci.edu/ml/datasets/Pima+Indians+Diabetes
> Here are the plots, the first from the scipy install, the second from
sage.  I'd like to know if this is a mistake on my part or a bug that needs
to be reported.
> My environment is
> sage -v -> Detected SAGE64 flag, Building Sage on OS X in 64-bit
mode, Sage Version 4.7, Release Date: 2011-05-23
> -- Owen
>
>
>
>
>
>
>
> --
> 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 <
sage-support%2bunsubscr...@googlegroups.com>
> For more options, visit this group at
http://groups.google.com/group/sage-support
> URL: http://www.sagemath.org
>

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

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


[sage-support] Re: Is "x (x)" impossible with all implicit_multiplication levels? (Please help decode warning get.)

2011-08-21 Thread Chris Seberino


On Aug 21, 1:03 pm, Simon King  wrote:
> If you have an object that is directly followed by parentheses, then
> in Python, which is the underlying language of Sage,  it means
> function evaluation. Hence, when you write f(x) then you normally do
> NOT want to multiply f and x, but typically f is a function and you
> want to evaluate it at the point x.

Simon

Thanks for the info.  I thought of a perfect solution.  Rarely in
Python or Sage, when people invoke functions, do they leave a space
between the function name and the argument list

e.g.

sin (pi)# rare,  sin(pi) more likely
f (3, 4)# rare,   f(3, 4) more likely

What about a run level that parses "f (3, 4)" as implicit
multiplication?

Sincerely,

Chris

-- 
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: An integral solved by Mathematica, but not by Sage

2011-08-21 Thread Omri
Thanks - this is exactly what I meant by resolved.
Omri

-- 
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: Is "x (x)" impossible with all implicit_multiplication levels? (Please help decode warning get.)

2011-08-21 Thread Maarten Derickx
I don't think your proposal will be an enhancement. For two reasons.

1. x (x) an x*(x) have the same amount of characters. 
2. currently the python and sage expressions are not white space dependant. 
Your suggestion would introduce such a whitespace dependancy and will be 
very unexpected for a lot of people if they just happen to do something like 
 "sin (pi)".

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