mathematica

taskjuggler w/ multiple dependencies where task length depends on previous tasks

I have a task Z that can only be completed once either task X or task Y is completed. Also: % The length of task Z depends on which of X or Y is completed: % If task X is completed, task Z takes 4 hours % If task Y is completed, task Z takes 7 hours % Task X takes 5 hours to complete % Task Y takes 3 hours to complete % Task...

suggestions for a people similarity algorithm

Hello all, I want to get some suggestions for my "find similar people" algorithm :). I have one database where I store the following entities: Person, article, keywords. So for each person I have a collection of keywords (with the number of mentions by the person) that have been compiled from person's articles keywords. So I need to get...

How can we combine many Plots generated by a loop into one single Plot in Mathematica?

Dear all: I want to visualize a function of the form x^n such that n=1,2,...,10. I want these values of n to be generated by a loop and then plot the function as Plot[{x^n},{x,0,100}] and store the plot in an array. Then I want all of these arrays to be displayed into single plot. I tried to do this using Show function but with not much...

($VersionNumber < 6) Cropping an exported image in Mathematica

http://i51.tinypic.com/15wcw2d.jpg This is an animation I made using Mathematica. As can be seen by highlighting the image, the margins at both the left and right sides are too wide. I don't want to have to submit the image to another program just for the cropping, so what do I do to eliminate the whitespace? Looking at the documentati...

Calling Mathematica from OCaml program

I am writing OCaml code. In part of it, I want to examine whether two arithmetic expression are equal (like x+2+y == x+2*y-y+2). Implemeting this in mathematica is straightforward, so all I want some help on executing Mathematica and get the result back in OCaml. My OS platform is Linux. Cheers, Z. ...

Finding first element of a Mathematica list greater than a threshold

Hello guys, I was wondering how I could obtain the first element of a (already ordered) list that is greater than a given threshold. I don't know really well the list manipulation function in Mathematica, maybe someone can give me a trick to do that efficiently. Thanks ! ...

MemberQ in Mathematica

I am a bit at a loss how to do the following efficiently in Mathematica: a = { 1, 2, 3, 4, 5 }; (* list of integers *) b = { 2, 4, 6, 8 }; (* another list of integers *) filter = Table[MemberQ[b, element], {element,a}] Expected output is: {False, True, False, True, False} My lists a and b are big, so Mathematica is doing a kaz...

What's the difference between Solve[lhs == rhs, x] and Roots[lhs == rhs, x] in Mathematica 7?

Why does the Roots function exist when you can do the same thing with Solve? ...

Mathematica DSolve

Hey, I have this little equation that I am trying to solve on Mathematica, but for some reason I cannot get it to work. Any help would be appreciated. Thanks f[x_, t_] = x^2 - x^3; eso = x[t] /. DSolve[{[t] == f[x_, t_], x[0] == 0.2}, x, t] I tried this next, but I keep getting an error f[x_, t_] = x[t]^2 - x[t]^3; eso = x[t] /. DS...

Test if an expression is a Function?

How would a function FunctionQ look like, maybe in a way I can even specify the number of arguments allowed? ...

listing all interesting sections of a tetrahedron

An interesting 2d section is plane that goes through the center of a regular 3d simplex and 2 other points each of which is a centroid of some non-empty subset of vertices. It is defined by two subsets of vertices. For instance {{1},{1,2}} gives a plane defined by 3 points -- center of the tetrahedron, first vertex, and average of first ...

How to extract mathematica output

Hello The output to my mathematica cell is just a long algebraic equation produced from Solve[%, Subscript[u, i, j + 1]]. {{Subscript[u, i, 1 + j] -> (1/( 2 h^2))(-2 h^2 k Subscript[f, i, j] + 2 h^2 Subscript[u, i, j] + 2 b h^2 k Subscript[u, i, j] - h k Subscript[u, -1 + i, j] Subscript[\[Mu], i, j] + h k Subscrip...

Complex wolframalpha ajax query

I want to write formulas in Mathematica format in my blog, inside tag's formula. What js should I use (and what libary), to replace those tag's, with http://www.wolframalpha.com/ search result image, when Dom gets loaded? For example: <formula>Limit[((3 + h)^(-1) + -1/3)/h, h -> 0]</formula> gets replaced with: If it's to complex o...

Weather Conditions in Mathematica

I have yet to find a city or location or date, that gives me an answer other than Missing[NotApplicable] to the following query. WeatherData["Chicago", "Conditions", {2010, 8}] That syntax works for "Temperature" and "Pressure" and "WindDirection" But not "Conditions". In particular, if you want data returned for "Conditions" you nee...

Convolve working with Interpolated Functions in Mathematica

I'm using Mathematica 7. I have an interpolated function, here's an example: pressures = WeatherData["Chicago", "Pressure", {2010, 8}] // DeleteCases[#, {_, _Missing}] & // Map[{AbsoluteTime[#[[1]]], #[[2]]} &, #] & // Interpolation; I'd like to compute it's derivative, which is straight forward: dpressures = D[pressur...

Computing derivatives in Mathematica/Mathlink

I'm trying to figure out how to use Mathematica from C via Mathlink. If I just want to compute the value of a built-in function, I can do MLPutFunction( lp, "RiemannSiegelZ", 1L); MLPutDouble(lp, val); and all is fine. Now, if I want the value of the derivative, things get worse: MLPutFunction( lp, "RiemannSiegelZ'"...

Mathematica GraphPlot and the EdgeRenderingFunction

While I'm waiting for the sorting to finish, I would like to adjust a part of Mathematica graph I'm working on. The problem is that nodes are on top of edges, I wonder if there is a way to reverse that. In the image you can see that arrows are not showing proper... I'm doing a GraphPlot[] with custom VertexRenderingFunction and EdgeRend...

Inverse of Flatten in Mathematica?

What's the inverse of f[x_]:=Flatten[x] where x is Array with dimensions dims? ...

Plotting linear inequalities in Mathematica

Update: Incorporating suggestions below, here's the version I ended up using to plot feasible region of a system of linear inequalities (* Plots feasible region of a linear program in 3 variables, \ specified as cons[[1]]>=0,cons[[2]]>=0,... Each element of cons must \ be an expression of variables x,y,z only *) plotFeasible3D[cons_] ...

Finding bounds for 21-variable inequalities

I have the following inequalities on 21 variables: http://pastebin.com/raw.php?i=FTU970Em When I run "Reduce[ineq,Integers]" on this, Mathematica hangs for a long time. That makes sense: there are MANY sets of values for x[1]..x[21] that satisfy the inequalities. All I really want is bounds for each variable (eg, "2 <= x[i] <= ...