traviscj/blog

Posts

February 1, 2012

a trig problem solved in MATLAB

diagram

I came across this post. The basic idea is the guy wants to maximize $L_1+L_2$ constrained to this box, where $L_i$ is the length of beam $i$. It’s constrained to be a 61 cmx61 cm box, but one beam must start from 10cm up from the bottom right corner and the beams must meet at a point along the top of the box. I added the further assumption that the other beam must end in the bottom left corner.

read more
February 1, 2012

cplex matlab interface

Just for my own reference, I’m documenting the interface to CPLEX.

CPLEX expects a problem in the form ( \begin{split} \min \qquad & g^Td + \frac12 d^TWd\ \text{subject to} \qquad & c_L \leq Ad \leq c_U\ & d_L \leq d \leq d_U \end{split} ) and is called by

cplex = Cplex('test');
cplex.Param.feasopt.tolerance.Cur = 1e-8;
if params.printLevel < 8
    cplex.DisplayFunc = [];
end
cplex.Model.sense = 'minimize';
cplex.Param.qpmethod.Cur = 1;
cplex.addCols(gk,[],bl-xk,bu-xk);
cplex.addRows(-ck, A0, -ck);
cplex.Model.Q = W;
cplex.Model.obj = g;
cplex.Model.lb = d_L;
cplex.Model.ub = d_U;
cplex.Model.lhs= c_L;
cplex.Model.rhs= c_U;
cplex.solve();
read more
January 30, 2012

spamfunc for optimization in matlab

what spamfunc is

In developing optimization algorithms, one of the most tedious parts is trying different examples, each of which might have its own starting points or upper or lower bounds or other information. The tedium really starts when your algorithm requires first or second order information, which might be tricky to calculate correctly. These bugs can be pernicious, because it might be difficult to differentiate between a bug in your algorithm and a bug in your objective or constraint evaluation. Handily, Northwestern Professor Robert Fourer wrote a language called AMPL, which takes a programming-language specification of objective and constraints and calculates derivatives as needed. The official amplfunc/spamfunc reference is contained in Hooking Your Solver to AMPL, but I’m shooting for a more low-key introduction.

read more
January 10, 2012

VirtualBox and HRD/JT65

One of the semi-frustrating aspects of the state of computing and ham radio is the unavailability of some software packages on OSX. In particular, I’ve been interested in experimenting with JT65 and also wanted to use my Yaesu FT-857d’s CAT cable to program memories and also try out HRD. (I should add–I’ve tried the JT65 stuff and some Yaesu memory programmers, but wasn’t satisfied with the Linux setup for those. I’ll probably look into getting them working more later, but for now, this article.)

read more
September 9, 2011

tcjblog.py

I’ve now (for the most part) finished a working version of some software I’ve wanted to tackle for a while. I call it tcjblog.py. It’s a blog platform built using jemdoc.py to format simple text files into nice looking HTML. What’re the benefits of this, and features of tcjblog.py in general?

  • Simple, text file management of blog posts. (I control these with git.)

  • Ability to include LaTeX markup.

  • Static HTML for all blog-related pages

read more
September 4, 2011

Five Critical Textbooks for (Applied!) Math & Physics Students

In the course of working through my first year at grad school, I’ve come up with five favorites for the basics of an undergrad understanding of the essential topics for applied math and physics. Without ado and in the order I’d take them off my shelf:

  • Mathematical Methods in the Physical Sciences - ML Boas. This is my favorite, because it contains almost every technique you need, and it has a ton and a half of problems(over 3400). It contains a good review of complex analysis, linear algebra, differential equations, and calculus, but also chapters on special functions, partial differential equations, probability, tensors, and the calculus of variations. – Hidden Gem: Chapter 4, Section 12: Differentiation of Integrals, RP Feynman’s favorite trick.
  • Calculus - Greenspan. A great reference on calculus.
  • Complex Variables and Applications - Brown & Churchill: The most readable book on complex analysis I’ve read. Not so hidden gem: Most of the solutions are given right alongside the problem–a great book for self-study. Also the material on conformal mapping and fluid flows.
  • Linear Algebra And Its Applications - Strang. Nice book on linear algebra theory. – Hidden Gem: Chapter 7, Section 4: Iterative Methods for Ax=b and Gershgorin’s circle theorem.
  • Elementary Differential Equations and Boundary Value Problems - Boyce & DiPrima. Powerhouse of differential equation knowledge. Strangely, it is the book ESAM recommended, but not the book they use for teaching their undergrads.

I’ve spent probably the most time with Boas’ Mathematical Methods in the Physical Sciences–I’ve worked nearly 1000 problems out of the book to get ready for the preliminary exams my first year. It was completely worthwhile.

read more
May 27, 2010

Getting GnuPlot to compile on OSX

I misunderstood an officemate’s question yesterday and set out to compile gnuplot. Stock GNUPlot will fail to compile on OSX due to an incompatibility in the readline library. So when you compile, let GNUPlot know to use the one included:

> tar xzvf gnuplot*
> cd gnuplot-4.2.39
> ./configure --prefix=/usr/local --with-readline=builtin
> make
> sudo make install
read more
May 25, 2010

Pylab PDF

I’m in the process of kicking the MATLAB habit and replacing it with Python. Pylab is a reasonable approximation to the 2D plotting capabilities of MATLAB, but by default Pylab doesn’t run on headless(ie, non-GUI) boxes. So on my macbook, where I’m often running things interactively, I have

backend : macosx

and on the faster core2quad machine I send off longer-running jobs to, I used

backend : PDF

in the .matplotlib/matplotrc file.

read more
May 25, 2010

Spaces setup

My workflow is probably pretty specific, but I figured I’d document it for people looking for ideas on how to set it up. This one seems to work pretty well for me.

. Terminal: for running stuff on my and other computers. . Textmate: writing mathematics, programming code, etc . Mathematica, MATLAB, and Papers . Mail and Adium . Firefox, Chrome, Safari . iTunes and VLC

I have this arranged in a 3×2 grid, such that Textmate is top center. From there I can navigate to terminal, math programs, and Firefox directly(control-{left,right,down}). It takes two navigations to get to communication programs and entertainment, which is good for concentration while working.

read more
May 25, 2010

ZSH and scp/rsync globbing

I finally got annoyed at typing

tjohnson> scp tcj:*txt .
zsh: no matches found: tcj:*txt

I’d always fixed this by the up-CTRL-A-over-over-over-over-quote-CTRL-E-over-over-quote method, ie

tjohnson> scp "tcj:*txt" .

but the more proper and less annoying version is

tjohnson> scp tcj:\*txt .

However, in the spirit of inspired overkill, there are a couple other options. You can define some new aliases with

alias scp='noglob scp'

but that hardly counts as overkill, so instead I edited my .zshrc to include

read more
  • ««
  • «
  • 11
  • 12
  • 13
  • 14
  • 15
  • »
  • »»
© traviscj/blog 2025