[sage-support] Re: numeric approximations for symbolic expressions

2008-10-11 Thread Burcin Erocal

On Fri, 10 Oct 2008 17:48:57 -0500
Jason Grout [EMAIL PROTECTED] wrote:

 
 Burcin Erocal wrote:
  On Fri, 10 Oct 2008 10:35:16 -0500
  Jason Grout [EMAIL PROTECTED] wrote:
  
  The general request still stands, though: is there a way to
  numerically approximate all the constants in a symbolic expression,
  but keep the variables as variables?
  
  The pynac based symbolics code does the following:
  
  sage: x,y,z = var(x y z, ns=1)
  sage: t = 1 + sqrt(2)*x + sin(x)
  sage: t.n()
  sin(x) + (1.4142135623730951)*x + 1.0
  
  This is with the bundle at #3872 and patches at #4244 applied, and
  the package at #4243.
 
 
 Is there any chance this could be merged into 3.1.3 to get wider 
 testing?  That is, if it's a purely optional framework.  Barring
 that, is there a chance we could get a single huge patch that
 consolidates all of this, or even just a single patch that contains
 the changes in the bundle?

Since 3.1.3 is almost out the door, and these tickets have not been
reviewed yet, they won't be in 3.1.3. I've been told they are high
priority for 3.2, so hopefully they will be in the first alpha.

I have some fixes I haven't pushed to trac yet. I will try to set up a
canonical location where you can get the latest version of my tree.
This might be tomorrow afternoon though.


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: numeric approximations for symbolic expressions

2008-10-10 Thread William Stein

On Fri, Oct 10, 2008 at 7:11 AM, Jason Grout
[EMAIL PROTECTED] wrote:

 How do I get a numeric approximation for symbolic expressions that have
 variables?  I want to leave the variables alone, but get numeric
 approximations for all constants.  For example, here's how it works in
 mathematica:

 In[1]:= a:=1+Sqrt[2]*x

 In[2]:= a

 Out[2]= 1 + Sqrt[2] x

 In[3]:= N[a]

 Out[3]= 1. + 1.41421 x


 However, the corresponding thing does not work in Sage:

 sage: a=1+sqrt(2)*x
 sage: a
 sqrt(2)*x + 1
 sage: n(a)
 ---
 TypeError Traceback (most recent call last)

For polynomials, do this:

sage: f = 1 + sqrt(2)*x
sage: f.polynomial(RDF)
1.41421356237*x + 1.0

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



[sage-support] Re: numeric approximations for symbolic expressions

2008-10-10 Thread Jason Grout

William Stein wrote:
 On Fri, Oct 10, 2008 at 7:11 AM, Jason Grout
 [EMAIL PROTECTED] wrote:
 How do I get a numeric approximation for symbolic expressions that have
 variables?  I want to leave the variables alone, but get numeric
 approximations for all constants.  For example, here's how it works in
 mathematica:

 In[1]:= a:=1+Sqrt[2]*x

 In[2]:= a

 Out[2]= 1 + Sqrt[2] x

 In[3]:= N[a]

 Out[3]= 1. + 1.41421 x


 However, the corresponding thing does not work in Sage:

 sage: a=1+sqrt(2)*x
 sage: a
 sqrt(2)*x + 1
 sage: n(a)
 ---
 TypeError Traceback (most recent call last)
 
 For polynomials, do this:
 
 sage: f = 1 + sqrt(2)*x
 sage: f.polynomial(RDF)
 1.41421356237*x + 1.0


Aah, thanks.  I guess I also now see the f.series command, which does 
what I originally wanted as well (lets me specify the ring for the 
coefficients to the series approximation).

The general request still stands, though: is there a way to numerically 
approximate all the constants in a symbolic expression, but keep the 
variables as variables?

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: numeric approximations for symbolic expressions

2008-10-10 Thread Burcin Erocal

On Fri, 10 Oct 2008 10:35:16 -0500
Jason Grout [EMAIL PROTECTED] wrote:

 The general request still stands, though: is there a way to
 numerically approximate all the constants in a symbolic expression,
 but keep the variables as variables?

The pynac based symbolics code does the following:

sage: x,y,z = var(x y z, ns=1)
sage: t = 1 + sqrt(2)*x + sin(x)
sage: t.n()
sin(x) + (1.4142135623730951)*x + 1.0

This is with the bundle at #3872 and patches at #4244 applied, and the
package at #4243.

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: numeric approximations for symbolic expressions

2008-10-10 Thread Jason Grout

Burcin Erocal wrote:
 On Fri, 10 Oct 2008 10:35:16 -0500
 Jason Grout [EMAIL PROTECTED] wrote:
 
 The general request still stands, though: is there a way to
 numerically approximate all the constants in a symbolic expression,
 but keep the variables as variables?
 
 The pynac based symbolics code does the following:
 
 sage: x,y,z = var(x y z, ns=1)
 sage: t = 1 + sqrt(2)*x + sin(x)
 sage: t.n()
 sin(x) + (1.4142135623730951)*x + 1.0
 
 This is with the bundle at #3872 and patches at #4244 applied, and the
 package at #4243.


Nice.  That's exactly what I was wanting.  Chalk me up as one more 
person eager to get this in shape and into Sage.

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: numeric approximations for symbolic expressions

2008-10-10 Thread mabshoff



On Oct 10, 10:02 am, Jason Grout [EMAIL PROTECTED] wrote:
 Burcin Erocal wrote:
  On Fri, 10 Oct 2008 10:35:16 -0500
  Jason Grout [EMAIL PROTECTED] wrote:

  The general request still stands, though: is there a way to
  numerically approximate all the constants in a symbolic expression,
  but keep the variables as variables?

  The pynac based symbolics code does the following:

  sage: x,y,z = var(x y z, ns=1)
  sage: t = 1 + sqrt(2)*x + sin(x)
  sage: t.n()
  sin(x) + (1.4142135623730951)*x + 1.0

  This is with the bundle at #3872 and patches at #4244 applied, and the
  package at #4243.

 Nice.  That's exactly what I was wanting.  Chalk me up as one more
 person eager to get this in shape and into Sage.

Yep, it is certainly the highest priority ticket for 3.2 and 3.1.3 has
unfortunately delayed longer than planned. I plan to do 3.1.3.rc0
tonight and unless something major happens it should be very close to
final. Then we can open 3.2 during the coding sprint at SD 10 here at
Loria.

 Thanks,

 Jason

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: numeric approximations for symbolic expressions

2008-10-10 Thread Jason Grout

Burcin Erocal wrote:
 On Fri, 10 Oct 2008 10:35:16 -0500
 Jason Grout [EMAIL PROTECTED] wrote:
 
 The general request still stands, though: is there a way to
 numerically approximate all the constants in a symbolic expression,
 but keep the variables as variables?
 
 The pynac based symbolics code does the following:
 
 sage: x,y,z = var(x y z, ns=1)
 sage: t = 1 + sqrt(2)*x + sin(x)
 sage: t.n()
 sin(x) + (1.4142135623730951)*x + 1.0
 
 This is with the bundle at #3872 and patches at #4244 applied, and the
 package at #4243.


Is there any chance this could be merged into 3.1.3 to get wider 
testing?  That is, if it's a purely optional framework.  Barring that, 
is there a chance we could get a single huge patch that consolidates all 
of this, or even just a single patch that contains the changes in the 
bundle?

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: numeric approximations for symbolic expressions

2008-10-10 Thread mabshoff



On Oct 10, 3:48 pm, Jason Grout [EMAIL PROTECTED] wrote:

SNIP

 Is there any chance this could be merged into 3.1.3 to get wider
 testing?  That is, if it's a purely optional framework.  Barring that,
 is there a chance we could get a single huge patch that consolidates all
 of this, or even just a single patch that contains the changes in the
 bundle?

Nope, I don't see this happening until I

 a) valgrind the new doctests
 b) build it on Cygwin, Solaris, Linux/Itanium and G4/G5 on OSX 10.4
and 10.5 and have all doctests pass

and the doctests pass. ghmm has taught me that just because it mostly
works and there is only a couple allegedly easy bugs to fix a patch
like that can still hold up a release for an extended amount of time
(2 weeks in 3.1.2 in my guesstimation). And those bugs in ghmm on
Itanium are still not fixed, but we did disable doctests globally in
those two files in order to make the doctests pass. 3.1.3 is supposed
to be out soon, i.e. before the SD 10 coding sprint, and I am not
willing to take the risk of pynac's integration bundle.

 Thanks,

 Jason

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