Lately I worked on a project in Computer Vision that involved implementing lot of linear algebra equations in the code. So I had around 2 sheets of math equations which I implemented.
I have scanned the sheets and I put them along side my project code, and as I am LaTeX'ing them now in a separate PDF, am wondering wouldn't it be nice to have these equations in the code comments just above the function that implements it? (something like the IDE being able to generate beautiful equations in the code comments from the LaTeX code I write, does it sound like a good idea?)
Doxygen supports to generate latex files with comments in math mode:
related Doxygen docs
However, it wouldn't show up in your IDE.
It's called literate programming. Google it.
Related
Is there a ready template to run evolutionary\genetic algorithms in R?
I am interested in a code that would allow me to add graphical output and user input between iterations.
Thanks for reading!
p.s. found this posting Is there any Genetic Programming code written R
I don't know about genetic programming code written in R, but there is a program called HeuristicLab you can use.
There you can add an External Evaluator in R code and there you can add your graphical output.
Here is a link on how to do it:
http://dev.heuristiclab.com/trac/hl/core/wiki/UsersHowtosOptimizingExternalApplications
Its an open source program and the staff that wrote it usually answers any question you have very quickly.
Here is the download page: http://dev.heuristiclab.com/trac/hl/core/wiki
good luck!
Yep, i think http://rsymbolic.org/projects/show/rgp is exactly what you're looking for.
I'm in the process of documenting some of my functions for an R package I'm making.
I'm using roxygen markup, though that is largely irrelevant to my question.
I have put equations into my documentation using \deqn{...}. My question is:
Is there a way to cross-reference this equation later on?
For example, in my Rd file:
\deqn{\label{test}
y = mx + b
}
Can I later do something like:
Referring to equation \ref{test}, ...
I've tried \eqref{test}, \ref{test} (which both get "unknown macro" and don't get linked ), and also \link{test} (which complains it can't find function test because it's really just for linking to other functions).
Otherwise I fear I may have to do something hacky and add in the -- (1) and Refer to equation (1) manually within the \deqn etc in the Rd file...
Update
General answer appears to be "no". (awww...)
However, I can write a vignette and use "normal" latex/packages there. In any case, I've just noticed that the matrix equations I spent ages putting into my roxygen/Rd file look awful in the ?myFunction version of the help (they show up as just-about literal latex source). Which is a shame, because they look beautiful in the pdf version of the help.
#Iterator has pointed out the existence of conditional text, so I'll do ASCII maths in the .Rd files, but Latex maths in the pdf manual/vignette.
I'm compiling my comments above into an answer, for the benefit of others.
First, I do not actually know whether or not .Rd supports tagging of equations. However, the .Rd format is such a strict subset of LaTeX, and produces very primitive text output, that shoehorning extensive equations into its format could be a painful undertaking without much benefit to the user.
The alternative is to use package vignettes, or even externally hosted documentation (as is done by Hadley Wickham, for some of his packages). This will allow you to use PDFs or other documentation, to your heart's content. In this way, you can include screenshots, plots, all of the funkiest LaTeX extensions that only you have, and, most significantly, the AMS extensions that we all know and love.
Nonetheless, one can specify different rendering of a given section of documentation (in .Rd) based on the interface, such as text for the console, nice characters for HTML, etc., and conditional text supports that kind of format variation.
It's a good question. I don't know the answer regarding feasibility, but I had similar questions about documenting functions and equations together, and this investigation into what's feasible with .Rd files has convinced me to use PDF vignettes rather than .Rd files.
I have a scientific paper under review, and a referee asked for my R code to be provided as a Sweave document. I've never heard of Sweave before, do you know what's the better way to do it?
Thanks a lot :-)
This seems a very unusual request in my opinion. I can understand a referee expecting you to provide reproducible code, but requiring a specific format is over-the-top. I would respond by providing your code. Sweave is not standard practice for academic journals.
A quick google can lead you to a lot of good resources:
http://www.stat.uni-muenchen.de/~leisch/Sweave/
http://www.stat.umn.edu/~charlie/Sweave/
http://jeromyanglim.blogspot.com/2010/02/getting-started-with-sweave-r-latex.html
http://en.wikipedia.org/wiki/Sweave
See my answer to this question: Getting R plots into LaTeX?
I personally recommend using either LyX or Eclipse (with StatET and TeXlipse) for this, although there are many options for editing LaTeX out there.
Edit:
If your script takes a long time to run, then you can also look at the cacheSweave package.
I would like to use Python to generate my own algebra to pre-calculus worksheets to print and use. The purpose is to teach kids how to practice algebra. What is the best way generate the expressions?
Update:
I am planning to use Latex to generate nicely formatted equations.
The question I have is how to come up with a large number of the equations. One way of doing this is to define the list for each topics but this is tedious. I want to automate using some kind generator (e.g. Context Free Grammar)
If you want to generate nice looking typeset equations, you should probably output LaTeX code, which can then be compiled into pdf, dvi, postscript, or what have you. There are a few python libraries for this, but it's just text so generating it shouldn't be much of a problem once you know how it works. Alternatively, you can embed python code into a LaTeX document using something like this. In any case I haven't tried any of the python libraries for this so I can't really recommend any of them.
My approach to this problem would be to write a Python script to generate a LaTeX document which could then be compiled into a PDF document to be printed.
I assume that you want Python so that the sheets are different.
One way to do this would be to generalize the structure of an equation. The simplest ones are properly those that are of the form:
a*x+b*x+c=d*x+e*x+f
(any of the values can be 0, and they need not be distinct). Then I would suggest you simply constructed a method to return the latex code to typeset such an equation, which puts in random values for a, b, c, d, e and f.
You can then call that method as many times a you want different equations.
I've been looking for some time for a word processor to use for writing technical papers and I haven't really found one. What would really be nice to have is an editor that can handle mathematical expressions, code, and pseudo-code fairly well. I have yet to find one that works very well.
Does anyone have any recommendations?
I personally believe in LaTeX.
Benefits:
You can focus on content over form.
Use logical rather than semantic formatting (e.g., \methodname vs. just italic).
Easier to assemble large documents from multiple files.
Use text-based version control (CVS/SVN/etc.)
Widely used
Much more stable even on super-weak machines
Programmable. For example, I use macros to hide stuff, highlight stuff, obfuscate names by using a macro name with the real name but an obfuscated replacements.
See all the tips and tricks available on SO.
Output looks the same no matter which platform you compile on. Never had that luck with word, each version and each machine produces something slightly different.
My answer's long, so I want to say up front: I think you want OpenOffice Writer (I use v2.4, haven't tried 3.0 yet).
I've used Word with equation editor and LaTeX heavily in the past and OpenOffice Writer
more recently. I used the former two while writing my thesis.
LaTeX may still have advantages in quality of the output and in the ability to use text-based version control, but they're sharply diminished by OO Writer at this point.
Microsoft with equation editor, even the most recent versions, seems very weak still.
What I like about OpenOffice is that you can use the equation formatting mechanisms
in a mode where the window is split between the document you're writing and another
area where you can type very LaTeX-like formatting instructions. One of the big
strengths of LaTeX is that you get to type up something like $x \in S$ for "x is an element of S". OO Writer lets you do this and see the result.
Back when I wrote my thesis, LaTeX was preferable to Word with Eqn. Editor because of the length of my document (over 200 pages), the quality of the results, and the ease of specifying equations. LaTeX does have a disadvantage in simplicity of use that is made more acute by OO Writer.
That said, I'm sure I'd use OO Writer for conference to journal length articles (~8-15 pages v. ~15-40 pages) and also for shorter work. For thesis-length work, I'm not sure which I'd end up using: Word never worked so well for me on longer matter; I suspect OO Writer is better behaved but I don't have enough experience of it to make a firm judgement.
I like LyX (http://www.lyx.org/) -- it's a good tradeoff between "spending all your time writing your document" and "spending all your time writing markup". The most recent versions are even useable!
Apart from that, Word 2008 is actually pretty darn good, provided you use the styles and other "advanced" features.
I fully agree that LATEX is a good choice. I've used for paper in univ, including my master thesis. For LATEX I've been using Kile.
But nowadays there is interesting alternative which is DocBook with MathML extension.
LaTeX with TexMaker got me through grad school.
Depends on what you mean by "Word Processor". If you don't mind not having a WYSIWYG interface, I'd recommend LaTeX (http://www.latex-project.org/).
I wrote my final year Master's dissertation using it, which contained a lot of pseudocode, formulas, etc. Also outputs in a format fairly typical of technical papers.
I use FrameMaker.
MS Word with Mathtype. It has a number of advantages over the default Equation editor, including, but not limited to:
keyboard shortcuts
writing equations in tex mode then converting them
converting equations from "normal" to "linear" mode (the one you can use in your programs, you know a=b/c and such)
templates
no more latex. I can concentrate on the material, not the writing
Word with MS Equation for the mathematical sections.
I like DocBook and use FOP to create PDFs from it.
I use reStructuredText because it can be used in Trac, converted to PDF and HTML, have little markup overhead, and looks nice in its plain form too.
Microsoft Word is considered as the market standard word editor.
My suggestion is for you to use Authorea.
As a former postdoc (Astrophysics) and Ph.D. (Informatics) with 12+ years research experience (Harvard, CERN, UCLA), I have written technical papers for a long time. I have loved and hated LaTeX. For the past 2 years, I have worked with friends and colleagues at developing the next generation platform for writing technical/research documents collaboratively. It is called Authorea. From a technical standpoint Authorea is built on Git and takes LaTeX, Markdown, HTML (even JS, to include fancy d3.js in your papers). Bonus: you don't need to know LaTeX (or any other format) but you can easily add equations, tables, citations, and data to your papers. I hope you'll find it useful.