mathematica

Factoring matrices into elementary matrices

Is there a package in MATLAB, Maple or Mathematica which does this? ...

Profiling memory usage in Mathematica

Is there any way to profile the mathkernel memory usage (down to individual variables) other than paying $$$ for their Eclipse plugin (mathematica workbench, iirc)? Right now I finish execution of a program that takes multiple GB's of ram, but the only things that are stored should be ~50MB of data at most, yet mathkernel.exe tends to h...

Create Mathematica/Combinatorica graph with edges that have named vertices

How do I make a Mathematica graph from edges with named vertices? EG: http://pastebin.com/Se1Nhe3M I've tried the above and several variations, but Combinatorica never quite accepts it right. Apparently, Graph[] wants coordinate positions, which I want Combinatorica to figure out itself. AddVertex to EmptyGraph[0] (or whatever) a...

Solving polynomial equation system possibly having infinite solutions?

I have to solve polynomial equation system which gives error as it has infinite solutions and i just require few solutions(any 2 or 3) so how can i get them? , Can i specify condition on solution like solutions whose values range between 1 to 10 so that i can get few value. Equations are actually long complicated but infinite solutions ...

plotting legends in Mathematica

How do you plot legends for functions without using the PlotLegends package? ...

mesh in mathematica

How can you plot a finer mesh like at noninteger values or something? My function is defined for only a very narrow range and Id like to visualize it better with the mesh. Also how do you make the function white? There is no "White" ColorData. ...

text in mathematica

Is there a way to write text in mathematica so you have something like x/f(x) without getting 1/f? writing Text[x/f(x)] doesn't help. ...

find minimum of a function defined by integration in Mathematica

I need to find the minimum of a function f(t) = int g(t,x) dx over [0,1]. What I did in mathematica is as follows: f[t_] = NIntegrate[g[t,x],{x,-1,1}] FindMinimum[f[t],{t,t0}] However mathematica halts at the first try, because NIntegrate does not work with the symbolic t. It needs a specific value to evaluate. Although Plot[f[t],{t,0...

DensityPlot command in mathematica

The info for DensityPlot says that the "default generates colorized grayscale output, in which larger values are shown lighter." What on earth is colorized grayscale? Is there a way to make it truly grayscale without the blue and purple colors that it generates? And when I do it, it appears a little pixellated. Is there a way to evaluate...

Tricky RegionPlot question (Mathematica)

I use the following to visualize the range of means when averaging n coin tosses as a function of n. p = 1/2; e = 1/4; pp[n_, x_] = CDF[BinomialDistribution[n, p], x]; p3 = RegionPlot[pp[n, n x] > p - e p + e, {n, 1, 20}, {x, 0, 1}] For aesthetic reasons, I want that plot to be contiguous even though this range doesn't make sense fo...

What is the number equivalent to 1e100 ?

What is the number equivalent to 1e100 ? And what is the reason behind it ? Can anybody explain it better ? ...

Projecting points from 4d-space into 3d-space in Mathematica

Suppose we have a set of points with the restriction that for each point all coordinates are non-negative, and the sum of coordinates is equal to 1. This restricts points to lie in a 3-dimensional simplex so it makes sense to try to map it back into 3 dimensional space for visualization. The map I'm looking for would take extreme points...

How to precisely orient a Camera in Graphics3D?

For a simulation of a laser-based sensor I am designing, I want to verify how four points projected on a surface would appear from a camera. And so I have undertaken to implement a Graphics3D visualization. The visualization places 4 lasers in a pyramid-like arrangement with a camera 20 centimeters two one side viewing the laser's proje...

In Mathematica, how can I define an arbitrary probability distribution?

I want an arbitrary function p[x] that integrates to 1 and for all x, 0 <= p[x] <= 1. Some kind of transformation rule? ...

"Select" comparing neighboring elements in Mathematica

In Mathematica the command Select only lets define a selection criterion for each element of a list on its own. I want to specify a criterion that is dependend of a function of the previous and/or next element and a function on all elements, respectively. The first and last element cannot be tested that way, but they should be selected ...

enumerating all partitions in Mathematica

Like Select[Tuples[Range[0, n], d], Total[#] == n &], but faster? Update Here are the 3 solutions and plot of their times, IntegerPartitions followed by Permutations seems to be fastest. Timing at 1, 7, 0.03 for recursive, FrobeniusSolve and IntegerPartition solutions respectively partition[n_, 1] := {{n}}; partition[n_, d_] := Fl...

Inexplicable Mathematica7 DumpSave[] problem

I have a very large array of floating point image data: In[25]:= Dimensions[daylightImgd] Out[25]= {18, 2002, 2989} In[26]:= daylightImgd[[1, 1]][[1 ;; 10]] Out[26]= {0.0122293, 0.0104803, 0.0103955, 0.0115533, 0.0118063, \ 0.0120648, 0.0122957, 0.011398, 0.0117426, 0.0119997} I can save this whole image array to disk successfully u...

Why does FindMaximum with Newton's method complain it can't find a sufficient decrease in function?

Firstly, this seems like (from ContourPlot) a fairly straightforward maximization problem, why is FindMaximum with Newton's method having problems? Secondly, how can I get rid of the warnings? Thirdly, if I can't get rid of these warnings, how can I tell if the warning is meaningful, ie, maximization failed? For instance, in the code ...

Partitioning an interval geometrically

Given an integer n and a positive real number s, how can I partition an interval [0..1] into n intervals such that L(i+1)=s L(i) where L(i) is length of i'th interval? Looking for solution in Mathematica or self-contained C-like pseudo-code ...

how to automatically load user-defined functions in mathematica

I have a bunch of user-defined functions that are frequently used in mathematica. I wonder if I can store them in separate files and mathematica will load them on start and treat them as built-in functions, so that I don't have to repeat the definitions whenever I create a new .nb file. Something similar to functions in Matlab... Thanks...