Ask Your Question

shahuwang's profile - activity

2022-05-25 05:56:49 +0200 received badge  Famous Question (source)
2022-05-25 05:56:27 +0200 received badge  Notable Question (source)
2016-06-11 05:01:53 +0200 received badge  Popular Question (source)
2016-05-04 06:50:53 +0200 received badge  Popular Question (source)
2016-04-23 00:29:25 +0200 received badge  Popular Question (source)
2015-02-16 12:53:26 +0200 received badge  Notable Question (source)
2013-11-06 09:14:29 +0200 received badge  Notable Question (source)
2013-10-27 21:56:28 +0200 received badge  Nice Question (source)
2013-04-07 01:58:33 +0200 received badge  Popular Question (source)
2012-11-24 23:22:11 +0200 received badge  Popular Question (source)
2012-08-03 08:16:57 +0200 commented question Vertical and horizontal span on plots

Actually,Sage's plot module is a wrapper of matplotlib, so you can use Matplotlib directly

2012-08-01 03:39:24 +0200 answered a question sage install issues, permissions

I think is the "sage",I mean the script file "sage" has no privilege to be executed. you can type this command to have a try: sudo chomd a+x /path/to/sage

2012-08-01 03:28:42 +0200 commented answer A bug in graphics.py

I got a account of sage develop trac,which the user name is shahuwang,and I also map it to my real name on the list.Thanks again!

2012-07-31 11:22:30 +0200 answered a question Tensor products in Sage

May be you can have a try of theano http://deeplearning.net/software/theano/

2012-07-31 11:01:10 +0200 commented answer A bug in graphics.py

I see it,thanks to review it,wish I can help more

2012-07-03 15:00:20 +0200 marked best answer Emacs IPython Notebook

perhaps someone can forward this to the sage trac or provide it a tracking number (if the idea has not been considered already).

2012-07-03 11:38:43 +0200 asked a question Emacs IPython Notebook

I found a perfect Emacs project ,which is called Emacs IPython Notebook. It can connect to a running IPython notebook server, and work as the IPython notebook do in browser.

Maybe it can provide some ideas for Sage-mode. Without syntax highlight and line number shown in the textarea, it is hard to deal with long code.

2012-06-26 10:28:11 +0200 commented question A bug in graphics.py

I update my question with my solution posted.

2012-06-25 13:40:08 +0200 commented answer Why Sage can not plot Chinese label

Yes , it is my pleasure.But I don't know how to do so, as I have no experience on software development. Is it ok to send Email to you to submit my solution?

2012-06-25 13:35:40 +0200 commented question A bug in graphics.py

I see that you post a problem in the "Trac 13161" of Korean , the problem is the same with me as matplotlib come with some fonts only support ASCII. So I think you should put more free fonts in matplotlib and make some change in matplotlibrc

2012-06-25 13:25:02 +0200 commented answer A bug in graphics.py

It takes some time to set the matplotlibrc file,as it come with no font that support Chinese.It seems that there are only fonts that support ASCII .I wish next released to get the matplotlibrc setted to support unicode and with some free fonts to support non-ASCII used countries such as China,Japan. Wish to help more

2012-06-25 13:06:18 +0200 received badge  Nice Question (source)
2012-06-25 12:39:39 +0200 received badge  Self-Learner (source)
2012-06-25 12:39:39 +0200 received badge  Teacher (source)
2012-06-25 11:33:33 +0200 answered a question Why Sage can not plot Chinese label
2012-06-25 11:00:49 +0200 asked a question A bug in graphics.py

Several hours ago I post my question about unicode support in "axes_labels",here is my question

I am sure this is really a bug of sage,I don't know how to report this bug as the spreadsheets.google.com is block by Chinese government.

As we know that Matplotlib supports unicode with some setting in "matplotlibrc",and I make it work with Chinese characters now.But when I want to set the axes labels to some Chinese characters with "axes_labels" attribute ,I got exception:"UnicodeEncodeError: 'ascii' codec can't encode character u'\u6211' in position 0: ordinal not in range(128)"

After I changed some code in sage/local/lib/python/site.py,I set the default encoding to "utf-8",that exception never raise again.But the problem does not be solved as the Chinese characters shown in the axes labels all become boxs like [].

Why I can set the axes labels in Chinese with matplotlib but can not in sage? After I check the source code in

SAGE/local/lib/python2.7/site-packages/sage/plot/graphics.py

In line 634 of the method "def axes_labels(self, l=None)",I found the line is

self.__axes_labels = (str(l[0]), str(l[1]))

It is obviously that the problem is caused by the str(),after change this line to

self.__axes_labels = (l[0], l[1])

and remove the SAGE/local/lib/python2.7/site-packages/sage/plot/graphics.pyc,restart sage , I finally got this problem solved.Now Sage gets no problem to work with Chinese,or in other word,gets no problem to work with unicode(utf-8).

There is some work to do with matplotlibrc,it is in sage/local/lib/python/site-packages/matplotlib/mpl-data

First,we need to download one free unicode font,more information can refer to WikiPedia,and I use Bitstream Cyberbit for a test.I think there are more better unicode fonts.Bitstream Cyberbit can work well with Chinese,Japanese,Korean in my test.

After unzip the downloaded file,get the Cyberbit.ttf and put it into sage/local/lib/python/site-packages/matplotlib/mpl-data/fonts/ttf.And then open the matplotlibrc,remove the "#" which at the begin of

font.family : sans-serif

font.style : normal

font.variant : normal

font.weight : medium

font.stretch : normal

It seems that only sans-serif and serif can work well with unicode.

And then ,remove the "#" at the begin of "font.sans-serif " in line 129,add "Bitstream Cyberbit" after ":",it must put on the first,like:

font.sans-serif : Bitstream Cyberbit,Microsoft YaHei,Bitstream Vera Sans, Lucida Grande

It also needs to remove the "#" in the begin of axes.unicode_minus,and set the boolean value to "False",for example:

axes.unicode_minus : False

Save this file and restart Sage,know we can test it with:

plot(x,axes_labels=['z',u'???????'])

It seems that this website does not support unicode.Don't forget the "u" .

The Bitstream Cyberbit,though work well with unicode,I think it is not so beautiful.Maybe there is better one.

It ... (more)

2012-06-25 04:59:18 +0200 received badge  Editor (source)
2012-06-25 04:53:57 +0200 asked a question Why Sage can not plot Chinese label

I know that Matplotlib does not support UTF-8 without some change in matplotlibrc,So I edit the matplotlibrc and now when plot with matplotlib in sagenb,it supports UTF-8 now and it can show Chinese now.
But for the sage plot function, when I want to set label with some Chinese characters,it raise exception :
UnicodeEncodeError: 'ascii' codec can't encode character u'\u6211' in position 0: ordinal not in range(128).
After I set the default encoding to UTF-8 in site.py,this exception does not raise again,but the Chinese characters are shown as box like []. Below is my code:

p1=plot(sin,(-2*pi,2*pi),thickness=2.0,rgbcolor=(0.5,1,0),legend_label='sin(x)')
p2=plot(cos,(-2*pi,2*pi),thickness=3.0,color='purple',alpha=0.5,legend_label='cos(x)')
plt=p1+p2
x = u'\xd6\xd0\xb9\xfa\xc8\xcb'

plt.axes_labels((x,'y'))
show(plt)

Is there any solution? I am sorry, it seems that this web site does not support Chinese, so I change the x

2012-05-25 11:13:50 +0200 answered a question using 'R' in sage: can not plot. errors of X11 and PNG

Two setup to do so: command:sage -f r it will rebuilt the R in sage to enable plotting support. and then: png() x<-c(12,2,4) y<-x plot(x,y) dev.off()

2012-05-25 11:11:34 +0200 received badge  Scholar (source)
2012-05-25 11:11:34 +0200 marked best answer Is there more documentation about how to call R in Sage?

The current way to do this is

r('cars').subset(select='"speed"')

or

r.subset('cars', select='"speed"')

You need to use double quotes for strings when passing them into the interface. Otherwise, speed will be treated as an "identifier" rather than a string. Additionally,

r('cars')['"speed"']

also works.

2012-05-14 13:19:27 +0200 received badge  Nice Question (source)
2012-05-13 14:30:18 +0200 asked a question Is there more documentation about how to call R in Sage?

In R,there is built-in data,for example,the "cars" data which contains two columns,one is "speed",and the other one is "dist".When in Sage,how can I access the speed and dist data?r.cars("speed") alter an error "Unknown environment "table" ",so,is there any solution?

2012-05-13 02:29:48 +0200 commented answer May there is a bug in notebook

I know that when calls R with Sage,the dot will convert to underscores.But even when I set the "system" to R with combo box above in notebook,the dot will convert to underscores,and that is the problem.

2012-05-08 15:24:29 +0200 received badge  Student (source)
2012-05-08 11:18:08 +0200 asked a question May there is a bug in notebook

I'd like to use R in notebook worksheet. I mean, I have the R evaluation chosen at the top, and when I use TAB to call auto completion I do not get correct names.

For example,after I hit "shapiro" and press TAB ,the auto-completion returns "shapiro_test",but in R,this function is "shapiro.test".

Many other function with "." are returned instead of "_".Is there any solution?