TinyURL widget - shorten your URL's for free!

Enter a long URL to make tiny:

Monday, September 15, 2014

Finding the overall minimum, maximum of an arbitrary matrix in MATLAB and/or Octave.

It's one logical step from what's presented in the GNU Octave Manual, but for a given arbitrary n-dimensional matrix, to find the overall minimum or maximum value within the matrix, you simply recurse the min() or max() function as many times as there are dimensions. So for a 3-dimensional matrix, recurse function calls to min or man three times like this min(min(min(X))))


Example:
 
size(out)
ans = 3 32 32
     min(min(min(out)))
ans = -0.99914
    max(max(max(out)))

    ans = 1











Removing Dimensions from Matrices in Octave or MATLAB - squeeze()

For many math applications you want to run through many variables all at once and gather data. Of course, having several variables that will lead to n-dimensional matrices.

For example I was converting from a spherical coordinate system to a Cartesian and experimenting with what the x,y,z coordinates would be for two changing angles.  This lead to a rank (3 by n by m)  3-dimensional matrix where first dimension is the xyz, the second is angle one and the last is angle two.  To get the matrix for any single variable, do the following: extract a submatrix and then use squeeze to get a single 3 by n or 3 by m matrix.

Example:

Let A = [3*n*m]  say=
size(A) = 3 32 32

a = A(:,1,m)   # takes single dimension matrix from 3*m*n using column one of second dimension

size(a) = 3 1 32

a = squeeze(a) 

size(a) = 3 32

squeeze() looks for the singleton dimension and then does the tedious  matrix copy and paste operations for you.


Of course this gives you one of many, then duplicate for the remainder.

Tuesday, September 9, 2014

Including SVG graphics into LaTeX documents.

The epub book format relies on XHTML / HTML / and MathML for converting from a page-based book like .pdf format or .dvi format into a scaled free-flowing page that can make for reading on a phone, tablet, or any size screen.

I am working on converting my book into XHTML with nice looking graphics.  The first attempts to make a .epub from .pdf caused a mess of a book.  The symbols go all over the page when they aren't locked into position.

The way I solved this was to convert all math equations into graphics - inline and display formulas - and then reinclude graphics into the .tex file rather than equations.

I found the svg package that acts like the graphicsx allowing you to

  \includesvg[<options>]{<svg filename>}
 
include svg image directly.
 
You can find the svg package on CTAN here  
 
 
For Ubuntu and Fedora,  this BASH shellscript should install and reconfigure texmf 

#!/bin/sh
# svg standard install script
# must be run inside the top  svg directory
# must be run as root or sudo root

mkdir /usr/share/texmf/tex/latex/svg
cp -rf * /usr/share/texmf/tex/latex/svg


texhash

Monday, August 4, 2014

Really Really useful LaTeX symbol list: The Great Big List of LaTeX Symbols.

One of the problems, disadvantages not really a problem, with using a modular word processing system like LaTeX is that with all the development spread out and independent like the Bazaar versus the Microsoft Office cathedral  (Eric S. Raymond) is that there is probably at least one solution for your problem - perhaps seven, but there is no single way to find them unless you comb through many many websites, searches etc. etc.

Well, here is one way to find things in LaTeX:  The Great Big List of LaTeX Symbols.

http://www.rpi.edu/dept/arc/training/latex/LaTeX_symbols.pdf


This is a good starting point for anyone looking for something, it should save many searches.

One way people can contribute without writing code is to make it easier for others to use.

Saturday, August 2, 2014

How to find apt in Ubuntu

So I was looking for the Xerces-c Compiler library so I could run blahtex and make a nicer epub for my poker book (below)




















because I wrote it with LaTex using Olaf's cool poker card style file.

The biggest problem with package management tools like yum and apt / apt-get  for linux and their databases of really what are source files is a very simple problem; over time the developers - all eager beavers - change the names or upgrade versions of that same library set and that causes people constant problem of finding the right packages to install.   The Linux user community is so large and effective that this is a constant problem.  Lots of people take on old software and make it better. Just try installing GCC and see what I mean.  Half my Google searches are a direct result of not knowing the name of the packages.

So today while working on my ubuntu machine, I found a way to search the database for a fragment that might make sense. 

  • apt-cache search libxerces

  • I was able to look into the database and find this:


     apt-cache search libxerces

    libxerces2-java - Validating XML parser for Java with DOM level 3 support
    libxerces2-java-doc - Validating XML parser for Java -- Documentation and examples
    libxerces2-java-gcj - Validating XML parser for Java with DOM level 3 support (native code)
    libxerces-c-dev - validating XML parser library for C++ (development files)
    libxerces-c-doc - validating XML parser library for C++ (documentation)
    libxerces-c-samples - validating XML parser library for C++ (compiled samples)
    libxerces-c2-dev - validating XML parser library for C++ (development files)
    libxerces-c2-doc - validating XML parser library for C++ (documentation)
    libxerces-c28 - validating XML parser library for C++
    libxerces-c3.1 - validating XML parser library for C++
    So if you are looking into a Debian/Ubuntu based distribution with apt then try the apt-cache search.

    Thursday, July 31, 2014

    Font OMS/jkp/m/n/10=jkpsy at 10.0pt not loadable: Metric (TFM) file not found Error Latex Fedora 18

    I was compiling the kpfonts into a LaTeX document on Fedora 18 and got the following errors:

    ...

    Font OMS/jkp/m/n/10=jkpsy at 10.0pt not loadable: Metric (TFM) file not found
    Font T1/jkp/m/n/10=jkpmn8t at 10.0pt not loadable: Metric (TFM) file not foun
    Font OT1/jkp/m/n/8=jkpmn7t at 8.0pt not loadable: Metric (TFM) file not found
    Font OT1/jkp/m/n/6=jkpmn7t at 6.0pt not loadable: Metric (TFM) file not found


    ...

    The full log entries look like this

    (/usr/share/texlive/texmf-local/texmf-compat/tex/latex/kpfonts/t1jkp.fd
    File: t1jkp.fd 2007/01/24 Fontinst v1.928 font definitions for T1/jkp.
    )
    ! Font T1/jkp/m/n/10=jkpmn8t at 10.0pt not loadable: Metric (TFM) file not foun
    d.
    <to be read again>
    relax
    l.24 \begin{document}
    I wasn't able to read the size data for this font,
    so I will ignore the font specification.
    [Wizards can fix TFM files using TFtoPL/PLtoTF.]
    You might try inserting a different font spec;
    e.g., type `I\font<same font id>=<substitute font name>'.

    ! Font T1/jkp/m/n/8=jkpmn8t at 8.0pt not loadable: Metric (TFM) file not found.
    <to be read again>
    relax
    l.24 \begin{document}


    I saw some posts claiming to install texlive-fontrecommend like this:

    sudo yum install texlive-collection-fontsrecommended texlive-times


    but they were updated and installed. The packages I installed were all wildcard * font packages like this:

    sudo yum install texlive-collection-fonts*

    then I ran

    sudo texhash

    and for Lyx I reconfigured and it worked.








    Friday, July 11, 2014

    Printing JPEG files to Epson XP-400 printer

    So I was trying to print out my tickets for the Rockstar Mayhem concert when the Windows machine I was trying to use stalled.

    http://rockstarmayhemfest.com/dates/phoenix-az-2

    So I used Fedora on my laptop to save the day.

    I couldn't get the pdf ticket files to print on the networked Epson XP-400.

    Instead, I loaded them into GIMP and exported them to JPEG format.  Unfortunately, that didn't work.


    In the Epson printer manual,
    (https://files.support.epson.com/pdf/xp400_/xp400_ug.pdf )
    it says:

    You can insert memory cards in your product containing files that meet these specifications.
    File format JPEG with the Exif version 2.3 standard Image size 80×80 pixels to 9200×9200 pixels
    Number of files Up to9990

    So I re-exported them and made sure they were in unoptimized uninterlaced format JPEG.  That worked, they were recognized.

    So convert PDF to raw JPEG, and load them onto an SD ram card and you can get the printer to print out pages.