Oct 5, 2008

QHull for Mathematica

mPower.m is a Mathematica package that interfaces with qhull binaries.

Installation guide is not for windows platform.

Here is the quick way to get it running on Windows Vista with Mathematica 6.0.

1. download mPower.m, and put it into the Applications subdirectory of $UserBaseDirectory 

In[1]:= $UserBaseDirectory

Out[1]= C:\Users\...\AppData\Roaming\Mathematica

2. download qhull for windows, put it into the folder C:\qhull

3. open mPower.m, modify the following two lines,

$QHULL=ToFileName[{$UserBaseDirectory, "Applications", "qhull", "src"}]

to: $QHULL="C:\\qhull\\"

qhullFiles={"qconvex",  "qdelaunay", "qhalf","qhull", "qvoronoi"};

to: qhullFiles={"qconvex.exe",  "qdelaunay.exe", "qhalf.exe","qhull.exe", \
"qvoronoi.exe"};

4. then testing, ignore the warning on regtet and pwrvtx, we only need qhull

<< "mPower.m"

points = RandomReal[1, {10, 3}];

ch = convexHull[points, convexHullFormat -> {facetNormals -> True, facets -> True}]

 

Thanks to the mPower developers

Aug 7, 2008

Financial Data: AAPL vs MSFT

Technologically speaking, Apple and Microsoft are two quite different companies in many ways. We all know that in recently several years, Apple stock is very hot. Here is the stock price: APPL vs MSFT since 2004, the legend is not necessary for this graph.

DateListPlot[{FinancialData["AAPL",{2004}], FinancialData["MSFT",{2004}]}, Joined->True, Filling->Bottom]

aaplvsmsft

Google Insights for Search gives another way to present it.

Google search volume index for "AAPL" since 2004

aapl

Google search volume index for "MSFT" since 2004

msft

Aug 6, 2008

How to extract points from a plot

pts=Cases[theplot, x_GraphicsType:>First@x, Infinity];

Example 1:

g=Plot[Sin[x],{x,0,2Pi}];
pts=Cases[g,x_Line:>First@x,Infinity];
ListPlot[pts]

image

Example 2:

g=Plot3D[Cos[x]+Cos[y],{x,0,4Pi},{y,0,4Pi}];
pts=Cases[g,x_GraphicsComplex:>First@x,Infinity];
ListPointPlot3D[pts]

image

Jul 16, 2008

Wolfram Screencast Gallery

There are some very impressive  presentations in Screencast Gallery.

I watched Spinthariscope by Theodore Gray. This simple shape editor is particularly interesting.

image

image

Jul 11, 2008

Fun with Gamepad

We have a cheap Logitech gamepad (less than 10$ from Target).

ControllerInformation[]

Controller Device 3: Logitech(R) Precision(TM) Gamepad
Raw Product Name "Logitech(R) Precision(TM) Gamepad"
Raw Product ID 49690
Device Type Windows DirectInput Device
Raw Controller Type Joystick
Mathematica Controls 22 controls
Raw Controls 12 controls

Using gamepad to rotate 3D graphics is very smooth, and can jump to top view from x, y, z directions when you hold down different buttons. It seems not supported to zoom a 3D graphic with gamepad.

Gamepad & Device Interface for the details.

Google Earth is another application to play nicely with gamepad.

Update: See here for enabling zoom function with gamepad. Thanks.