wolfram-mathematica

Conditional Data Manipulation in Mathematica

流过昼夜 提交于 2019-12-03 14:14:18
I am trying to prepare the best tools for efficient Data Analysis in Mathematica. I have a approximately 300 Columns & 100 000 Rows. What would be the best tricks to : "Remove", "Extract" or simply "Consider" parts of the data structure, for plotting for e.g. One of the trickiest examples I could think of is : Given a data structure, Extract Column 1 to 3, 6 to 9 as well as the last One for every lines where the value in Column 2 is equal to x and the value in column 8 is different than y I also welcome any general advice on data manipulation. Leonid Shifrin For a generic manipulation of data

Mathematica and MouseListener - developing interactive graphics with Mma

风格不统一 提交于 2019-12-03 14:13:45
I want to add interactivity to Mathematica 3D graphics, other than with Manipulate which is cool but has its limitations. Think four example of a demo of the four cubes problem in Mathematica, a click on one of the cubes rotates a cube. Questions. Is it possible to catch MouseEvents in Mathematica graphics ( for example with using a Java class or otherwise? ) Or is the use Java then call Mathematica from Java the advised route? Or ( I hope not ) is developing interactive graphics programs beyond of what one should do with Mathematica? EventHandler can be used to catch various mouse events

Display multiple 2D plots in 3D using Graphics in Mathematica?

一曲冷凌霜 提交于 2019-12-03 14:02:17
问题 Considering the following : lalist = {{{{1, 1}, 1}, {{3, 3}, 1}, {{5, 5}, 1}}, {{{1, 5}, 1}, {{3, 3}, 1}, {{5, 1}, 1}}} Row[{ Graphics[{ Opacity[0.5],Red, Disk @@@ lalist[[1]]}, Frame -> True], Graphics[{ Opacity[0.5],Blue, Disk @@@ lalist[[2]]}, Frame -> True]} ] Is it possible that I plot the Blues Disks "behind" the red ones in a 3 D plot ? Below is not what I need : 回答1: Like this? Graphics3D[{{Texture[ Graphics[{Opacity[0.5], Blue, Disk @@@ lalist[[2]]}, Frame -> True]], Polygon[{{-1, -1

how to animate 3d plot given a rotation axis in mathematics

妖精的绣舞 提交于 2019-12-03 13:50:42
问题 If given a rotation axis normalized, such as {1/Sqrt[3],1/Sqrt[3],1/Sqrt[3]}, and a 3d plot, for example, z[x_, y_] := Exp[-(Sqrt[x^2 + y^2]/Power[4, (3)^-1]) + Power[4, (3)^-1]*Sqrt[1/2*(Sqrt[x^2 + y^2] + x)]]; Plot3D[2*z[x, y], {x, -5, 5}, {y, -5, 5}] I want to create an animation for this plot about the axis {1/Sqrt[3],1/Sqrt[3],1/Sqrt[3]} (could be any other arbitary one), and then export it as an animated gif. Would anyone please help? Many thanks. Edit I also left out one degree of

Importing tables in Mathematica from web - empty cell problem

白昼怎懂夜的黑 提交于 2019-12-03 13:26:15
I use: data=Import["http://weburl/","Data"] to import data from one site. On that page there are tables. This creates nested lists, and you can easily get the data in table form. For example: Grid[data[[1]]] would give something like this: Player Age Shots Goals P1 24 10 2 P2 22 5 0 P3 28 11 1 ... Now, here is the problem. If one cell in the html table is empty, for example an entry for "Age", then in html this would look like this: <td></td> . Mathematica doesn't include take it in the list at all, not even as, for example, a "Null" value. Instead, this row would just be represented by a list

Why can't Mathematica solve this definite integral?

北战南征 提交于 2019-12-03 12:43:39
When I try to calculate the following integral in Mathematica 8, I get this strange result: In[1]:= Integrate[y/((1 + x^2 + y^2)^(3/2)), {y, 0, 1}] Maple 14 can solve this one easily: Why is Mathematica giving me a different result? Try this r = Integrate[y/((1 + x^2 + y^2)^(3/2)), {y, 0, 1}] r = Assuming[Element[x, Reals], Simplify[r]]; Together[r] which gives (-Sqrt[1+x^2]+Sqrt[2+x^2])/(Sqrt[1+x^2] Sqrt[2+x^2]) Which is the same as Maple's : 来源: https://stackoverflow.com/questions/8692674/why-cant-mathematica-solve-this-definite-integral

How to do substitution of a function in mathematica

夙愿已清 提交于 2019-12-03 12:29:06
I have the expression D[f[x, y], x] , and I want to substitute f[x,y] with x*y , I tried the following: D[f[x, y], x] /. {f[x,y] -> x*y} and D[f[x, y], x] /. {f -> x*y} But neither worked. Would appreciate your help! Thanks. The FullForm of the derivative in your expression is In[145]:= D[f[x,y],x]//FullForm Out[145]//FullForm= Derivative[1,0][f][x,y] This should explain why the first rule failed - there is no f[x,y] in your expression any more. The second rule failed because Derivative considers f to be a function, while you substitute it by an expression. What you can do is: In[146]:= D[f[x

Mathematica RegionPlot on the surface of the unit sphere?

戏子无情 提交于 2019-12-03 12:21:51
I am using RegionPlot3D in Mathematica to visualise some inequalities. As the inequalities are homogeneous in the coordinates they are uniquely determined by their intersection with the unit sphere. This gives some two-dimensional regions on the surface of the sphere which I would like to plot. My question is how? If requested I would be more than happy to provide some Mathematica code; although I believe that the answer should be independent on the details of the regions I'm trying to plot. Thanks in advance! Update : In case anyone is interested, I have recently finished a paper in which I

Detection and styling of multiple functions in Mathematica's Plot

冷暖自知 提交于 2019-12-03 12:20:45
This question started me thinking about how Mathematica detects multiple functions being plotted. I find that I really do not understand the process. Consider: Plot[{1, Sequence[2, 3], 4}, {x, 0, 1}, PlotRange -> {0, 5}] I can understand that Plot finds three elements in the list initially, but how does it "know" to style 2 and 3 the same? It is as though there is a memory of what part of the starting list those two elements came from. How does this work? Sasha Well, it knows that there three arguments just so: In[13]:= Function[x, Length[Unevaluated[x]], HoldAll][{1, Sequence[2, 3], 4}] Out

What is the most efficient way to construct large block matrices in Mathematica?

半腔热情 提交于 2019-12-03 12:15:30
问题 Inspired by Mike Bantegui's question on constructing a matrix defined as a recurrence relation, I wonder if there is any general guidance that could be given on setting up large block matrices in the least computation time. In my experience, constructing the blocks and then putting them together can be quite inefficient (thus my answer was actually slower than Mike's original code). Join and possibly ArrayFlatten are possibly less efficient than they could be. Obviously if the matrix is