Simplifying the following mathematical expression using a computer? - math

I have this following beastly expression typed up very nicely in LaTeX formatting, as you can see. What is the easiest way that I can get a computer to simplify this expression for me? I have zero programming experience. I installed sagemath but it seems pretty complicated.
$W_{(1,1)}(t,v)=\frac{-t^{-2k}v^k}{3}(\frac{v^{\frac{3}{2}}-v^{\frac{-3}{2}}}{t^{\frac{3}{2}}-t^{\frac{-3}{2}}})(\frac{v^{\frac{1}{2}}-v^{\frac{-1}{2}}}{t^{\frac{1}{2}}-t^{\frac{-1}{2}}})+\frac{t^{-2k}v^k}{4}(\frac{v-v^{-1}}{t-t^{-1}})^2+\frac{t^{-2k}v^k}{12}(\frac{v^{\frac{1}{2}}-v^{\frac{-1}{2}}}{t^{\frac{1}{2}}-t^{\frac{-1}{2}}})-\frac{t^{-k}v^k}{4}(\frac{v^2-v^{-2}}{t^2-t^{-2}}) + \frac{t^{-k}v^k}{8}(\frac{v-v^{-1}}{t-t^{-1}})^2+\frac{t^{-k}v^k}{4}(\frac{v-v^{-1}}{t-t^{-1}})(\frac{v^{\frac{1}{2}}-v^{\frac{-1}{2}}}{t^{\frac{1}{2}}-t^{\frac{-1}{2}}})^2-\frac{t^{-k}v^k}{8}(\frac{v^{\frac{1}{2}}-v^{\frac{-1}{2}}}{t^{\frac{1}{2}}-t^{\frac{-1}{2}}})^4+\frac{-v^kt^{k}}{4}(\frac{v^2-v^{-2}}{t^2-t^{-2}})+\frac{v^kt^{k}}{3}(\frac{v^{\frac{3}{2}}-v^{\frac{-3}{2}}}{t^{\frac{3}{2}}-t^{\frac{-3}{2}}})(\frac{v^{\frac{1}{2}}-v^{\frac{-1}{2}}}{t^{\frac{1}{2}}-t^{\frac{-1}{2}}})+\frac{v^kt^{k}}{8}(\frac{v-v^{-1}}{t-t^{-1}})^2-\frac{v^kt^{k}}{4}(\frac{v-v^{-1}}{t-t^{-1}})(\frac{v^{\frac{1}{2}}-v^{\frac{-1}{2}}}{t^{\frac{1}{2}}-t^{\frac{-1}{2}}})^2+\frac{v^kt^{k}}{24}(\frac{v^{\frac{1}{2}}-v^{\frac{-1}{2}}}{t^{\frac{1}{2}}-t^{\frac{-1}{2}}})^4$

Related

LaTeX export or convert into either R or Matlab?

Forgive me if this may be already asked. I am kind of new to all this. I wondered if there is a simple facility to have Matlab or R import or convert from LaTeX documents? This would be no different than how you can create a MuPAD script document and convert into Matlab M code. This would be through the Matlab Math Symbol toolbox.
Thanks
No, converting general LaTeX equations into some sort of procedural programming language is most decidedly not possible.
LaTeX is a system for creating documents with structured text formatting and typesetting. It is not much different than writing individual letters and symbols onto a piece of paper yourself; there are no intrinsic semantics as to which symbols mean what. It doesn't know (or care) if the expression x = y is an assignment or a test for equality. Or if \cdot is a dot product or simple multiplication. All that really matters in the end is that the equations are readable and look good to a human eye. To convert this soup of symbols into a procedural programming language is quite impossible.
MuPAD, however, is a computer algebra system. You tell it what is a function and what are variables. It has this knowledge. As such, it is able to identify inputs and outputs and some sort of directional flow. It has a grammar to its equations: you must, for example, use := to denote assignment. When converting to an m-file, MuPAD uses this additional information to determine which variables are scalar or vector, what is an assignment and what is a boolean test, what is input and what is output, etc.
This difference is obvious in usage of MuPAD vs LaTeX: one can rearrange and simplify your equations for you, the other cannot.

translate plotmath latex

I started using the awesome knitr package, and whilst I love the idea of using tikz graphics, it's not always very practical (time consuming). Thus, I end up switching back and forth between the good old pdf device, and tikz. Mathematical expressions are generally not handled in the same way in both devices; I find it much preferable to use LaTeX syntax in tikz, but it becomes hard to read in pdf, and vice-versa.
Have there been attempts at providing a framework to seamlessly switch from one notation to another? Something like a translate(x, from="plotmath", to="tex", ams=TRUE, ...) function, that could be hooked internally with knitr to the device in use. How would one go about doing it?
This sounds hard to me. Translation from plotmath to LaTeX may be easier, e.g. replace alpha with \alpha, and x[i] with x_{i}, etc, but the other way can be difficult since plotmath is only a "subset" of LaTeX expressions.
If the time-consuming generation of tikz graphics is an issue for you, you may consider turning on the cache (as I did in the knitr manual and many other example documents). Once a tikz figure is generated, it will not be regenerated the next time if cache=TRUE, so it will be pretty fast, and it will be even faster if you also convert tikz to pdf by the chunk option external=TRUE.
The only reason that I may not use tikz is when the plot is too large in size, as I explained in the manual. Other than that, tikz is always preferable to me. This is slightly off-topic, though.

Quickly cross-check complex math results?

I am doing matrix operations on large matrices in my C++ program. I need to verify the results that I get, I used to use WolframAlpha for the task up until now. But my inputs are very large now, and the web interface does NOT accept such large values (textfield is limited).
I am looking for a better solution to quickly cross-check/do math problems.
I know there is Matlab but I have never used it and I don't know if thats what will suffice my needs and how steep the learning curve would be?
Is this the time to make the jump? or there are other solutions?
If you don't mind using python, numpy might be an option.
Apart from the license costs, MATLAB is the state of the art numerical math tool. There is octave as free open source alternative, with a similar syntax. The learning curve is for both tools absolutely smooth!
WolframAlpha is web interface to Wolfram Mathematica. The command syntax is exactly the same. If you have access to Mathematica at your university, it would be most smooth choice for you since you already have experience with WolframAlpha.
You may also try some packages to convert Mathematica commands to MATLAB:
ToMatlab
Mathematica Symbolic Toolbox for MATLAB 2.0
Let us know in more details what is your validation process. How your data look like and what commands have you used in WolframALpha? Then we can help you with MATLAB alternative.

How to describe a MATLAB function using mathematical notation?

Basically I have created two MATLAB functions which involve some basic signal processing and I need to describe how these functions work in a written report. It specifically requires me to describe the algorithms using mathematical notation.
Maths really isn't my strong point at all, in fact I'm quite surprised I've even been able to develop the functions in the first place. I'm quite worried about the situation at the moment, it's the last section of writing I need to complete but it is crucially important.
What I want to know is whether I'm going to have to grab a book and teach myself mathematical notation in a very short space of time or is there possibly an easier/quicker way to learn? (Yes I know reading a book should be simple enough, but maths + short time frame = major headache + stress)
I've searched through some threads on here already but I really don't know where to start!
Although your question is rather vague, and I have no idea what sorts of algorithms you have coded that you are trying to describe in equation form, here are a few pointers that may help:
Check the MATLAB documentation: If you are using built-in MATLAB functions, they will sometimes give an equation in the documentation that describes what they are doing internally. Some examples are the functions CONV, CORRCOEF, and FFT. If the function is rather complicated, it may not have an equation but instead have links to some papers describing the algorithm, which may themselves have equations for the algorithm. An example is the function HILBERT (which you can also find equations for on Wikipedia).
Find some lists of common mathematical symbols: Some standard symbols used to represent common mathematical operations can be found here.
Look at some sample pseudocode to see how it's done: For algorithms you yourself have coded up, you'll have to write them out in equation or pseudocode form. A paper that I've used often in my work is Templates for the Solution of Linear Systems, and it has some examples of pseudocode that may be helpful to you. I would suggest first looking at the list of symbols used in that paper (on page iv) to see some typical notations used to represent various mathematical operations. You can then look at some of the examples of pseudocode throughout the rest of the document, such as in the box on page 8.
I suggest that you learn a little bit of LaTeX and investigate Matlab's publish feature. You only need to learn enough LaTeX to write mathematical expressions. Then you have to write Matlab comments in your source file in LaTeX, but only for the bits you want to look like high-quality maths. Finally, open the Matlab editor on your .m file, and select File | Publish.
See Very Quick Intro to LaTeX and check your Matlab documentation for publish.
In addition to the answers already here, I would strongly advise using words in addition to forumlae in your report to describe the maths that you are presenting.
If I were marking a student's report and they explained the concepts of what they were doing correctly, but had poor or incorrect mathematical notation to back it up: this would lose them some marks, but would hopefully not impede my understanding of the hard work they've put in.
If they had poor/wrong maths, with no explanation of what they meant to say, this could jeapordise my understanding of their entire project and cost them a passing grade.
The reason you haven't found any useful threads is because most of the time, people are trying to turn maths into algorithms, not vice versa!
Starting from an arbitrary algorithm, sometimes pseudo-code, along with suitable comments, is the clearest (and possibly only) representation.

What word processor do you use for technical papers?

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.

Resources