Ask Your Question

Mitesh Patel's profile - activity

2019-02-04 15:32:05 +0100 received badge  Great Answer (source)
2019-01-10 05:48:42 +0100 received badge  Popular Question (source)
2017-06-16 16:51:24 +0100 received badge  Nice Answer (source)
2014-06-29 03:13:14 +0100 marked best answer Is it possible to get implicitly multiplied output?

With implicit_multiplication(True), we can enter expressions using spaces instead of * to separate multiplied subexpressions:

sage: var('x, y, z') sage: implicit_multiplication(True) sage: 3 x^4 y + 2 z sin(x z 3 y) - 3 y^2 3*x^4*y - 3*y^2 + 2*z*sin(3*x*y*z)

This works similarly for polynomials.

Is it possible to set (or implement practically) an option that automatically postparses output to use implicit multiplication? For example,

sage: R.<a,b,c> = QQ[]; R Multivariate Polynomial Ring in a, b, c over Rational Field sage: implicit_multiplication_output(True) sage: R.random_element() 1/7 a b - 1/4 a c - c^2 + c

2013-08-29 00:40:07 +0100 received badge  Taxonomist
2011-12-21 20:25:37 +0100 received badge  Good Answer (source)
2011-03-21 18:43:37 +0100 received badge  Nice Answer (source)
2011-02-07 11:21:13 +0100 received badge  Nice Answer (source)
2011-02-07 11:21:13 +0100 received badge  Good Answer (source)
2010-12-20 09:59:55 +0100 commented answer working directory for load/attach

Thanks for the correction, Felix!

2010-12-19 22:16:19 +0100 answered a question working directory for load/attach

Sage 4.6.1 will allow you to specify a load/attach search path, which may also help. With the merged changes (ticket #378), you'll be able to consult load_attach_path? and reset_load_attach_path? for usage and examples.

2010-11-29 15:47:45 +0100 received badge  Self-Learner (source)
2010-11-03 05:58:16 +0100 commented question How to define a smart class using cython?

Could you give some more information, e.g., examples, about your problem and what your class should do?

2010-10-27 23:22:55 +0100 commented answer What features should we add to this site?

It works. Thanks!

2010-10-23 07:01:35 +0100 answered a question How to output from sage

It's possible to redirect sys.stdout and sys.stderr temporarily to files. See Example 10.9. Redirecting output from Mark Pilgrim's Dive into Python.

Note: Redirecting stdout will also send the Sage prompt sage: to the output file. You can suppress most of the prompt with sage.misc.interpreter.set_sage_prompt(''). I don't know if it's also possible to remove the colon that IPython inserts.

And also by the way, you might find IPython's "magic" %logstart and %logstop commands somewhat useful. See %logstart? for options.

2010-10-22 20:33:07 +0100 answered a question What features should we add to this site?

Would it be possible to include optionally the entire (unformatted) content of new questions, answers, and comments in the subscription emails? And possibly for updates, the before and after versions or a simple diff of the changes?

edit: this should be working now, edited in the post so that you could see whether the feature works for you or not.

2010-10-18 07:01:18 +0100 commented question GRE Math Subject Test Sample Question #1

Perhaps we could use a decorator to augment docstrings with "See Also:" or other sections. Could you post to sage-devel about your request?

2010-10-17 19:19:44 +0100 commented question GRE Math Subject Test Sample Question #1

I think this is to avoid squashed plots, e.g., `parametric_plot((100*cos(x), sin(x)), (x, 0, pi), aspect_ratio=1)`.

2010-10-17 18:55:20 +0100 commented question GRE Math Subject Test Sample Question #1

Should we use the plot option `aspect_ratio=1` here to make the semicircle appear more circular?

2010-10-16 23:55:05 +0100 answered a question smith normal form RAM limits?

Some additional data: On the main Sage development machine, a 24-core Linux server with 128 GB of RAM, I get

sage: m = matrix(ZZ, 500, 3000, [1..500*3000])
sage: m.smith_form()
(500 x 3000 dense matrix over Integer Ring, 500 x 500 dense matrix over Integer Ring, 3000 x 3000 dense matrix over Integer Ring)
sage: get_memory_usage()

for example, after about one hour of crunching. According to top, the python process is using 7.2 GB of memory.

According to m.smith_form?? and m.elementary_divisors??, both methods both use PARI's matsnf function but with different arguments (1 and 0, respectively). Unfortunately, I'm not familiar with the algorithm(s) it uses, the particular implementation(s), or whether they can be parallelized, etc. Please see John Palmieri's answer for a much more practical... answer.

2010-10-16 22:22:52 +0100 commented answer What features should we add to this site?

Thanks! Thanks!

2010-10-14 23:11:12 +0100 received badge  Teacher (source)
2010-10-14 23:11:12 +0100 received badge  Student (source)
2010-10-14 23:11:10 +0100 received badge  Supporter
2010-10-14 23:11:10 +0100 received badge  Scholar (source)
2010-10-14 23:11:10 +0100 received badge  Editor (source)
2010-10-13 19:36:30 +0100 commented answer latex(-(x-1)/(x+1)) still broken

We've merged several Pynac improvements and fixes, including one for the LaTeX fraction sign problem, into Sage 4.6.alpha3.

2010-10-13 19:26:43 +0100 answered a question What is your favorite way to debug sage code?

Testing MathJax: [\alpha\beta\gamma]

2010-10-13 19:23:20 +0100 answered a question What is your favorite way to debug sage code?

Here's one way to use Emacs' Grand Unified Debugger (GUD) with the Sage library:

  • Ensure sage is in the PATH.
  • cd SAGE_ROOT
  • cp local/lib/python/ .
  • Change the first line of to #!/usr/bin/env sage
  • Run emacs and type M-x pdb + <ENTER>
  • Use Run pdb (like this): ./ to debug


  • should contain a statement like from sage.all import *, in order to use Sage library code.
  • The code in should not require the Sage preparser. You'll need to use R = PolynomialRing(QQ, 'a,b,c'), for example, instead of R.<a,b,c> = QQ[].

I hope there's a better way! But with this approach, stepping into R = PolynomialRing(QQ, 'a,b,c') will make Emacs jump to the appropriate line of

2010-10-10 18:29:56 +0100 commented answer Radical in the denominator?

Mike, if you have the time, could you give us information about your build problem with 4.6.alpha3 on the sage-release mailing list ( )?

2010-10-10 18:27:03 +0100 answered a question Debian Binary Package

Are you referring to the binaries available for download from one of the mirrors listed at here? We'd definitely like to distribute 32 and 64-bit binaries for recent versions of Debian and the other major Linux distributions. It's a matter of people in the Sage community having the interest and enough time to make binaries, or to set up and keep up-to-date virtual machines to which we can "farm out" the task. Unfortunately, at the moment, other tasks beckon.

2010-09-30 00:10:18 +0100 commented answer complex exponential/trigonometric
2010-09-29 07:12:31 +0100 answered a question complex exponential/trigonometric

This works for me in Sage 4.5.3:

sage: x = var('x')
sage: t1 = cos(x)
sage: t2 = e^(I * x) / 2 / I - e^(-I * x) / 2 / I
sage: sageobj(t1._maxima_().exponentialize())
1/2*e^(-I*x) + 1/2*e^(I*x)
sage: sageobj(t2._maxima_().demoivre())

Perhaps there's a simpler way? I don't think we've wrapped Maxima's demoivre and exponentialize in Sage. They're documented here.

2010-09-19 20:19:43 +0100 answered a question where to get python coding tutorial for beginners link PDF

They're not tutorials, but you might find one of the Python quick reference PDF files here useful.

2010-09-19 20:16:00 +0100 answered a question Trying to install sage to SUSE 11.3

It should be OK to leave your system's Readline libraries in place. Recently, someone had success with Sage 4.5.2 on OpenSUSE 11.x with the suggestion described here.

Are you installing a binary downloaded from a Sage mirror? If so, could you try this:

mv local/lib/*readline* /path/to/some/temp/dir

and let us know what happens? If you're compiling from source, wait until the build fails, then try the steps above and restart the build.

We're tracking this problem at ticket #9523.

2010-09-17 08:33:32 +0100 commented question sublist of a given list of objects

Also, please use more appropriate tags than 'help', 'urgent', and 'urgent_1'. There are examples at the 'tags' link above.

2010-09-17 07:17:16 +0100 commented answer sub list like subsets

You could also try, e.g., 'combinations([[1,2], [3,4,5], [6], [7,8,9]], 3)'. (See 'combinations?' for caveats.) There's also 'combinations_iterator'.

2010-09-15 18:28:18 +0100 commented answer move sage server to from

That's great!

2010-09-14 04:16:06 +0100 edited answer move sage server to from

You may be able to use Apache's mod_proxy and VirtualHosts to solve your problem. I suggest looking at ProxyPass, ProxyPassReverse, ProxyPreserveHost, and maybe also mod_rewrite's rewriting directives.

A small example: I appended

<VirtualHost *>
  ProxyPreserveHost On
  ProxyPass    / http://localhost:8000/
  ProxyPassReverse / http://localhost:8000/
  <Location /hg/>

to /etc/httpd/conf/httpd.conf on my Fedora 12 machine. Then, I (re)started Apache with service http restart and separately ran hg serve in a local Mercurial repository. With this setup, I could access the repository at http://localhost/hg/.

You could also try this with a notebook server started with interface='localhost'. In this case, the ProxyPreserveHost directive is important --- it will fix the problem described at #8205.

However, I don't how well this works with secure servers and URLs. You may need to tweak the configuration further. Please let us know!