Re: [sage-support] Approximate decimal answers

2015-03-24 Thread William Stein
On Tuesday, March 24, 2015,  wrote:

>  When using Sage. my students really like using the n() method as in
> show(sqrt(2).n(digits=50))
> giving the result rounded off to 50 decimal digits after the decimal point.
>
> What I'm wondering is where does the n() method come from. Is it peculiar
> to Sage or Maxima or what? Is it pure python? The reason I ask is that some
> of my independent study student are using mpi4py in openMPI on a Linux
> Cluster they put together doing some simple Monte Carlo simulations and
> quadrature calculations. If n() is pure python, I'd like to give them the
> code so they can get more digits out of their simulations
>

Cython. Built into Sage.  It's a method on symbolic expressions that
evaluates the leaves to the given precision then simplifies the result by
evaluating the whole tree to get a single number.



>
>
> Is this doable? What do you think?
>
> TIA,
> A. Jorge Garcia
> http://shadowfaxrant.blogspot.com
>








>
> --
> Sent from Mailbox 
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com
> 
> .
> To post to this group, send email to sage-support@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>


-- 
Sent from my massive iPhone 6 plus.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Approximate decimal answers

2015-03-24 Thread calcpage
When using Sage. my students really like using the n() method as in
show(sqrt(2).n(digits=50)) 
giving the result rounded off to 50 decimal digits after the decimal point.

What I'm wondering is where does the n() method come from. Is it peculiar to 
Sage or Maxima or what? Is it pure python? The reason I ask is that some of my 
independent study student are using mpi4py in openMPI on a Linux Cluster they 
put together doing some simple Monte Carlo simulations and quadrature 
calculations. If n() is pure python, I'd like to give them the code so they can 
get more digits out of their simulations.

Is this doable? What do you think?

TIA,
A. Jorge Garcia
http://shadowfaxrant.blogspot.com 

—
Sent from Mailbox

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] is it possible to install only the core software, and download packages when i need them?

2015-03-24 Thread Alexey Muranov
Hello,

i find Sage distributions downloadable from its web site huge, and most 
likely i will never need most of the functions.  Is it possible to install 
only the core, and download needed packages on demand?

Thank you,

Alexey.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Filling a matrix with functions

2015-03-24 Thread Oscar Alberto Castillo Felisola
Thank you very much Harald!

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Filling a matrix with functions

2015-03-24 Thread Harald Schilly


On Tuesday, March 24, 2015 at 12:49:57 PM UTC+1, Oscar Alberto Castillo 
Felisola wrote:
>
> I'd like to obtain something like
>
> f11 = function('f11', t,r)
> f12 = function('f12', t,r)
> f21 = function('f21', t,r)
> f22 = function('f22', t,r)
> M = matrix(2,2, [[f11, f12], [f21, f22]])
>
>
 
Since this is doable via a functional mapping from the indices to the 
desired objects, you can use the matrix to do this via the lambda operator:

sage: var("t r")
(t, r)
sage: matrix(5, 5, lambda x,y : function("f%s%s" % (x,y), t, r))
[f00(t, r) f01(t, r) f02(t, r) f03(t, r) f04(t, r)]
[f10(t, r) f11(t, r) f12(t, r) f13(t, r) f14(t, r)]
[f20(t, r) f21(t, r) f22(t, r) f23(t, r) f24(t, r)]
[f30(t, r) f31(t, r) f32(t, r) f33(t, r) f34(t, r)]
[f40(t, r) f41(t, r) f42(t, r) f43(t, r) f44(t, r)]

It's zero-based indexed, as everything else in Python, but you can fix it 
easily. Hope this helps.

-- Harald



-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Filling a matrix with functions

2015-03-24 Thread Oscar Alberto Castillo Felisola
I'd like to obtain something like

f11 = function('f11', t,r)
f12 = function('f12', t,r)
f21 = function('f21', t,r)
f22 = function('f22', t,r)
M = matrix(2,2, [[f11, f12], [f21, f22]])

Note that in principle all the functions depend on the same variables.

If the assignation of functions could be used as components of a metric of 
sagemanifold, would be even better.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Re: Filling a matrix with functions

2015-03-24 Thread Harald Schilly


On Tuesday, March 24, 2015 at 11:05:21 AM UTC+1, Oscar Alberto Castillo 
Felisola wrote:
>
> but for "huge" matrices it is boring and make no sense. 
>

Can you describe a rule or pattern how this matrix should be filled? 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Filling a matrix with functions

2015-03-24 Thread Oscar Alberto Castillo Felisola
Hi. I know that one can define a function by declaring

sage: f = function('f', t,r)

However, I'm interested in declaring a matrix filled with different 
functions. Of course, for a small matrix I can do it by hand, but for 
"huge" matrices it is boring and make no sense. 

Is it possible to do what I need? 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] solving equation involving absolute values

2015-03-24 Thread sundar
   Some documentation of maxima's to_poly_solve command is on 

> http://maxima.sourceforge.net/docs/manual/de/maxima_75.html, 
> about 3/4th down the page. 
>
>
>
Thanks. But is there other way to solve this particular equation ?

 

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] solving equation involving absolute values

2015-03-24 Thread David Joyner
On Tue, Mar 24, 2015 at 1:04 AM, sundar  wrote:
> Hello
>
> I am newbie to sagemath. I have windows 8 and sage version is 6.4.1. I am
> running it inside virtualbox.
> I was reading some thing about solving equations on sage website at
> http://www.sagemath.org/doc/reference/calculus/sage/symbolic/relation.html
>
> At one point author is trying to demonstrate the use of optional keywords
> for the "solve"
> He is solving equation
>
> solve(abs(1-abs(1-x)) == 10, x)
>
> When evaluated this gives
>
> [abs(abs(x - 1) - 1) == 10]
>
> But when the input is modified a little as
>
> solve(abs(1-abs(1-x)) == 10, x, to_poly_solve=True)
>
> sage gives correct result as
> [x == -10, x == 12]
>
>
> So why does it not work in the first case ? I didn't understand this use of
> keyword to_poly_solve.
>

Some documentation of maxima's to_poly_solve command is on
http://maxima.sourceforge.net/docs/manual/de/maxima_75.html,
about 3/4th down the page.

> Please help
> sundar
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at http://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.