Showing posts with label software. Show all posts
Showing posts with label software. Show all posts

Wednesday, June 28, 2017

Printing webpages as PDFs

PrintFriendly and PDF has a useful browser extension (tested on Chrome) that creates more readable PDFs from web content.

Here is a screenshot (click to enlarge) from a Matlab blog that I follow:



Notice that the webpage has lots of links, and a frame on the left.

When I use the "Print to File" feature directly from my Chrome browser, I get a PDF which looks like this:

It does the job, but it looks very amateurish. On more complicated websites, results can be horrendous.

Here is the same webpage, now using PrintFriendly.

Notice that the PDF is much cleaner, is well formatted, and contains all the relevant information.

Thursday, June 1, 2017

Annotating PDFs on Linux

Most of my working day is spent reading.

Usually, this means poring over some PDF document, and scribbling my thoughts - preferably on the PDF itself. I find these markups extremely helpful, when I want to recall the gist, or when it is time to synthesize "knowledge" from multiple sources.

I use Linux on both my desktops (home and work), and the usual applications (Evince, Okular, etc.) for marking up PDFs are inadequate in one form or another. Adobe Reader, while bloated, used to do the job. But they don't release a Linux version anymore.

The solution that best fits my needs currently is Foxit Reader. Although you can't use the standard software manager (ex. apt-get on Ubuntu) to get it, you can easily download a 32- or 64-bit version from their website.

The "installation guide" tells you how to do the rest [unzip, cd, and run the executable installer].

On my Linux Mint systems it was easy, peasy!

The software itself is intuitive. You can highlight, add text, stick in comments, and draw basic shapes. The changes you make are permanently saved into the PDF, so that when you use another application to reopen, the changes persist.

It is cross-platform, so you can get a version on any OS (including iOS) you want.

Tuesday, January 3, 2012

Mathematica Integral Fun

Consider the evaluation of the integral of 1/r between -1 and 1, in Mathematica.
  • The function f(r) = 1/r has a discontinuity at r = 0.
  • The indefinite integral of 1/r is simply log(r), which is real for positive "r", and is complex for -ve "r", and goes to negative infinity as r approaches zero.
  • One might be tempted to think that getting definite integrals is easy if one knows the indefinite integral
  • Not so fast. Discontinuties can complicate things!


Let us go back to the integral of f(r) between -1 and 1. From the symmetry of the figure it may be apparent that f(r) is an odd function, and the area under the curve (or the integral) should go to zero.

If we try to use Mathematica to integrate it with Integrate[f,{r,-1,1}], it complains that the integral does not converge.

We say, hmmm. Why don't we simply try to substitute the limits in the indefinite integral:
The answer makes sense since Log[1] = 0, and Log[-1] = i * pi, but is clearly not the correct answer?

The reason for this is that the First Fundamental Theorem of Calculus requires the antiderivative to be continuous over the range of integration, and from the second plot above, it is clear that this condition is violated.
So how do we figure this thing out? We could isolate the discontinuity by integrating close to zero (using "epsilon"), and perhaps take the limit later.

This gives the expected answer of zero.

Friday, December 2, 2011

Text in Inkscape

Inkscape is a fantastic program for creating vector graphics. It is free, platform independent, refreshingly clean and efficient once your master some keystroke shortcuts, and amazingly powerful in terms of the things it can do for you.

It does have a few pesky features though, particularly with "text". For example there is no intrinsic way of creating subscripts or superscripts, and sometimes Greek symbols just do not render properly.

This post explains my workarounds.

1. Subscripts and Superscripts: While there is no natural way of getting these, you can always select some text, and then press Alt + arrow-key (up, down, left, or right arrows) to move the selection in that particular direction. Here is a screenshot of how that works.


2. Greek Symbols: You can try to select the Symbol font from the font dialog box, but very often, it won't get you anywhere. A handy but inconvenient workaround is to use Unicode. If you know the Unicode Standard (pdf), then you can directly enter the code of the particular character. For example, the symbol for "beta" is 03B2.
To enter this in Inkscape, first open a text dialog box as usual. Then press Ctrl + U. The status bar at the bottom of the screen prompts you to enter the code. You type 03B2 (or 03b2), and you will see it echoes the symbol "beta". You press enter, and the symbol is inserted near the text cursor.

3. LaTeX Support: Inkscape supports LaTeX expressions by default. I did not know this until recently, but you can go to Extensions > Render > LaTeX formula... (in some cases it may be under Effects > instead of Extensions >).

It opens up a dialog box, in which you can enter your formula. Inkscape calls LaTeX and con­verts the DVI out­put to SVG, and em­beds it in the document. Since it is a scalable equation (or any other LaTeX object), you can now interact with it natively in Inkscape.


Monday, November 21, 2011

Matlab: Profiler and parfor

Two videos on extremely-useful-but not-so-frequently-used features in Matlab.

1. Profiler: While "profiling" may be a bad word in common parlance, it is a good word in software. It helps you identify potential areas in your program that may be targets for optimization.

2. Parallel "for" loops: An easy way to exploit multicore (or distributed cores) machines for task-parallel computations. Useless trivia: I went to grad school with the person doing the video (Jiro Doke).

Friday, October 21, 2011

Presentations using Beamer

Finally.

Finally, I decided to jump, and started using a LaTeX package called beamer to make presentations.

I had been reluctant to make the transition because (i) like all non-GUI programs/packages, there is a learning curve, (ii) I liked the platform independence of OpenOffice Impress, which (iii) especially when combined with oooLaTeX let me display mathematical formulae with the cleanliness of LaTeX, and (iv) my presentations, unlike my documents don't have as many cross-references and citations.

A part of me also liked the freeform nature of dropping images wherever I liked, and the ability to sketch up schematic diagrams on the fly.

I gave beamer a test drive, learning from these tutorials. Since I knew LaTeX before, I was up and running in about two hours.It took me surprisingly less time than I had expected.

In fact, I just presented slides made with beamer at the Society of Rheology's annual meeting in Cleveland.

In the future, I expect to use this tool a lot more.

Monday, June 6, 2011

Mathematica 8 on sale at Amazon

In preparation for a course I am teaching over Fall, I have been learning/following Mathematica quite closely. I found out last week that Amazon has a sale on "Mathematica 8 Home Edition" for $239.

I've never used Mathematica extensively in the past, for three reasons:
  • the price sucks ($1000+ bucks, if I try to buy it directly from Wolfram).
  • I do not really need it for my research,
  • my department has a site license for teaching, if I need to use it.
But it is an amazing piece of software. I always suspected that it was. Now that I am learning how to use it better, I am finding that it is even more amazing than I thought it was.

Under different circumstances (if none of the above three reasons were valid, for example), I would probably buy it.

Friday, April 15, 2011

Linear Least Squares in Octave

While Octave functions ols and leasqr are good for heavy-lifting, polyfit is often sufficient for simple linear regressions.

Given arrays of data x and y: c = polyfit(x,y,1) gives the regression yfit = c(1) * x + c(2).

Monday, December 21, 2009

Wolfram Alpha is amazing!

In all the commotion surrounding Microsoft's Bing, the demise of Yahoo Search, and Google's counter-attack by announcing a light-weight OS, something really useful to me, did not get as much play as it should have.

Wolfram Alpha is an amazingly intelligent search engine/parser/magic genie, for anything mathematical in particular. I have using it quite regularly, not quite as a substitute for Google yet, but even something as unthinkable as that could happen.

In the academic realm, it is a killer resource.

Here are just a few illustrative screenshots from my search today. You may have to zoom in a little bit for clarity.