[sage-support] Re: convertor Sage -> TeX -> PDF
On 2 Nov., 09:08, Stan Schymanski wrote: > Dear Wilfried, > > The tutorial looks great! How did you do the numbered head lines and the > index? Just use ... tags in the notebook. They are converted to \sections{} in the LaTeX file. The the worksheet the sections are not numbered. > Is the sage worksheet itself published somewhere? The worksheet is attached to the PDF. If you click on the graphic on the top left of the first page, you can download the sws file. If you don't have a PDF viewer that supports this, I can put up a direct link to the worksheet. Cheers, Wilfried > Cheers > Stan > > Wilfried_Huss wrote: > > > On 29 Okt., 12:44, "ma...@mendelu.cz" wrote: > > >> Hello all, the conversion into PDF has been discussed several times > >> here. > > >> One option is to print into a PDF file. This is another possibility: > > >> I wrote for myself a simple converter from Sage worksheets to PDF via > >> PDF LaTeX > > > Great, this is exactly what I need. > > >> You can see the outputs in the bulletted list > >> athttp://user.mendelu.cz/marik/sage/ > >> , for examplehttp://user.mendelu.cz/marik/sage/dr.pdf > > >> The initial version of the script is > >> athttp://user.mendelu.cz/marik/sage/sage2tex > >> and is neither cleanly written nor clever too much, but still "better > >> than get a wire into your eye" - as we say in Czech :) > > >> For whom is this topic worth > > >> Feel free to use it or modify as you need. > > > I have modified the skript a little bit. It now first builds a list of > > text-, input- and output > > cells, and then converts each sell to latex. This makes things much > > easier. I also > > added syntax highlighting for python, html and latex input cells, and > > if the output is not > > a tex formula it is put into a verbatim environment. > > > The HTML-LaTeX conversion is still done by a bunch of regular > > expressions, so this > > will need some improvements. But it already works very well. > > > You can find the new version of the script at: > > http://www.math.tugraz.at/~huss/sage/sws2tex.py > > > And here are example outputs: > > http://www.math.tugraz.at/~huss/sage/sage_tutorium.pdf > > http://www.math.tugraz.at/~huss/sage/sws2pdf_test.pdf > > > Would you agree to release your initial script under the GPL or an > > other Sage compatible > > licence? I hope this can be improved to a point where it could be > > included into Sage, for > > this it needs a proper licence. > > > Cheers, > > Wilfried Huss --~--~-~--~~~---~--~~ 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 URL: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: convertor Sage -> TeX -> PDF
On 29 Okt., 12:44, "ma...@mendelu.cz" wrote: > Hello all, the conversion into PDF has been discussed several times > here. > > One option is to print into a PDF file. This is another possibility: > > I wrote for myself a simple converter from Sage worksheets to PDF via > PDF LaTeX Great, this is exactly what I need. > You can see the outputs in the bulletted list > athttp://user.mendelu.cz/marik/sage/ > , for examplehttp://user.mendelu.cz/marik/sage/dr.pdf > > The initial version of the script is > athttp://user.mendelu.cz/marik/sage/sage2tex > and is neither cleanly written nor clever too much, but still "better > than get a wire into your eye" - as we say in Czech :) > > For whom is this topic worth > > Feel free to use it or modify as you need. I have modified the skript a little bit. It now first builds a list of text-, input- and output cells, and then converts each sell to latex. This makes things much easier. I also added syntax highlighting for python, html and latex input cells, and if the output is not a tex formula it is put into a verbatim environment. The HTML-LaTeX conversion is still done by a bunch of regular expressions, so this will need some improvements. But it already works very well. You can find the new version of the script at: http://www.math.tugraz.at/~huss/sage/sws2tex.py And here are example outputs: http://www.math.tugraz.at/~huss/sage/sage_tutorium.pdf http://www.math.tugraz.at/~huss/sage/sws2pdf_test.pdf Would you agree to release your initial script under the GPL or an other Sage compatible licence? I hope this can be improved to a point where it could be included into Sage, for this it needs a proper licence. Cheers, Wilfried Huss --~--~-~--~~~---~--~~ 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 URL: http://www.sagemath.org -~--~~~~--~~--~--~---
[sage-support] Re: bug in region_plot
On 19 Mrz., 18:49, Jason Grout wrote: > Jason Grout wrote: > > Wilfried_Huss wrote: > > >> On 19 Mrz., 16:47, Jason Grout wrote: > >>> ma...@mendelu.cz wrote: > >>>> Hello, this command produces one half of a cirle, not 1/4 as excepted. > >>>> I think that this is a bug in sage 3.4 > >>>> Robert > >>>> region_plot([y>0,x>0,x^2+y^2<3], (-3, 3), (-3, > >>>> 3),plot_points=100,incol='gray').show(aspect_ratio=1) > >>> I get a quarter-circle on my sage 3.4 and on sagenb.org. Can you try on > >>> sagenb.org? > >> This works: > >> sage: var('x,y') > >> sage: region_plot([y>0,x>0,x^2+y^2<3], (x, -3, 3), (y, -3,3)) > > >> But if one leaves out the variables, one gets an half circle: > >> sage: region_plot([y>0,x>0,x^2+y^2<3], (-3, 3), (-3,3)) > > >> I've written a patch which fixes this: > >>http://trac.sagemath.org/sage_trac/ticket/5567 > > > Ah, yes, good catch. For those that want to know, Sage was interpreting > > the first two constraints as functions of one variable, so when it > > plugged in two numbers, Sage behaved as though you had typed x>0, x>0. > > When I did my example, I explicitly put in the variable names (it's a > > good habit to be explicit in plotting), so I got the right plot. > > > There should be a standard function that takes a tuple of functions and > > returns a list of variables for all the functions. This is used all > > over the plotting code, the fast_callable code, now this code, etc. > > Basically, there should be a function that, treating a tuple of > > functions as a vector-valued function, returns the variables used in the > > vector-valued function. > > > Also, I wonder why fast_float is not used? It could drastically speed > > up plots. You could just replace the lines like: > > > s = symbolic_expression(f.rhs() - f.lhs()).function(*variables) > > > with > > > s = fast_float(f.rhs() - f.lhs(), *vars) > > > and you'd probably see at least an order of magnitude speedup. (make > > sure to do "from sage.ext.fast_eval import fast_float" first). > > Actually, I believe that the call to setup_eval_on_grid automatically > does the call to fast_float, so it's probably already happening and we > don't have to worry about anything. Yes > In fact, I think the root of the problem is in > plot/plot3d/parametric_plot3d.py in the adapt_to_callable function (this > is called by setup_for_eval_on_grid, which is in turn called by > region_plot). Observe (and please pardon my debugging in public :) > > sage: from sage.plot.plot3d.parametric_plot3d import adapt_to_callable > sage: var('x,y') > (x, y) > sage: funcs = [x,y] > sage: adapt_to_callable(funcs,2) > > ((, > ), > (y, x)) > > First of all, why in the world are the arguments y, then x? I thought > the convention was alphabetical ordering if an ordering wasn't specified. > > Well, the problem is in this line of adapt_to_callable: > > tuple(sorted(set(sum( [z.variables() for z in f], ()) ))) > > Note: > > sage: sorted(set(sum([z.variables() for z in funcs],( > [y, x] > > and even > > sage: sorted(list(set(sum([z.variables() for z in funcs],() > [y, x] > > For some reason, sorting the list [y,x] doesn't make it [x,y]: > > sage: sorted([y,x]) > [y, x] Well, that is not surprising since x < y is a symbolic equation. We need to sort the variables by name. sage: sorted([y,x], cmp = lambda a,b: cmp(repr(a), repr(b)) ) [x, y] But, fixing the variable order in adapt_to_callable does not solve the problem in region_plot, because setup_for_eval_on_grid calls adapt_to_callable in a loop for one function at a time. > There seem to be other problems too: > > sage: funcs=[x,y,1] > sage: adapt_to_callable(funcs,2) > --- > TypeError Traceback (most recent call last) > > /home/jason/.sage/temp/littleone/16993/_home_jason__sage_init_sage_0.py > in () > > /home/jason/sage/local/lib/python2.5/site-packages/sage/plot/plot3d/parametric_plot3d.pyc > in adapt_to_callable(f, nargs) > 620 except TypeError: > 621 vars = () > --> 622 f = [fast_float_constant(x) for x in f] > 623 > 624 if nargs is not None and len(vars) != nargs: > > /home/jason/sage/local/lib/python2.5/site-packages/sage/ext/fast_eval.so > in sage.ext.fast_eval.fast_float_constant (sage/ext/fast_eval.c:6827)() &g
[sage-support] Re: bug in region_plot
On 19 Mrz., 16:47, Jason Grout wrote: > ma...@mendelu.cz wrote: > > Hello, this command produces one half of a cirle, not 1/4 as excepted. > > I think that this is a bug in sage 3.4 > > > Robert > > > region_plot([y>0,x>0,x^2+y^2<3], (-3, 3), (-3, > > 3),plot_points=100,incol='gray').show(aspect_ratio=1) > > I get a quarter-circle on my sage 3.4 and on sagenb.org. Can you try on > sagenb.org? This works: sage: var('x,y') sage: region_plot([y>0,x>0,x^2+y^2<3], (x, -3, 3), (y, -3,3)) But if one leaves out the variables, one gets an half circle: sage: region_plot([y>0,x>0,x^2+y^2<3], (-3, 3), (-3,3)) I've written a patch which fixes this: http://trac.sagemath.org/sage_trac/ticket/5567 cheers, Wilfried > Also, can you open a fresh worksheet and try the above code, just to > make sure it's not a bug with displaying old images? > > 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: filling area between plots
On 14 Jan., 21:35, "Fabio Tonti" wrote: > I skimmed through it and it looks nice. How do I apply the patch? Should I > just substitute my plot.py with the new one? You can apply a patch in the sage commandline with: sage: hg_sage.import_patch('FILENAME') Then in the system commandline you do sage -b to rebuild. Greetings, Wilfried. > Fabio > > On Wed, Jan 14, 2009 at 7:04 PM, Wilfried_Huss > wrote: > > > > > On 14 Jan., 14:04, "Fabio Tonti" wrote: > > > Hello everyone, > > > > I was wondering whether there is a way to fill the region between two > > plots > > > using the sage "plot" command. > > > I know how to do it in matplotlib and I'm appending a script which does > > > exactly that with matplotlib 0.98.5. > > > There is a patch at > > >http://trac.sagemath.org/sage_trac/ticket/4976 > > > which adds this capability to the plot command. > > Maybe you can help test it. > > > Cheers, > > Wilfried > > > > Thanks in advance. > > > > Fabio > > > > fill.py > > > < 1 KBAnzeigenHerunterladen --~--~-~--~~~---~--~~ 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: filling area between plots
On 14 Jan., 14:04, "Fabio Tonti" wrote: > Hello everyone, > > I was wondering whether there is a way to fill the region between two plots > using the sage "plot" command. > I know how to do it in matplotlib and I'm appending a script which does > exactly that with matplotlib 0.98.5. There is a patch at http://trac.sagemath.org/sage_trac/ticket/4976 which adds this capability to the plot command. Maybe you can help test it. Cheers, Wilfried > Thanks in advance. > > Fabio > > fill.py > < 1 KBAnzeigenHerunterladen --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---