Ask Your Question

Mathemage's profile - activity

2018-11-14 04:43:27 -0500 received badge  Famous Question (source)
2018-11-14 04:43:27 -0500 received badge  Notable Question (source)
2018-10-03 13:08:56 -0500 received badge  Notable Question (source)
2018-10-03 13:08:56 -0500 received badge  Popular Question (source)
2018-05-21 22:02:00 -0500 received badge  Notable Question (source)
2017-12-09 01:09:41 -0500 received badge  Famous Question (source)
2017-06-22 08:57:07 -0500 received badge  Taxonomist
2017-03-13 09:26:44 -0500 received badge  Popular Question (source)
2016-11-26 19:16:45 -0500 received badge  Popular Question (source)
2016-05-20 07:38:28 -0500 received badge  Notable Question (source)
2015-12-30 22:01:46 -0500 received badge  Popular Question (source)
2015-10-30 05:36:48 -0500 received badge  Popular Question (source)
2012-08-12 07:07:08 -0500 answered a question invoke external program

I apologize to everyone for my inconvenience. The heart of problem was my making of a rookie mistake. When creating TeX file, I didn't close the file properly. Namely, instead of

file_handler.close()

I typed

file_handler.close

Without brackets, the final \end{document} did not take effect which caused the missing '\end' problem.

2012-08-12 07:01:48 -0500 commented question invoke external program

Yes, right, it is. I've already found out the cause of problem - I'm gonna write the solution in a few minutes...

2012-08-12 04:50:09 -0500 received badge  Editor (source)
2012-08-10 09:10:26 -0500 asked a question invoke external program

What is the proper way to call external applications in my programs? Specifically, pdfLaTeX compiler. When I invoke os.system("pdflatex foo.tex") in Sage's CLI console, the command executes as expected. However, when I embedded this into my code and run this code, TeX asks for another input:

This is pdfTeX, Version 3.1415926-1.40.10 (TeX Live 2009/Debian)
entering extended mode
(/tmp/foo.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
)
* [blinking cursor here]

Am I missing something or why doesn't this work?

P. S. My original post may have been confusing. When I wrote:

However, when I embedded this into my code and run this code,

I meant embedding into "my_code.sage" source code, which is consequently attached and run in Sage's CLI.

P. P. S. When use it in my "foo.sage" code as below:

os.system("pdflatex -interaction=batchmode foo.tex")

following log is produced:

(/tmp/foo.tex
LaTeX2e <2009/09/24>
Babel <v3.8l> and hyphenation patterns for english, usenglishmax, dumylang, noh
yphenation, loaded.
)
! Emergency stop.
<*> /tmp/foo.tex

*** (job aborted, no legal \end found)

However, written explicitly in Sage's console and even in bash console, everything compiles correctly. Does this mean something? Just FYI, I did end my source file with \end{document}

2012-07-20 23:36:59 -0500 commented question compile TeX from Sage

Hmm, that sounds interesting - you mean like splitting up computational and presentation part and make a *template* in (Sage)TeX with desired format? I'm just a little bit afraid if SageTeX is powerful enough. Specifically can I typeset sth conditionally (like `if` command)? Some properties of the function (*even, constant, periodic*...) would be nice to omit when they're N/A to show...

2012-07-20 08:31:04 -0500 commented question compile TeX from Sage

Yes, sth exactly like that. My task is to do some basic investigations about a given real-valued function (stationary/inflection points, intervals of monotonicity, asymptotes...) a and give out a nice dvi/pdf. Because of computational part it should stay in Sage/python code. Maybe the SageTeX is the solution (I haven't got into its depts yet) - some way to compile SageTeX's source file from Sage's command line (so that I could call it in my program)?

2012-07-20 07:50:57 -0500 commented question compile TeX from Sage

I know what you mean & I did think about this way for quite a long time. But the truth is this my college project - which should be own Sage/Python library, not TeX project. Or maybe I just misunderstood the idea around SageTeX & it can processed via Python/Sage - is it somehow *"doable"*?

2012-07-20 02:04:46 -0500 marked best answer convert expression to function

Does it answer the question ?

sage:s=sin(x)                                                                  
sage: s
sin(x)
sage: f=s.function(x)
sage: f
x |--> sin(x)
2012-07-20 02:03:01 -0500 marked best answer convert expression to function
sage: s = sin(x)
sage: f(x) = s
sage: f
x |--> sin(x)

No deprecation warning! What's going on here is that s(x) was really trying to evaluate your symbolic expression s at the point x - which happened to be a variable, but is still deprecated. If you use the transitive property, the above is just saying

sage: f(x) = sin(x)

which is what you want, as opposed to

sage: f(x) = sin(x)(x)

in your first attempt, which is perhaps ambiguous.

2012-07-20 02:01:45 -0500 received badge  Organizer (source)
2012-07-20 02:00:23 -0500 asked a question compile TeX from Sage

Hola!

I'm working on a program which should output the results of its computations in form of a typesetted document (ideally pdf from pdflatex).

I'm trying to perfrom the final presentation part via view function, however, that doesn't seem to be the most convenient way (since view is aimed at typesetting LaTeX formulas of elements of a list). A lot of hidden code (headers, turned on math modes etc.) are really unpleasent to get around.

I'm pondering about generating an explicit .tex source code file. How can I call TeX compiler from Sage? I.e. how to compile it automatically in an own program, similarly as view does it?)

ThanX in advance!

Sage 5.1 Kubuntu 12.04

2012-07-18 04:01:29 -0500 received badge  Scholar (source)
2012-07-18 04:01:29 -0500 marked best answer Existence of a limit

Hi as far as I understand the problem is that oo so on are symbolic expressios. If you try to compare them with == sage returns as a new symbolic expression the symbolic equationion:

var('x,y')
print x==y
print type(x==y)

returns

x == y
<type 'sage.symbolic.expression.Expression'>

A soultion seems to be to cast the symbolic equation to a boolean:

print bool(x==y)
print bool(x==x)

which returns

False
True
2012-07-18 04:01:12 -0500 commented answer Existence of a limit

ThanX, the `SR('ind')` *hack* solved my problem :-)

2012-07-18 04:00:09 -0500 answered a question Existence of a limit

ThanX, the SR('ind') "hack" solved my problem :-)

2012-07-18 03:06:14 -0500 commented answer Existence of a limit

Unfortunately, `ind` is unknown to sage for some reason: sage: bool( lim(sin(x), x=oo) == ind) --------------------------------------------------------------------------- NameError Traceback (most recent call last) NameError: name 'ind' is not defined

2012-07-18 00:04:23 -0500 asked a question Existence of a limit

How does one (i.e. automatically in an own program) recognize existence of a limit?

So far I've discovered that -oo, oo, ind, und cause the non-existence, I just dunno how to test these "values". Obvious

if limit(f, x=oo, dir='+') == und:
  ...

does not work...

Sage 5.1 Kubuntu 12.04

2012-06-07 06:36:23 -0500 asked a question Typesetting text in TeX view()

Is there a standard way to typeset TeX formulas together with normal text via view()?

So far I've been using

tex_string = "\hbox{- stationary points: }"
for pt in stats:
    tex_string += latex(pt)
    tex_string += ", " 
view(tex_string)

where stats is a list of some points (defined with formulas).

2012-05-31 11:59:00 -0500 commented answer convert expression to function

Great, sounds perfect!! Any way to do this without knowledge of expression's default variable? Say, if I get only the "s", can I do a makeover to function in a universal way?

2012-05-20 10:47:09 -0500 received badge  Supporter (source)
2012-05-20 10:47:03 -0500 commented answer convert expression to function

Still giving out same DeprecationWarning but seems to be proper method...

2012-05-20 02:55:47 -0500 received badge  Student (source)
2012-05-19 23:52:44 -0500 asked a question convert expression to function

Hola,

is there a way to convert symbolic expression to proper functions?

E. g. s = sin(x) into x |--> sin(x)

So far I've been using f(x) = s(x), however, deprection warnings occur:

DeprecationWarning: Substitution using function-call syntax and unnamed arguments is deprecated and will be removed from a future release of Sage; you can use named arguments instead, like EXPR(x=..., y=...)