Showing posts with label Mathematica. Show all posts
Showing posts with label Mathematica. Show all posts

Wednesday, March 5, 2014

Mathematica copy viewing parameters

For copying the viewing matrix parameters (example from a fast draft to the final figure) copy paste the draft and add //options.
you get ImageSize, ViewPoint and ViewVertical

Mathematica, 3D plot with color independent of the coordinates

to plot 3D data with color independent of the coordinates

data = Table[RandomReal[{0, 10}, 4], {20000}];
Graphics3D[{Hue[Last[#]/10], Point[Take[#, 3]]} & /@ data]


Hue can take 3 parameters . Graphics3D had axes turned off so to change the labels you need to do Axes -> True, AxesLabel -> {Subscript[\[Theta], 1], Subscript[\[Theta], 2],
  h},  BaseStyle -> {FontSize -> 15}


source: https://groups.google.com/forum/#!topic/comp.soft-sys.math.mathematica/nJSMEyrvIgg

Thursday, July 18, 2013

Mathematica fonts problem with inkscape

If the fonts are broken,
when saving (in eps) from mathematica select options/ and disable the "Include Mathematica fonts".

Make the fonts of Mathematica available to inkscape

ln -s /usr/local/Wolfram/Mathematica/9.0/SystemFiles/Fonts/ .fonts
ln -s /usr/local/Wolfram/Mathematica/9.0/SystemFiles/IncludeFiles/TeX/texmf/fonts/ .fonts
sudo fc-cache -f -v

source:
http://pages.uoregon.edu/noeckel/MathematicaGraphics.html#NoSpecialFonts


Tuesday, July 16, 2013

Reliable Long equation to pdf

In mathematica

expression//TraditionalForm

save selection as... eps

ps2pdf -dEPSFitPage-sPAPERSIZE=jisb0  formula.eps formula.pdf
(note: -dDEVICEWIDTHPOINTS=595 -dDEVICEHEIGHTPOINTS=16712 instead of -sPAPERSIZE=jisb0 seems to produce white text on white bg)

pdfcrop formula.pdf formulac.pdf

Monday, June 24, 2013

Sunday, January 20, 2013

procedural in mathematica

temporary variable inside a Module:

(detecs "jumps" in the list)


jump = Module[{src, dst}, src = Drop[#, 1]; dst = {Take[#, 1]};
   Do[If[Abs[Last[Last[dst]] - src[[i]]] < 2,
     dst = ReplacePart[dst,
       Length[dst] -> Append[Last[dst], src[[i]]]],
     AppendTo[dst, {src[[i]]}]], {i, 1, Length[src]}]; dst] &

Friday, December 14, 2012

Mathematica delete empty list



DeleteEmpty :=
 Function[l, Replace[l, x_List :> DeleteCases[x, {}], {0, Infinity}]]