[sage-support] Re: Sage inside MediaWiki

2009-05-13 Thread kilucas



On May 12, 11:07 pm, mabshoff michael.absh...@mathematik.uni-
dortmund.de wrote:
 On May 12, 3:05 pm, kilucas kevin.lu...@concave.co.uk wrote:

  On May 12, 8:39 pm, David Joyner wdjoy...@gmail.com wrote:

 SNIP

  Conversely, I've also since spotted reference to MoinMoin within Sage.
  I've not yet explored what benefits this might confer but, once I
  know, I might then  be interested to know if I could easily replace
  MoinMoin by MediaWiki in that context too.

 Sage doesn't work as an extension of MoinMoin, it just provides the
 bits and pieces to run MoinMoin from within Sage. Sorry.

 Cheers,

 Michael

Thanks MIchael
I'm installing Sage now and so should have a chance to explore how
MoinMoin applies in a Sage environment a little further shortly too.

All the best
Kevin

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Location of a file that is loaded

2009-05-13 Thread Simon King

Hi!

When one does
  sage: load('path/to/filename')
then eventually some unpickle function (or __setstate__ method) is
called.

Is it possible to determine the value 'path/to/filename' (or 'path/
to/') inside the unpickle function?

In other words: Does the 'load' function temporarily store the value
of 'path/to/filename' in a global variable that is available to the
unpickle function?

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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Location of a file that is loaded

2009-05-13 Thread Mike Hansen

Hello,

Looking at the code for load in enlightening.  Here's the bit that is
relevant for you:

## Load file by absolute filename
X = loads(open(filename).read(), compress=compress)
try:
X._default_filename = os.path.abspath(filename)
except AttributeError:
pass

Since loads just takes in a string, it has no way to know about the
filename.  However, the _default_filename is set as an attribute after
it has already been loaded.

--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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Usage Styles and using scipy

2009-05-13 Thread Kevin Horton

On 12 May 2009, at 21:46, kcrisman wrote:

 You can also shift-click on the blue bar to bring up a nice  
 editor, in
 which you can enter latex code like you did above.  This basically
 is a
 nice way of editing text in between cells.

 For an example, do what you did above (put that text in between the
 cells) and then go back to the worksheet and doubleclick on the  
 math.
 It should pop up the editor and let you edit it.

 I didn't know that.  Thanks.  That looks useful.

 That's an understatement, as it turns out - many of us can't imagine
 going back.  Jason is too humble to mention that he is largely
 responsible for that being part of Sage now :)


Well done Jason - Thanks!

The baffling part is why you don't get this editor when you click the  
Edit button in a notebook worksheet.  As it sits now, with no obvious  
visual clue that this editor even exists, most users would never  
discover its existence.  Are there any plans to change that?

--
Kevin Horton
Ottawa, Canada




--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Usage Styles and using scipy

2009-05-13 Thread Mike Hansen

On Wed, May 13, 2009 at 3:44 AM, Kevin Horton khorto...@rogers.com wrote:
 Well done Jason - Thanks!

 The baffling part is why you don't get this editor when you click the
 Edit button in a notebook worksheet.  As it sits now, with no obvious
 visual clue that this editor even exists, most users would never
 discover its existence.  Are there any plans to change that?

There is something there under the HTML section on the help page for
the notebook.  See http://sagenb.org/help/ .  But, it could probably
be made more clear and/or advertised better.

--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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Usage Styles and using scipy

2009-05-13 Thread Jason Grout

Kevin Horton wrote:
 
 
 Well done Jason - Thanks!
 
 The baffling part is why you don't get this editor when you click the  
 Edit button in a notebook worksheet.  As it sits now, with no obvious  
 visual clue that this editor even exists, most users would never  
 discover its existence.  Are there any plans to change that?


Good point.  What do you suggest?

The html editor is mentioned (several times?) in the Help page.  My 
thoughts up to this point were that the Edit button is mainly for being 
able to edit and copy the worksheet as a text file, so  putting the 
editor in the Edit page is probably not appropriate.  What do you think? 
   How do you suggest we make the editor a more visible part of Sage to 
the new user?

What about changing the new cell (blue) bar so that it had two links, 
one that said New computation and another link that said New text?

Thanks,

Jason



--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] matrix times variable

2009-05-13 Thread Laurent

 Ciao everyone !

I'm trying to make some computation with matrices (with some variables 
x,y,z). For that, I'm following the document :
 http://www.sagenb.org/home/pub/217/

When I type (in a notebook) the following, it works :



A = matrix([[7, 0, 0], [0, -2, 4], [0, 6, 0]])
I3 = identity_matrix(QQ, 3)
L = var('L')
CE1 = det(L*I3 - A)
print(CE1)

++
It produces the characteristic polynomial of the matrix A.


But the slightest change produce a wide variety of crashes or unexpected 
thinks. For example, if I define an itermediate matrix B build from A :

+

A = matrix([[7, 0, 0], [0, -2, 4], [0, 6, 0]])
I3 = identity_matrix(QQ, 3)
L = var('L')
B = L*I3 - A
print(B)
CE1 = det(L*I3 - A)
print(CE1)

++

produces :

-

Maxima crashed -- automatically restarting.

execfile(/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y)
print \x01r\x01e4
 print \x01r\x01e3
 r e3

execfile(/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y)
 b4
Maxima crashed -- automatically restarting.

execfile(/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y)
print \x01r\x01e4
 print \x01r\x01e3
 r e3

execfile(/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y)
 b4
Maxima crashed -- automatically restarting.

execfile(/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y)
print \x01r\x01e4
 print \x01r\x01e3
 r e3

execfile(/home/kusbiste/.sage/sage_notebook/worksheets/admin/3/code/5.p\
y)
 b4
Maxima crashed -- automatically restarting.
Traceback (click to the left for traceback)
...
TypeError: unable to make sense of Maxima expression 'sage26[3,3]' in
SAGE

-


If I copy/paste exactly these lines in the terminal interface of sage, I 
get the expected result :


+++
$ sage
--
| SAGE Version 3.0.5, Release Date: 2008-07-11   |
| Type notebook() for the GUI, and license() for information.|
--

sage: A = matrix([[7, 0, 0], [0, -2, 4], [0, 6, 0]])
sage: I3 = identity_matrix(QQ, 3)
sage: L = var('L')
sage: B = L*I3 - A
sage: print(B)
[L - 7 0 0]
[0 L + 2-4]
[0-6 L]
sage: CE1 = det(L*I3 - A)
sage: print(CE1)

   (L - 7) (L (L + 2) - 24)
sage:




Any ideas ?


My aim is to do the following :
I would like to define 4 matrices q0,q1,q2,q3 and then a function which 
creates a linear combination of them:

+
def Q(w1,w2,w3):
s = q0+w1*q1+w2*q2+w3*q3
return s

x = var('x')
print Q(x,1,3)
+++

That construction produces very different results when I try slight 
differences.

Any help is much welcome.
Thanks
Have a good day
Laurent



--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: Location of a file that is loaded

2009-05-13 Thread simon . king

Dear Mike,

On May 13, 12:31 pm, Mike Hansen mhan...@gmail.com wrote:
 Looking at the code for load in enlightening.

Thank you. I don't know why, but I forgot to try load??.

 Here's the bit that is
 relevant for you:

 ## Load file by absolute filename
 X = loads(open(filename).read(), compress=compress)
 try:
 X._default_filename = os.path.abspath(filename)
 except AttributeError:
 pass

 Since loads just takes in a string, it has no way to know about the
 filename.

This is unfortunate.

  However, the _default_filename is set as an attribute after
 it has already been loaded.

This is a little bit too late. I would need _default_filename being
around while __setstate__ is called.

Hmmm. I think I have to meditate a bit more on it.

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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: matrix times variable

2009-05-13 Thread simon . king

Dear Laurent,

please do not use an existing thread for asking a completely different
question. Better open a new thread.

On May 13, 12:55 pm, Laurent moky.m...@gmail.com wrote:
 +++
 $ sage
 --
 | SAGE Version 3.0.5, Release Date: 2008-07-11   |
 | Type notebook() for the GUI, and license() for information.|
 --

I am not an expert for the maxima interface, but I am sure that *much*
happened with it since
Sage-3.0.5. So, I would recommend that you upgrade to Sage-3.4.2 and
try if the problem persists -- unless other people on that list have a
better hint.

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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: matrix times variable

2009-05-13 Thread mabshoff



On May 13, 4:12 am, simon.k...@uni-jena.de wrote:
 Dear Laurent,

 please do not use an existing thread for asking a completely different
 question. Better open a new thread.

Yep. Also do not open a thread by replying to an email from sage-devel
by changing the subject since the Groups figure out what you replied
to.

 On May 13, 12:55 pm, Laurent moky.m...@gmail.com wrote:

  +++
  $ sage
  --
  | SAGE Version 3.0.5, Release Date: 2008-07-11                       |
  | Type notebook() for the GUI, and license() for information.        |
  --

 I am not an expert for the maxima interface, but I am sure that *much*
 happened with it since
 Sage-3.0.5. So, I would recommend that you upgrade to Sage-3.4.2 and
 try if the problem persists -- unless other people on that list have a
 better hint.

This is likely the version in the Ubuntu 9.04 repo. Maxima in that
release is *completely* broken - don't use that version. As Simon
suggested either upgrade to the binary provided by Sage or build from
source.

 Best regards,
      Simon

Cheers,

Michael
--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: matrix times variable

2009-05-13 Thread Laurent


 Yep. Also do not open a thread by replying to an email from sage-devel
 by changing the subject since the Groups figure out what you replied
 to.
   
Woops... I though that nobody would have noticed. Clear, I don't do it 
again.

 This is likely the version in the Ubuntu 9.04 repo. Maxima in that
 release is *completely* broken - don't use that version. As Simon
 suggested either upgrade to the binary provided by Sage or build from
 source.
   
Yes, this is the one from Ubuntu-Jaunty.
I try to update.
Thanks
Laurent


   
 Best regards,
  Simon
 

 Cheers,

 Michael
 

   


--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: sage in html

2009-05-13 Thread Mikie

OK,  I have it working in Sage.  How do I start it in an html page?

On May 13, 8:59 am, Mikie thephantom6...@hotmail.com wrote:
 Thanks for your patience.  I am using xwindows on the CentOS server.
 When I load the twist.py file using gedit, it looks like an html
 file.  When I get into Sage I have to type each line by hand?  Is
 there a easier way?  When I am finished the notebook is started.  Then
 what do I do?

 On May 12, 6:16 pm, Jason Grout jason-s...@creativetrax.com wrote:

  Mikie wrote:

    I have the twist.py file.  What do I do with it?  It is an html
    file?
   

  It is a python file, which is the code and documentation for the simple
  API.  In it, you'll find some examples of how to start up Sage and use
  the API.  Look at the lines that start with sage:  for what to type
  into Sage.  You'll notice a lot of lines that are retrieving URLs.  That
  is what a form would have to do to execute calculations.

  You can read just the documentation (which gives all the examples) by
  typing the two commands I mentioned earlier into sage:

  sage: import sage.server.simple.twist
  sage: sage.server.simple.twist?

  Jason

    On May 12, 10:20 am, Jason Grout jason-s...@creativetrax.com wrote:  
  Mikie wrote:

    Does anyone have a simple API that takes input from a form and uses
    Sage to calculate the solution and displays it on the hrml page.
    I don't want to use the notebook.
    I have CentOS running in a local network with Sage and Moodle.
    I thought I seen something like this on Wiki.
    You can read about the simple web API by doing:
   
    sage: import sage.server.simple.twist
    sage: sage.server.simple.twist?
   
    I guess this hasn't been added to the reference manual yet.
   
    Jason
   
--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: characters of the symmetric group

2009-05-13 Thread Jason Bandlow

David Joyner wrote:
 On Tue, May 12, 2009 at 6:43 PM, amps arat...@gmail.com wrote:
 I see that there is a function to compute the character table of the
 symmetric group, but is there one where you input two partitions and
 it outputs the value of the character indexed by the first partition
 evaluated at the second?  I have been searching for some time and
 can't find the answer.
 
 
 I don't know either and would be interested as well.
 Do you know how to do this in GAP?

One way is to use symmetric function theory:

sage: s = SFASchur(QQ); p = SFAPower(QQ)
sage: s(p([2,2])).coefficient([3,1])
-1

This says that the value of the irreducible character indexed by the
partition (3,1) is -1 when evaluated on a conjugacy class of size (2,2).

Cheers,
Jason


--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: No sans-serif font in notebook latex entries

2009-05-13 Thread Brian Hawkins

I did not know about the %latex command, thanks for the tip.

Looking at the symbol table, I found one that serves my particular
purpose well: \top.  $M^\top$ renders as I'd like for a transpose and
avoids using an unsupported font in jsMath.

Brian

On May 12, 4:55 am, Jason Grout jason-s...@creativetrax.com wrote:
 Rob Beezer wrote:
  Hi Brian,

  In a notebook cell, I enter and evaluate:

  %latex
  $M^\mathsf{T}$

  and get back a slanted M and a very crisp, upright superscript T.  So
  it can be done, but this is accomplished by running a full-blown
  instance of TeX and creating a PNG graphic as output.  $M^{\sf T}$
  looks to render identically.

  I get the error you mention when I add $M^\mathsf{T}$ via the TinyMCE
  editor (shift-click on a blue bar).  I think this gets interpreted by
  jsMath, so any fonts will come from jsMath.  From here I'm not sure
  how to proceed, but maybe this will be enough for somebody else to
  show the way forward.

 Searching in the jsmath source shows that \mathrm and \rm are defined,
 but \mathsf and \sf don't seem to be defined.

 Davide, does jsmath implement san serif fonts?

 Thanks,

 Jason
--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: characters of the symmetric group

2009-05-13 Thread David Joyner

On Wed, May 13, 2009 at 10:33 AM, Jason Bandlow jband...@gmail.com wrote:

 David Joyner wrote:
 On Tue, May 12, 2009 at 6:43 PM, amps arat...@gmail.com wrote:
 I see that there is a function to compute the character table of the
 symmetric group, but is there one where you input two partitions and
 it outputs the value of the character indexed by the first partition
 evaluated at the second?  I have been searching for some time and
 can't find the answer.


 I don't know either and would be interested as well.
 Do you know how to do this in GAP?

 One way is to use symmetric function theory:

 sage: s = SFASchur(QQ); p = SFAPower(QQ)
 sage: s(p([2,2])).coefficient([3,1])
 -1

 This says that the value of the irreducible character indexed by the
 partition (3,1) is -1 when evaluated on a conjugacy class of size (2,2).


This is cool - thanks!



 Cheers,
 Jason


 


--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] VMWare Player versions for Sage 3.4.1

2009-05-13 Thread kilucas

I've had two attempts at installing the VMWare Player v2.5.2 on a
Windows XP Pro PC. Both times the Player will not start correctly - it
crashes Windows almost immediately the player has started. So I'm not
even getting as far as starting Sage.

So I'm tempted to try earlier versions of the VMWare Player but wasn't
sure which I'd need for Sage 3.4.1. Options seem to include VMWare
Player 2.5.1, 2.5.0 and then 2.0.5 and earlier.

Can anyone say which versions of the Player should be compatible with
Sage 3.4.1 please?

Many thanks for your help.

Kevin
--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: No sans-serif font in notebook latex entries

2009-05-13 Thread John H Palmieri

On May 13, 9:49 am, Brian Hawkins hawkins.br...@gmail.com wrote:
 I did not know about the %latex command, thanks for the tip.

 Looking at the symbol table, I found one that serves my particular
 purpose well: \top.  $M^\top$ renders as I'd like for a transpose and
 avoids using an unsupported font in jsMath.

 Brian

 On May 12, 4:55 am, Jason Grout jason-s...@creativetrax.com wrote:



  Rob Beezer wrote:
   Hi Brian,

   In a notebook cell, I enter and evaluate:

   %latex
   $M^\mathsf{T}$

   and get back a slanted M and a very crisp, upright superscript T.  So
   it can be done, but this is accomplished by running a full-blown
   instance of TeX and creating a PNG graphic as output.  $M^{\sf T}$
   looks to render identically.

   I get the error you mention when I add $M^\mathsf{T}$ via the TinyMCE
   editor (shift-click on a blue bar).  I think this gets interpreted by
   jsMath, so any fonts will come from jsMath.  From here I'm not sure
   how to proceed, but maybe this will be enough for somebody else to
   show the way forward.

  Searching in the jsmath source shows that \mathrm and \rm are defined,
  but \mathsf and \sf don't seem to be defined.

  Davide, does jsmath implement san serif fonts?

  Thanks,

  Jason

This was posted on the jsMath help forum, 
http://sourceforge.net/forum/forum.php?forum_id=592273:

By: Davide P. Cervone (dpvc) - 2009-05-12 15:17
No, there is no mathsf at this point. There are two possible solutions
that I can see.

The cheap but easy one is to do a definition like the following:

\def\mathsf#1{\style{font-family:sanserif}{\hbox{#1}}}

or

jsMath.Macro('mathsf','\\style{font-family:sanserif}{\\hbox{#1}}',1);

if you include it in a JavaScript file. Some disadvantages: it will
always be at the normal text size (so won't get smaller for super- or
sub-scripts, for example), and it will use the browser's default sans-
serif font, not a TeX font, so it might not match the rest of the TeX
output as well. There may also be some spacing issues, as jsMath
doesn't really know the sizes of the characters. But it is easy to do
and may be sufficient for your needs.

The other approach is to make a new jsMath extra font for mathsf,
like the ones for the other extra fonts (msam10, etc). The tools for
doing this are on the jsMath website at

http://www.math.union.edu/locate/jsMath/authors/making-fonts.html

but you will have to figure out which TeX font you want to use for the
\mathsf font. Probably cmss10 would do.

Davide


--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] cube roots

2009-05-13 Thread Bill Page

Can someone explain this apparently inconsistent result?

--
| Sage Version 3.4, Release Date: 2009-03-11 |
| Type notebook() for the GUI, and license() for information.|
--
sage: a=-2.0^(1/3);a
-1.25992104989487
sage: parent(a)
Real Field with 53 bits of precision
sage: b=-2.0;b
-2.00
sage: parent(b)
Real Field with 53 bits of precision
sage: c=b^(1/3);c
0.629960524947437 + 1.09112363597172*I
sage: parent(c)
Complex Field with 53 bits of precision
sage:

Why are the values of 'a' and 'c' different? Shouldn't Sage return the
same root in both cases? Why is 'c' complex while 'a' is real?

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: cube roots

2009-05-13 Thread Mike Hansen

On Wed, May 13, 2009 at 6:58 PM, Bill Page bill.p...@newsynthesis.org wrote:

 Can someone explain this apparently inconsistent result?

It's just operator precedence:

sage: -(2.0^(1/3))
-1.25992104989487
sage: (-2.0)^(1/3)
0.629960524947437 + 1.09112363597172*I

--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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: cube roots

2009-05-13 Thread Bill Page

On Wed, May 13, 2009 at 10:46 PM, Mike Hansen wrote:

 On Wed, May 13, 2009 at 6:58 PM, Bill Page wrote:

 Can someone explain this apparently inconsistent result?

 It's just operator precedence:

 sage: -(2.0^(1/3))
 -1.25992104989487
 sage: (-2.0)^(1/3)
 0.629960524947437 + 1.09112363597172*I


Clear. Thanks. Why this particular root?

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: cube roots

2009-05-13 Thread Alex Ghitza

On Thu, May 14, 2009 at 1:19 PM, Bill Page bill.p...@newsynthesis.org wrote:

 On Wed, May 13, 2009 at 10:46 PM, Mike Hansen wrote:

 On Wed, May 13, 2009 at 6:58 PM, Bill Page wrote:

 Can someone explain this apparently inconsistent result?

 It's just operator precedence:

 sage: -(2.0^(1/3))
 -1.25992104989487
 sage: (-2.0)^(1/3)
 0.629960524947437 + 1.09112363597172*I


 Clear. Thanks. Why this particular root?


I believe that it is the real 3rd root of 2 times the natural
primitive 6th root of 1, i.e. exp(2*pi*i/6).













-- 
Alex Ghitza -- Lecturer in Mathematics -- The University of Melbourne
-- Australia -- http://www.ms.unimelb.edu.au/~aghitza/

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: cube roots

2009-05-13 Thread Bill Page

On Wed, May 13, 2009 at 11:23 PM, Alex Ghitza wrote:

 On Thu, May 14, 2009 at 1:19 PM, Bill Page wrote:

 On Wed, May 13, 2009 at 10:46 PM, Mike Hansen wrote:

 On Wed, May 13, 2009 at 6:58 PM, Bill Page wrote:

 Can someone explain this apparently inconsistent result?

 It's just operator precedence:

 sage: -(2.0^(1/3))
 -1.25992104989487
 sage: (-2.0)^(1/3)
 0.629960524947437 + 1.09112363597172*I


 Clear. Thanks. Why this particular root?


 I believe that it is the real 3rd root of 2 times the natural
 primitive 6th root of 1, i.e. exp(2*pi*i/6).


In most cases (e.g. plot) isn't the real root more desirable?

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: cube roots

2009-05-13 Thread Robert Bradshaw

On May 13, 2009, at 8:49 PM, Bill Page wrote:

 On Wed, May 13, 2009 at 11:23 PM, Alex Ghitza wrote:

 On Thu, May 14, 2009 at 1:19 PM, Bill Page wrote:

 On Wed, May 13, 2009 at 10:46 PM, Mike Hansen wrote:

 On Wed, May 13, 2009 at 6:58 PM, Bill Page wrote:

 Can someone explain this apparently inconsistent result?

 It's just operator precedence:

 sage: -(2.0^(1/3))
 -1.25992104989487
 sage: (-2.0)^(1/3)
 0.629960524947437 + 1.09112363597172*I


 Clear. Thanks. Why this particular root?


 I believe that it is the real 3rd root of 2 times the natural
 primitive 6th root of 1, i.e. exp(2*pi*i/6).


 In most cases (e.g. plot) isn't the real root more desirable?


This is because the branch in which the positive real root is real is  
taken. We're opting for continuity and consistency with complex numbers.

- Robert


--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: cube roots

2009-05-13 Thread Bill Page

On Wed, May 13, 2009 at 11:54 PM, Robert Bradshaw wrote:

 This is because the branch in which the positive real root is real is
 taken. We're opting for continuity and consistency with complex numbers.


If I wrote:

sage: ComplexField(53)(-2.0)^(1/3)
0.629960524947437 + 1.09112363597172*I

that looks ok to me, but

sage: RealField(53)(-2.0)^(1/3)
0.629960524947437 + 1.09112363597172*I

looks very strange. Could you explain the advantage?

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: No sans-serif font in notebook latex entries

2009-05-13 Thread John H Palmieri

On May 13, 4:57 pm, John H Palmieri jhpalmier...@gmail.com wrote:
 On May 13, 9:49 am, Brian Hawkins hawkins.br...@gmail.com wrote:





  I did not know about the %latex command, thanks for the tip.

  Looking at the symbol table, I found one that serves my particular
  purpose well: \top.  $M^\top$ renders as I'd like for a transpose and
  avoids using an unsupported font in jsMath.

  Brian

  On May 12, 4:55 am, Jason Grout jason-s...@creativetrax.com wrote:

   Rob Beezer wrote:
Hi Brian,

In a notebook cell, I enter and evaluate:

%latex
$M^\mathsf{T}$

and get back a slanted M and a very crisp, upright superscript T.  So
it can be done, but this is accomplished by running a full-blown
instance of TeX and creating a PNG graphic as output.  $M^{\sf T}$
looks to render identically.

I get the error you mention when I add $M^\mathsf{T}$ via the TinyMCE
editor (shift-click on a blue bar).  I think this gets interpreted by
jsMath, so any fonts will come from jsMath.  From here I'm not sure
how to proceed, but maybe this will be enough for somebody else to
show the way forward.

   Searching in the jsmath source shows that \mathrm and \rm are defined,
   but \mathsf and \sf don't seem to be defined.

   Davide, does jsmath implement san serif fonts?

   Thanks,

   Jason

 This was posted on the jsMath help 
 forum,http://sourceforge.net/forum/forum.php?forum_id=592273:

 By: Davide P. Cervone (dpvc) - 2009-05-12 15:17
 No, there is no mathsf at this point. There are two possible solutions
 that I can see.

 The cheap but easy one is to do a definition like the following:

 \def\mathsf#1{\style{font-family:sanserif}{\hbox{#1}}}

 or

 jsMath.Macro('mathsf','\\style{font-family:sanserif}{\\hbox{#1}}',1);

 if you include it in a JavaScript file. Some disadvantages: it will
 always be at the normal text size (so won't get smaller for super- or
 sub-scripts, for example), and it will use the browser's default sans-
 serif font, not a TeX font, so it might not match the rest of the TeX
 output as well. There may also be some spacing issues, as jsMath
 doesn't really know the sizes of the characters. But it is easy to do
 and may be sufficient for your needs.

 The other approach is to make a new jsMath extra font for mathsf,
 like the ones for the other extra fonts (msam10, etc). The tools for
 doing this are on the jsMath website at

 http://www.math.union.edu/locate/jsMath/authors/making-fonts.html

 but you will have to figure out which TeX font you want to use for the
 \mathsf font. Probably cmss10 would do.

 Davide

More from Davide:

By: Davide P. Cervone (dpvc) - 2009-05-13 21:43
OK, I built the cmss10 font files and put them on the extra-fonts
download page at

http://www.math.union.edu/~dpvc/jsMath/download/extra-fonts/

where you can download the image fonts to install on your server, and
the TTF files for your clients. Loading the cmss10 font will cause the
\mathsf command to be defined. It is also possible to make the \mathsf
command be predefined to load the cmss font when it is first used (so
you don't have the overhead of loading the cmss font when it is not
used). To do this, use the commands

jsMath.Macro(mathsf,{\\cmss #1},1);
jsMath.Extension.Font(cmss);

Hope that takes care of your needs.

Davide

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---



[sage-support] Re: cube roots

2009-05-13 Thread Robert Bradshaw

On May 13, 2009, at 9:11 PM, Bill Page wrote:

 On Wed, May 13, 2009 at 11:54 PM, Robert Bradshaw wrote:

 This is because the branch in which the positive real root is real is
 taken. We're opting for continuity and consistency with complex  
 numbers.


 If I wrote:

 sage: ComplexField(53)(-2.0)^(1/3)
 0.629960524947437 + 1.09112363597172*I

 that looks ok to me, but

 sage: RealField(53)(-2.0)^(1/3)
 0.629960524947437 + 1.09112363597172*I

 looks very strange. Could you explain the advantage?

I can try :)

sage: a
-2.00
sage: a^(1/3)
# what should happen here?

The real field automatically promotes to complex in many instances  
(e.g. sqrt, or all other non-integral powers or negative numbers), so  
that's why I don't find it too strange. Also, it provides continuity  
in the exponent:

sage: [(-2.0)^a for a in [0..1, step=1/10]]

[1.00,
  1.01931713553736 + 0.331196214043796*I,
  0.929316490603148 + 0.675187952399881*I,
  0.723648529606410 + 0.996016752925812*I,
  0.407750368641006 + 1.25492659684357*I,
  8.65956056235493e-17 + 1.41421356237309*I,
  -0.468382177707358 + 1.44153211743623*I,
  -0.954859959434831 + 1.31425198474794*I,
  -1.40858040033850 + 1.02339356496073*I,
  -1.77473421303888 + 0.576646101394740*I,
  -2.00]

I would find it odd if every other value here were real.

Note that we're not the only ones doing this:

sage: mathematica((-2.0)^(1/3))
  0.6299605249474367 + 1.0911236359717214*I
sage: maple((-2.0)^(1/3);)
  .6299605250+1.091123636*I
sage: matlab((-2.0)^(1/3);)
 0.6300 + 1.0911i
sage: pari((-2.0)^(1/3);)
  0.629960524947437 + 1.09112363597172*I

- Robert

--~--~-~--~~~---~--~~
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
URLs: http://www.sagemath.org
-~--~~~~--~~--~--~---