title: Strange result for the analytic integration leads to Hypergeometric2F1

text: The integration result for                Integrate[1/(r^2 Sqrt[x/r^(4 - 2 \[Gamma]) + 1]), r]        is:               -((Sqrt[1 + r^(4 - 2 \[Gamma])/x]Hypergeometric2F1[1/2, (-1 + \[Gamma])/(2 (-2 + \[Gamma])), 1 + (-1 + \[Gamma])/(2 (-2 + \[Gamma])), -(r^(4 - 2 \[Gamma])/x)])/(r Sqrt[1 + r^(-4 + 2 \[Gamma]) x] (-1 + \[Gamma])))      **first Case:** If I put x -> 2 and [Gamma] -> 3 in the result, I get:               -((Sqrt[1 + 1/(2 r^2)] (-2 r^2 + Sqrt[2] r^2 Sqrt[(1 + 2 r^2)/r^2]))/(r Sqrt[1 + 2 r^2]))           **Second case:** On the other hand, the answer for               Integrate[1/(r^2 Sqrt[2/r^(4 - 6) + 1]), r]          is:               -(Sqrt[1 + 2 r^2]/r)      which is different from the previous answer. Why? The second part of my question is that Maple gives:                -(Hypergeometric2F1[1/2, -(1/(2 (-2 + \[Gamma]))), 1 - 1/(2 (-2 + \[Gamma])), -r^(-4 + 2 \[Gamma]) x]/r)          as the result of the above integration. Why the answers of Mathematica and Maple are different? If I draw the integration results versus r, it is obvious that they are different. Did I miss some thing? **Edit 1:** In the first case the result for r=1 is : -0.0857864 and in the second case the result for r=1 is : -1.5 **Edit 2:** The results of Mathematica and Maple: ![enter image description here](http://i.stack.imgur.com/tmYqQ.jpg) **Edit 3 (Solution)** : With the help of Vašek Potoček, it seems that the difference between Mathematica and Maple outputs and also Case 1 and Case 2, is a constant value. Also one can uses the following relation to convert Maple output to Mathematica one: ![enter image description here](http://i.stack.imgur.com/uKtFk.gif) In our case, the second term is a constant value.


title: Logarithmic scale in a DensityPlot and its legend

text: I was recently faced with the task of creating a DensityPlot with a logarithmic colour scale, and with providing it with an appropriate legend. Since I could not find any resources to this effect on this site, I'd like to document my solution here. For definiteness, suppose that I want a plot of the function $$ f(x,y)=\mathrm{sinc}^2(x)\mathrm{sinc}^2(y)=\frac{\sin^2(x)\sin^2(y)}{x^2y^2}, $$ which is the diffraction pattern of a square aperture, over a box of side 20. The problem with such a function, and the reason a logarithmic scale is necessary, is that the function has lots of detail over a wide range of orders of magnitude of $f$. Thus, doing a naive `DensityPlot` of it will produce either whited-out parts with a sharp boundary with the region where the contrast is acceptable, or one bright spot and lots of detail completely lost: ![enter image description here](http://i.stack.imgur.com/hoDKf.png) (Images produced by               DensityPlot[Sinc[x]^2 Sinc[y]^2, {x, -20, 20}, {y, -20, 20},     ColorFunction -> ColorData["DeepSeaColors"], PlotPoints -> 100, PlotRange -> u]      for `u` set to `Automatic` and `Full` respectively.) Because of this, and particularly for plotting a function that has a zero, any solution to this problem must take as arguments the minimum and the maximum values of the range of interest. That range of interest is intrinsically hard- to-impossible for an automated range finder to obtain, so I'm OK with having to supply those values by hand. * * * To give a more concrete example of what the goal is, let me nick the final image from my answer: ![](http://i.stack.imgur.com/7VvVB.png)


title: Solving a system of non-linear differential equations

text: I want to solve the system of non-linear differential equations given below numerically. $$y''(t)+500y'(t)+100y(t)=-33\cos(500t)-66\cos(1000t)$$ $$300x'(t)=1000y(t)+500y'(t)-35\tanh(50x'(t))$$ Notice that there is a derivative of $x$ inside $\tanh$. I tried the code below, but many errors appeared.               sol1 =        NDSolve[{y''[t] + 500 y'[t] + 100 y[t] == -33 Cos[500 t] - 66 Cos[1000 t],         y[0] == 0, y'[0] == 0}, y, {t, 0, 30}];     sol2 =        NDSolve[{300 x'[t] ==          1000 First[Evaluate[y[t] /. sol1]] + 500 First[Evaluate[y'[t] /. sol1]] -          35 Tanh[50 x'[t]], x[0] == 0}, x, {t, 0, 30}];     Plot[{Evaluate[x[t] /. sol1], Evaluate[y[t] /. sol2]}, {t, 0, 30}, PlotRange -> All]      How can I solve my system of differential equations using _Mathematica_? ### Edit I found the answer! thanks to Nasser. The solution for $x(t)$ is like below. I just need to adjust the axis ![enter image description here](http://i.stack.imgur.com/LtCye.png)


title: Import file from FTP site

text: I would like to Import files from an FTP site. The code below works on a test site:               file = Import["ftp://test:test@ftp.secureftp-test.com/pigs.xml"];      But when I try to Import from a commercial site using similar code:               file = Import["ftp://user:pwrd@hosted.datascope.reuters.com/fldr/fname.csv"]      I get "FetchURL::conopen: The connection to URL [address above] cannot be opened. If the URL is correct, you might need to configure your firewall program, or you might need to set a proxy in the Internet connectivity tab of the Preferences dialog (or by calling SetInternetProxy). For HTTPS connections, you might need to inspect the authenticity of the server's SSL certificate and choose to accept it." If I paste the same ftp string into a browser it loads the file I want. What's wrong here? @halirutan-I think I am using the correct user name and password.   @J.M.-I'm using Win7.   @celtschi-I saw a the back slash too at some point. I think I deleted it to get the browser to work; don't remember clearly.   @all-Thanks for all this effort. I'm trying to digest this feedback.   @all-Tried again with various combinations of Element specifications with no success.   Also attempted to get a file list with no success.


title: How do I plot $x^2+y^2=1$ in 3D?

text: How would I plot $x^2+y^2=1$ in 3D (it would form a cylinder)? Since there is no $z$ in the equation, I can't solve for it and use `Plot3D`. Or can I just put the equation into Plot3D? I am very new to Mathematica.


title: Labeling different curves on a LogLinearPlot

text: I have created a couple of two-variable plots of the form `f(x,y)=x*y` where there's a number of result curves, each representing an answer (image example below). Now, usually those plots have at least 10 curves, so it is imperative to have them labelled properly. I have come up with a solution of the form:               results = {10, 20, 50, 500};     range = {100, 3.5};     Plot[y = #1/x, {x, 0, range[[1]]}, PlotLabel -> "x*y", PlotRange -> {0, range[[2]]},        Epilog -> Table[             Inset[                 Framed[Results[[n]], Background -> White],                 {Sqrt[Results[[n]]*range[[1]]/range[[2]]],                   Results[[n]]/Sqrt[Results[[n]]*range[[1]]/range[[2]]]                 }],             {n, Dimensions[Results][[1]]}         ]     ] &@Results      This produces a following result: ![Labeled Plot](http://i.imgur.com/SEznCb6.png) The seemingly confusing part when I specify the Inset coordinates is in fact a search of points where the result curves intersect with a linear function that cuts the plot quadrant in half. I am satisfied with the aesthetics of this solution. I would like to duplicate the same plug-n-play effect for plots with log scaling: LogLinearPlot, LogPlot and LogLogPlot. However, after dabbling with it for the better part of today, I reached a moment when my confusion just made me forget everything and anything I know about log functions and plots. Anyone to the rescue?                LogLinearPlot[y = #1/x, {x, 1, 1000}] &@Results      ![Unlabeled LogPlot](http://i.imgur.com/YzHpiBz.png) Thanks in advance, r.


title: How do you plot level curves describing a 3d surface on the x-y plane?

text: I am trying to plot several level curves of the cone: [x=ucos[v], y=usin[v], z=u],[0<=u<=2,0<=v<=2Pi] in the x-y plane. Does anyone know how to do this? Thanks


title: 3D Plot: Number of Roots in x of a polynomial in x, a, b and c

text: I have a polynomial in four variables x,a,b and c. The number of roots of the polynomial in x depends of the choice of a, b and c. I would like to have a 3D-Plot with a, b and c on the axes, while the number of roots >0 at a point (a,b,c) is symbolized by different colours. The most important to me is to see where exactly the transitions are. I think I need `CountRoots[Polynom,{x,0,Infinity}]`, but as I am new to Mathematica I can't figure out how to do this. Thanks a lot for your help! The function is               -a b (1 +          c) (a^8 (1 + c)^4 (6 - 56 c + 68 c^2 - 56 c^3 + 6 c^4 +             3 b (-1 + c)^4 (1 + c)) +          a^7 b (1 + c)^4 (9 b (-1 + c)^4 (1 + c) - 256 c (1 - c + c^2)) +          3 a^6 b^3 (-1 + c)^4 (1 + c)^5 -          8 a^6 b^2 (1 + c)^4 (15 + 52 c - 22 c^2 + 52 c^3 + 15 c^4) -          15 a^5 b^4 (-1 + c)^4 (1 + c)^5 -          128 a^5 b^3 (1 + c)^4 (3 + 2 c + 4 c^2 + 2 c^3 + 3 c^4) +          3 a^3 b^6 (1 + c) (-1 + c^2)^4 -          128 a^3 b^5 (1 + c)^4 (3 + 2 c + 4 c^2 + 2 c^3 + 3 c^4) -          15 a^4 b^5 (-1 + c)^4 (1 + c)^5 -          20 a^4 b^4 (1 + c)^4 (27 + 4 c + 50 c^2 + 4 c^3 + 27 c^4) +          3 a b^8 (-1 + c)^4 (1 + c)^5 -          256 a b^7 c (1 + c)^4 (1 - c + c^2) +          9 a^2 b^7 (-1 + c)^4 (1 + c)^5 -          8 a^2 b^6 (1 + c)^4 (15 + 52 c - 22 c^2 + 52 c^3 + 15 c^4) +          2 b^8 (1 + c)^4 (3 - 28 c + 34 c^2 - 28 c^3 + 3 c^4)) -       a b (1 + c) (21 a^6 b (-1 + c)^4 (1 + c)^3 -          30 a^6 (1 + c)^2 (5 - 12 c + 30 c^2 - 12 c^3 + 5 c^4) +          21 a^5 b^2 (-1 + c)^4 (1 + c)^3 -          60 a^5 b (1 + c)^2 (7 - 4 c + 42 c^2 - 4 c^3 + 7 c^4) -          42 a^3 b^4 (-1 + c)^4 (1 + c)^3 -          120 a^3 b^3 (1 + c) (1 + 37 c + 42 c^2 + 42 c^3 + 37 c^4 + c^5) -          42 a^4 b^3 (-1 + c)^4 (1 + c)^3 -          30 a^4 b^2 (1 + c)^2 (11 + 76 c + 66 c^2 + 76 c^3 + 11 c^4) +          21 a b^6 (-1 + c)^4 (1 + c)^3 -          60 a b^5 (1 + c)^2 (7 - 4 c + 42 c^2 - 4 c^3 + 7 c^4) +          21 a^2 b^5 (-1 + c)^4 (1 + c)^3 -          30 a^2 b^4 (1 + c)^2 (11 + 76 c + 66 c^2 + 76 c^3 + 11 c^4) -          30 b^6 (1 + c)^2 (5 - 12 c + 30 c^2 - 12 c^3 + 5 c^4)) x -       a b (1 + c) (54 a^3 b^2 (-1 + c)^4 (1 + c) -          168 a^3 b (1 + c) (1 + 11 c + 11 c^2 + c^3) -          54 a^4 b (-1 + c)^4 (1 + c) -          6 a^4 (29 - 4 c + 286 c^2 - 4 c^3 + 29 c^4) -          54 a b^4 (-1 + c)^4 (1 + c) -          168 a b^3 (1 + c)^2 (1 + 10 c + c^2) +          54 a^2 b^3 (-1 + c)^4 (1 + c) +          12 a^2 b^2 (1 - 340 c - 330 c^2 - 340 c^3 + c^4) -          6 b^4 (29 - 4 c + 286 c^2 - 4 c^3 + 29 c^4)) x^2 -       a b (1 + c) (-20 a b (9 + 50 c + 9 c^2) -          10 a^2 (9 + 50 c + 9 c^2) - 10 b^2 (9 + 50 c + 9 c^2)) x^3 +       72 a b (1 + c) x^4


title: How to implement a regular grammar?

text: What is the most simple, elegant way of implementing a rewrite-system defined as: $$ \begin{aligned} \Sigma &= \\{a_1, a_2, a_3, ...\\} \\\ N &= \\{A_1, A_2, A_3, ...\\} \\\ \\{\alpha_1 , \alpha_2, \alpha_3, ...\\} &= \Sigma \bigcup N \\\ F &= \\{f_1, f_2, f_3, ... \\} \\\ P &= \left\\{ \begin{aligned} A &\rightarrow a \\\ A &\rightarrow \alpha \\\ A &\rightarrow \alpha_1 | \alpha_2| \alpha_3 | ... \\\ A &\rightarrow f(\alpha_1, \alpha_2, \alpha_3, ...) \\\ \end{aligned} \right\\} \end{aligned} $$ That is: given a set of terminal symbols $\Sigma$, a set of nonterminal symbols $N$, a set of functions $F$ and a set of rewrite rules $P$, starting from an arbitrary but well-formed sentence $S$ of the grammar $G = (\Sigma, N, F, P, S)$, the system should apply the rewrite rules until all non-terminals are resolved, producing sentences like: $$ f_1(a_3, a_1, f_2(a_4, a_1), a_1, f_3(a_2, f_1(a_1), a_4)) $$ **UPDATE: Specification**   * terminal and nonterminal symbols can be e.g. strings;   * only symbols of $\Sigma$ and $N$ are replaced, functions of $F$ are left intact, though symbols inside them are to be replaced. Therefore `g["A"]` in the initial sentence below is to be replaced, e.g.: `g["A"]` \--applying-7th-rule--> `g["B" ~~ "b"]`;   * some functions should evaluate immediately to result in a (non)terminal symbol (`|` = random choice, `..` = repeate 1 or more times, `...` = repeate 0 or more times);   * all $f_i$ should be held until termination;   * rules should be applied randomly: any that fits could be chosen for a certain replacement. At present, I am struggling with recursively applying structural replacements in held rules, and it's becoming more and more complex and convoluted. There must be a simpler way, concerning _Mathematica_ is by design a very effective rewrite system. Though I have no idea how to start to exploit e.g. regular expressions. **UPDATE: Example** An example follows (note that I used `StringExpression`, but it can be replaced with `List`, or similar):               terminals = {"a", "b", "c", "d", "e", "f", "g", "h"};     nonTerminals = {"A", "B", "C", "D"};     functions = {f, g, h, i};          initSentence = g["A"] ... ~~ "B"; (* ... indicates zero or more g["A"] *)     rules = {        "A" :> "a",        "B" :> "b" | "c" | "d", (* immediately choose any terminal of the rhs *)        "C" :> "e" | "f",        "D" :> "g" | "h",        "A" :> "a" ~~ "b",        "A" :> "A" ~~ "a",        "A" :> "B" ~~ "b",        "A" :> f["e" | "f"] ~~ "a", (* do not evaluate f but choose "e" or "f" *)        "A" :> g@"h" ~~ "C",        "B" :> g@"C", (* do not evaluate g but "C" must be replaced later *)        "B" :> "B" ~~ h@"e",        "C" :> f@"f",        "C" :> "C" ~~ g@"d"        };      Starting from `initSentence` one possible process with a valid outcome would be:               g["A"] ... ~~ "B"                 (* initial sentence *)     g["A"] g["A"] ~~ "B"              (* g["A"] is repeated randomly *)     g["A" ~~ "a"] g["A"] ~~ "B"       (* rule A ":>"A "~~"a " is applied *)     g["A" ~~ "a"] g[g@"C"] ~~ "B"     (* rule "B" :> g@"C" is applied *)     g["a" ~~ "a"] g[g@"C"] ~~ "B"     (* rule "A" :> "a" is applied *)     g["a" ~~ "a"] g[g@f@"f"] ~~ "B"   (* rule "C" :> f@"f" is applied *)     g["a" ~~ "a"] g[g@f@"f"] ~~ "b" | "c" | "d"  (* rule "B":>"b"|"c"|"d" is applied *)     g["a" ~~ "a"] g[g@f@"f"] ~~ "d"   (* one terminal is randomly chosen *)     (* terminate and evaluate g, f *)      The point is that the grammar is represented as a set of rules that are both probabilistic (e.g. random choices) and are applied in a random way, i.e. for each symbol (at each step), a **random** fitting rule should be applied.


title: Mathematica 9 Citation

text: I want to cite _Mathematica_ 9.0.1 in my paper, but the standard citation is not available here http://support.wolfram.com/kb/472. Can you let me know where I can find it or give me one good sample (I don't know which tag should this question belong to, hence I just put it in `citation-management`).


title: How to match two sets of data over 1 or more identifier, of unequal length?

text: Brief Question about how to best match lists with Criteria from Identifiers (thus for me: translate SQL to Mathematica ;) ). If I have two sets:                set1 = {{ExperimentCode1,        No of Experiments1}, {ExperimentCode2, No of Experiments2} ...}        set2 = {{ExperimentCode1,         TypeofExp1}, {ExperimentCode2, No of TypeofExp1} ...}        Now set 1 has 10 Entries, set2 only contains data for 3.               'Sql: Select * from set1 Inner Join set 2 on set1.Experimentcode=set2.Experimentcode'        This only matches cases in SQL where the variables exist in both lists (Thus result = 3 Elements)               'Sql: Select * from set1 Left Join set 2 on set1.Experimentcode=set2.Experimentcode'        This returns all Elements from List 1 and the matched from List 2 (result=10 elements, 3 Elements have now the additional value type, the other 7 Null values for type). I think this is even more tricky when there is more than one Identifier (Thus two fields together represent a unique identfying number).


title: Find nearest distance of an interior point from perimeter

text: By definition, the interior point is a point inside an arbitrary region like this: ![enter image description here](http://i.stack.imgur.com/seIFN.png) In picture above, $y$ is an interior point of region. **My question** is how to find the distance of an interior point from it's boundary? I have this Idea: By using the polygons, we can approximate the perimeter of region by a n-gon (n is large enough). Then by saving the coordinates of perimeter in two vectors, say $x$ and $y$, and use `Nearest` command we can find nearest point of perimeter from interior point ($y$). I created data matrices (find from here) in MATLAB and import to Mathematica.               imp = Import["PI.mat", "LabeledData"];     X = "KP" /. imp;     Y = "KI" /. imp;      But I can't know how to use `Nearest` command when we have large vectors like `X` and `Y` :               Nearest[{Flatten@X, Flatten@Y}, {3, 1.5}]      An error appears, because `Flatten@X`, `Flatten@Y` and `{3, 1.5}` are not the same length.


title: Determining the default Method used in optimization and root-finding algorithms

text: Is it possible to extract the `Method` which is used in functions like `NMinimize`, `FindRoot`, `FindMinimium`, and partners when one doesn't set this option explicitly? Basic example:               NMinimize[x^4 - 3 x^2 - x, x]      What is used as `Method` here? I expected to find some setting in `SystemOptions[]` but was unable to. Obviously `AbsoluteOptions[expr]` cannot be used in such a case since unlike a e.g. graphic, the minimization result does not contain this option information anymore. Here is what is stated in the documentation of `Method`: > With the default setting `Method -> Automatic`, _Mathematica_ will > automatically try to pick the best method for a particular computation. This tells us the chosen `Method` depends on the input problem. Therefore, a fixed setting in `SystemOptions` wouldn't make sense. Additionally, there exists a document describing some internal implementations. Basically, you can extract most information from there, but I was hoping for a way to extract the used `Method` during a run.


title: Center Diverging color map on a matrix plot

text: I want to use the color function "RedBlueTones" and I want to center the map at a number. Then I want to blend in the red direction of I am greater than that number and blend in the blue direction if I am less than that number. Here is an example. How do I center this at 8?               MatrixPlot[stackTest, ColorFunction -> "RedBlueTones"]     stackTest = {{1, 2, 3, 4, 5, 6, 7, 8, 9, 10}}


title: Can I save a manually cropped Image in Mathematica 10 without hard cropping?

text: In _Mathematica_ 7 I was accustomed to a certain workflow:   1. Paste an image into a Notebook   2. Select **Actual Size** from the context menu, if necessary   3. `Ctrl`-drag the control points on the sides of the frame to soft-crop the image   4. Use **File** > **Save Selection As...** to save the cropped image to a file This workflow is broken in version 10 because in it the entire _uncropped_ image is saved whether I select the image itself or the enclosing Cell frame. I can use the Crop Tool to crop the image, and that does allow me to save a cropped selection, but it hard-crops the image so that I cannot in the future change my crop selection. (Of the Image in the Notebook.) If the soft-cropped Image is part of a larger selection (but not merely a Cell containing only the image) the cropped part is indeed saved. This works for saving sections of Notebooks but not images alone. The only work-around I have found to both keep a soft-cropped Image and save a matching copy is to copy the Image and crop it again with the Crop Tool, then delete the copy. This adds significant time to my workflow. **Is this change a bug or a feature?** **Is there another way to accomplish what I want interactively?**


title: How to define the Einstein summation convention in Mathematica?

text: How to define a Einstein summation convention in Mathematica? Say, how to let Mathematica know `T[i,i]` equals `T[1,1]+T[2,2]+T[3,3]`? How to define the function `T[i,j]`? I know there are several Mathematica-abased programs that can do this, but still I want to know how to define my own.


title: Strange behavior of my vertex eventhandler!

text: I have two level EventHandler. The inner one is made of vertex of Graph and the other outer one is of the Dynamic Graph. (1) If I select a arbitray place on the Graph except a vertex, then every thing is OK, but (2) if I select the vertex **after restart this code** , then dragging process is sttoped I don't know why it is doing like this. If I remove MouseDown of **vertex eventhandler** in this code, then the process is ok. but I want to make some action after vertex MouseDown. Is there something help! thank you.               DynamicModule[{vlist, elist, p, mousep, select},      vlist = EventHandler[#, {           "MouseDown" :> AppendTo[e, 1],           "MouseDragged" :> AppendTo[e, 2]}] & /@ Range[3];      elist = {1 -> 2, 2 -> 3, 3 -> 1, 1 -> 3};      p = {{-.5, -.2}, {.5, -.2}, {0, .5}};e = {};      EventHandler[       Dynamic[        Graph[vlist, elist, VertexCoordinates -> p, VertexSize -> {.15, .15},          VertexLabels -> "Name", PlotRange -> 1]],       {"MouseDown" :> (AppendTo[e, 3];          mousep = MousePosition["Graphics"];          select = Position[p, Nearest[p, mousep][[1]]][[1, 1]]),        "MouseDragged" :> (AppendTo[e, 4];          p[[select]] = MousePosition["Graphics"]),        "MouseUp" :> (Print[Short[e, 1]]; e = {})}, PassEventsDown -> True]      ]


title: Dealing with large files

text: I have a *.dat file in which the contents are basically one giant list:               {1,2,3,4} {5,6,7,8} {9,10,11,12}      and so on. I'd like to read in the first 500 members { } .... { } in to do some computations. The problem is that the file is about 1.5 GB. How does one deal with large files of this type in _Mathematica_?


title: Exporting data from Excel into Mathematica using clipboard

text: I know that it's possible to import Excel data into Mathematica using the `Import` command, as we can see in this post. But some times, I need just to do some fast calculation and It would be very nice if I could achieve It using clipboard, using something as simple as CTRL+C/CTRL+V. How could I perform that?


title: How to plot on a symmetric axis/frame

text: Say one had a function that was itself asymmetric about the abscissa, but one desired to plot it on a symmetric ordinate. How can this be achieved with `Plot` automatically (without separately computing the limits and providing them to `Plot`)? **Example** The plot of `1/2` serves as a sufficient example.               Table[       Plot[          1/2,          { x, 0, 1 },          Frame -> { False, True }[[i]],          Axes -> { True, False }[[i]]        ],       { i, 1, 2 }       ]      ![asymmetric plots](http://i.stack.imgur.com/DJB3k.png) But we might want the `PlotRange` to go from $+1$ to $-1$ instead, like: ![symmetric plot](http://i.stack.imgur.com/wn94G.png) I did this with the option `PlotRange`, but short of finding the maximum of the absolute value of the function and setting `PlotRange`, I don't know how to automate this. Specifically, is it possible to use `Plot` in a native manner to do this? **Solution** (based on the answer by Szabolcs) Here's a little function that implements the answer.               plotSym[ plot_ ] :=        plot //         {            #,            First[PlotRange /. AbsoluteOptions[#, PlotRange]],            Max@Abs@Last[PlotRange /. AbsoluteOptions[#, PlotRange]]          } & //           Show[ #[[1]], PlotRange -> {#[[2]], (1.2*{-#[[3]], #[[3]]})} ] &        Note: I added the factor of `1.2` as a way to give the plot a little more room. It can be anything nonzero (including the likely more-desirable `1`).


title: Version 10 of Mathematica in Windows XP

text: I obtained the latest version 10 of Mathematica however, when I start the installation the process aborts and a pop up window explains that "The program requires Windows NT version 6.0 or later". As far as I know, this means that version 10 is compatible only with Vista and all later versions of windows, am I right? In my PC I still have Windows XP SP3. So, is there a way to install version 10 in this OS? Currently, I have version 9 and runs like a charm. I refuse to believe that Wolfram made in purpose version 10 incompatible with XP.


title: How to count words in a Greek text

text: I want to perform a simple analysis of some Greek text: collect the different words used and count their frequency. It seems that some of the built-in commands do not work well with Greek letters. For instance, with               words = StringCases["α β1 rpr other", WordCharacter ..]      the output is               {"1", "rpr", "other"}      How do I get _Mathematica_ to recognize other kinds of words?


title: Problems running Mathematica 10 with Workbench 2 Windows 7 64 bit

text: My Workbench runs perfectly using Mathematica 9, however simple things which run just using the Mathematica 10 front end won't run when using Mathematica 10 and Workbench 2. These simple two lines of code produce errors when workbench is used. Any insight would be much appreciated Markus               ids = "C:/Mathematica/Data/";     rawdata = Import[ids <> "DATA8.XLS"][[1]]      > LinkObject::linkn: Argument LinkObject["C:\Program Files\Wolfram > Research\Mathematica\10.0\SystemFiles\Java\Windows-x86-64\bin\javaw" > -classpath "C:\Program Files\Wolfram Research\\[Ellipsis] > wolfram.jlink.JLinkSystemClassLoader com.wolfram.jlink.Install -init > "C:\Users\User\AppData\Local\Temp\m-38eb99ec-4611-4185-9090-ae0d23ac0ad9",183,8] > in LinkReadyQ[LinkObject["C:\Program Files\Wolfram > Research\Mathematica\10.0\SystemFiles\Java\Windows-x86-64\bin\javaw" > -classpath "C:\Program Files\Wolfram Res[Ellipsis] > m.jlink.JLinkSystemClassLoader com.wolfram.jlink.Install -init > "C:\Users\User\AppData\Local\Temp\m-38eb99ec-4611-4185-9090-ae0d23ac0ad9",183,8]] > has an invalid LinkObject number; the link may be closed. >> > > LinkObject::linkn: Argument LinkObject["C:\Program Files\Wolfram > Research\Mathematica\10.0\SystemFiles\Java\Windows-x86-64\bin\javaw" > -classpath "C:\Program Files\Wolfram Research\\[Ellipsis] > wolfram.jlink.JLinkSystemClassLoader com.wolfram.jlink.Install -init > "C:\Users\User\AppData\Local\Temp\m-38eb99ec-4611-4185-9090-ae0d23ac0ad9",183,8] > in LinkConnectedQ[LinkObject["C:\Program Files\Wolfram > Research\Mathematica\10.0\SystemFiles\Java\Windows-x86-64\bin\javaw" > -classpath "C:\Program Files\Wolfram R[Ellipsis] > jlink.JLinkSystemClassLoader com.wolfram.jlink.Install -init > "C:\Users\User\AppData\Local\Temp\m-38eb99ec-4611-4185-9090-ae0d23ac0ad9",183,8]] > has an invalid LinkObject number; the link may be closed. >> > > LinkObject::linkn: Argument LinkObject["C:\Program Files\Wolfram > Research\Mathematica\10.0\SystemFiles\Java\Windows-x86-64\bin\javaw" > -classpath "C:\Program Files\Wolfram Research\\[Ellipsis] > wolfram.jlink.JLinkSystemClassLoader com.wolfram.jlink.Install -init > "C:\Users\User\AppData\Local\Temp\m-38eb99ec-4611-4185-9090-ae0d23ac0ad9",183,8] > in LinkReadyQ[LinkObject["C:\Program Files\Wolfram > Research\Mathematica\10.0\SystemFiles\Java\Windows-x86-64\bin\javaw" > -classpath "C:\Program Files\Wolfram Res[Ellipsis] > m.jlink.JLinkSystemClassLoader com.wolfram.jlink.Install -init > "C:\Users\User\AppData\Local\Temp\m-38eb99ec-4611-4185-9090-ae0d23ac0ad9",183,8]] > has an invalid LinkObject number; the link may be closed. >>


title: Simplify and Sqrt, inconsistent behavior?

text: I have encountered some problems when using `Simplify` with expressions containing a square root and isolated a following test case               Simplify[x - #[y], x == #[y]] & /@ {Sin, Sqrt, #^s &, #^(3/2) &}      with a result               {0, x - Sqrt[y], 0, x - y^(3/2)}        1. Why is `x-Sqrt[y]` not simplified to `0` as in the case of `x-Sin[y]`?   2. What is the logic behind simplifying `x-y^s` to `0`, but keeping x-y^(3/2)?   3. Why do all the above differences vanish when we replace `-` with `==`? In such case              Simplify[x == #[y], x == #[y]] & /@ {Sin, Sqrt, #^s &, #^(3/2) &}      results in              {True, True, True, True}


title: Negative Continued Fraction of a Rational

text: The $n^{\text{th}}$ _negative continued fraction convergent_ $x_n$ of a positive real $x$ is computed by the nested function \begin{align} x_n = k_1 - \frac{1}{k_2 - \frac{1}{k_3 - \dots - \tfrac{1}{k_n}}}, \end{align} where $k_1, \dots, k_n$ are positive integers for all $n \in \mathbb{N}$. To compute the first $n$ negative continued fraction coefficients, namely, $\\{k_1, \dots, k_n \\}$, of an arbitrary irrational $x$, I use the following example Mathematica code:                x = Sqrt[2];      n = 15;      Map[#[[1, 1]] &, Rest[NestList[1/(Ceiling[#] - #) &, x, n]]].       which outputs $\\{ 2, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4, 2, 4 \\}$. However, this code is not suitable if $x$ is a rational, since the recurrence diverges when $\\#$ is an integer. How might I modify the above code to allow for rational $x$ and output the finite list of coefficients of its complete negative continued fraction?


title: Listlineplot starting from 0

text: I got a matrix which looks the following and should be seen as a list of pairs with (x,y) coordinates:               test = {{0, 1, 2, 3}, {11000, 23940., 36880., 49820.}};      I'm trying to plot them with the following command:               ListLinePlot[test, PlotRange -> {{0, 4}, {0, 50000}}]      ![](http://i.stack.imgur.com/h4hQj.png) My problem: with the above commands I always get a plot that starts with 1 for the first x-coordinate instead of 0, then takes 2 instead of 1 for the second x-coordinate and so on. All I want is to plot the points exactly as listed in `test`. As if I had a entered a list like `{{1,2,3,4},{11000,23940,36880,49820}}`, which I obviously didn't. Can someone help me?


title: N for a function of several variables

text: Let               Z[1] = EmpiricalDistribution[{0.5, 0.5} -> {0, 1}]     Z[2] = EmpiricalDistribution[{0.6, 0.4} -> {0, 1}]     Z[3] = EmpiricalDistribution[{0.7, 0.3} -> {0, 1}]      and               F[i_, j_, k_, m_] :=       Probability[       Sum[\[Alpha][u], {u, 1, i}] + Sum[\[Beta][u], {u, 1, j}] +          Sum[\[Gamma][u], {u, 1, k}] <= m, {Distributed[\[Alpha][1], Z[1]],         Distributed[\[Alpha][2], Z[1]], Distributed[\[Alpha][3], Z[1]],         Distributed[\[Alpha][4], Z[1]], Distributed[\[Alpha][5], Z[1]],         Distributed[\[Alpha][6], Z[1]], Distributed[\[Beta][1], Z[2]],         Distributed[\[Beta][2], Z[2]], Distributed[\[Beta][3], Z[2]],         Distributed[\[Gamma][1], Z[3]], Distributed[\[Gamma][2], Z[3]]}]      How to get the values of such function with provided precision? For example: a command `N[F[6,3,2,0],40]` doesn't give what I want. In some sense, my function belongs only on m. Variables i=1,..,6, j=1,..,3 and k=1,..,2 are like a parameters for my function. Thanks in advance.


title: NDSolveValue producing message: Input is not an ordinary differential equation

text: I have an urgent question for my program because I get always an error output for it. I have a partial differential equation that I want to solve with `NDSolveValue`. I have two starting conditions for the time t, and two boundary conditions for the position x (Dirichlet and Neumann). Here is my program:               gamma = 0.08; tMax = 10000.; xMax = 1; xMin = -xMax;           First[s = NDSolveValue[{Derivative[0, 2][q][x, t] ==                 -(gamma*D[q[x, t], {t}]) - Derivative[2, 0][q][x, t] -                   q[x, t]^3 - q[x, t], (D[q[x, t], t] /. t -> 0) == 0,          q[x, 0] == 1,               DirichletCondition[{q[xMin, t] == 0, q[xMax, t] == 0}, True],               WhenEvent[D[q[x, t], {x}]{xMin} == D[q[x, t], {x}]{xMax},                 True]}, q[x, t], {t, 0, tMax}, {x, xMin, xMax},             MaxSteps -> Infinity]]      I would be really happy, if there is someone who can help me. I'm trying to get some useful results for some days. And I'm frustrated because no trial has been successful.


title: Extracting solutions from one equation and placing them as inputs of another equation

text: I have a very simple equation `2x + y = 10` I want to know which integer combinations of `x` and `y` between `-10 & 20` will yield a solution `10`. I then want to store the various solutions of `x` and `y` and have them as inputs to another equation `x^2 + 2y = z` and in the end I want a list of all the `z` values. How do I tell Mathematica to do that? I tried:               one[x_, y_] = 2 x + y;      Array[{Solve[one[x_, y_] == 3, {20 > x > -10, 20 > y -10}}, [one, 10]]


title: Scale x axes in ListContourPlot

text: I have list of data which I visualize by using `ListContourPlot`.               data = Table[RandomReal[i]*RandomReal[j], {i, 5}, {j, 6}];            ListContourPlot[data, AspectRatio -> 1/10, ImageSize -> 700]      ![ListContourPlot](http://i.stack.imgur.com/yF6bd.png) Each column of data correspondes to a segment which has a certain length. For example:               segments = {{0, 5}, {5, 12}, {12, 27}, {27, 32}, {32, 35}, {35, 40}}      Now I would like to rescale the x axes so that the columns have the right length in the plot. If possible also the caption of the x axes should match. -Frink


title: How can I have interruptible computations inside a manipulate?

text: Here's a perfect example of my problem:               Manipulate[Pause[n], {n, {1, 10}, ContinuousAction -> False}, SynchronousUpdating -> False]      It is illustrated by clicking 10 and then immediately clicking 1, that is, you shouldn't have to wait, it should stop pausing for ten seconds and begin pausing for only one second. In general, Mathematica does not release a previous computation until the current one is finished. I need to override this in my application, which involves a computationally expensive function for only some values in the slider, and I want the computation to stop and restart when the mouse is dragged. A Manipulate itself is not necessary for me, perhaps some trickery with Dynamics can achieve this? Also, would your solution work if the function that the slider drives is written with javalink?


title: Manipulate with explicit updates

text: I want to use `Manipulate` (I am open to other alternatives) to apply one of two different functions `f` or `g` to a set of values. The issue is that, I want to update the evaluation only when the user clicks on one of the button `f` or `g`. I came up with the following work around but I wonder if there is a better/standard way to implement such a thing?               Module[{val},      Manipulate[       val = Switch[op, "f", op = ""; f[x], "g", op = ""; g[x], "", val];        val, {x, {1, 2, 3}, Setter}, {op, {"f", "g"}, Setter},        TrackedSymbols -> {op}]      ]      As a side question: is there any way to tell `Manipulate` to ignore the current evaluation and keep the last evaluated value?


title: ArrayPlot and non-integer PlotRange

text: There seems to weird bug regarding non-integer `PlotRange` in `ArrayPlot`. For example...               ArrayPlot[        Table[Sin[x/50 π] Tanh[y/50 π], {y, 100}, {x, 100}],        DataRange -> {{0, 1}, {0, 1}},        PlotRange -> {{0, 1}, {0.5, .9}}     ]      gives an error: > Value of option PlotRange -> {{0,1},{0.5,0.9}} is not All, Full, Automatic, > a positive machine number, or an appropriate list of range specifications. The same code works, if one of the plot range parameters for y-axes is turned into an integer. Did I do smth wrong? Is there a workaround? I need to use array plot as `ListContourPlot` is too slow for large datasets and `MatrixPlot` has the same problem. I am using _Mathematica_ 8 64 bit version on linux. **Edit** After some more testing I see, that it works whenever PlotRange includes at least one integer. For example `PlotRange -> {{0, 1}, {0.5, 1.2}}` works as it includes 1. So one possible workaround is just to scale the range, such that max-min would be larger than 1. But I am still looking forward, if anyone finds a way to have shorter than 1 range on the axes. Dirty way would be just using manual 'Ticks'. **Edit 2** Possible workaround. As I wrote in the previous edit, it works, then the range includes at least one integer. So one could just scale the range. Here is a naive hard-coded example how it might be done.               ArrayPlot[        Table[Sin[x/50 π] Tanh[y/50 π], {y, 100}, {x, 100}],        DataRange -> {{0, 1}, {0, 1} 10},         PlotRange -> {{0, 1}, {0.1, 0.8} 10},         FrameTicks -> {Table[{y, ToString[y/10 // N]}, {y, 1, 8, 1}],         Table[{x, ToString[x // N]}, {x, 0, 1, 0.25}]},         AspectRatio -> 1     ]      This means that I have bypassed the only side-effect of scaling the range, which is messing up the tick labels. I would submit it as a solution, when I have waited my 8 hours and there is no nicer one proposed.


title: How to plot a quarter of circle using Mathematica?

text: How can I plot a quarter of circle using `x` as abscissa while `y` as ordinate by taking advantage of the `Plot` function of Mathematica when `a` is in the range of `[0,Pi/2]` ?               x=2*Sin[a];     y=2*Cos[a];


title: How do I reassign canonical ordering of symbols?

text: I have a big polynomial that evaluates to: $$A^2 e^2 \phi ^- \phi ^++A e \phi ^- \phi ^+ c_{2 w} g_Z+\frac{1}{2} A e g h W^- \phi ^+ +\ll13\gg,$$ which is supposed to represent some terms in the standard model Lagrangian. I need to do the following:   1. Reorganize the factors in each term so that $e$ comes before $A$ and $\phi^+$ before $\phi^-$. So that the first term, for example, would instead read $e^2A^2\phi ^+\phi ^- $.   2. Reorganize the whole polynomial so that terms containing $h$ comes first and those containing $\phi^\pm$ come last so that the above expression would start with the third term displayed above. I believe this would be done most efficiently by customizing the canonical ordering of each symbol in _Mathematica_. I'm pretty sure this can't be done — so what can I do to achieve my task?


title: Change Meta-Information "Title" of PDF file in Export

text: Whenever I export a PDF file in Mathematica with the Export command, the meta- info of the pdf file will have the title as "Temporary Clipboard 0". I want to change the title. But using:               plot = Plot[Sin[x], {x, 0, 6 Pi}];     Export["test.pdf", plot, "Title" -> "Some title"]      does not change anything. The Manual, says "Title" is the correct Meta-information element. Whats wrong? Thank you for your time reading this and your possible hints and solutions!


title: More elegant way

text: I read ReplaceOrRemoveInvalidOrMissingData _Mathematica_ documentation, and I tried to apply the same approach to my dataset. I've got two problems, but one is only a style problem!   1. There is one more elegant way to select numeric data in a large dataset? I mean that I've got a dataset o 29 possible numeric value and 2 columns that are not numerical. So I tried this way.               baddata[entry_] :=  Not[MatchQ[ entry,        {_?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ,        _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ,         _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ,        _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ, _?NumberQ,        _?NumberQ, __}]]          DeleteCases[data, _?baddata];      It works, but it is not so elegant! 2 . I would accept some non numerical (e.g. blank values) values in some columns (e.g. the first, the twelfth and the twentieth). How can I modify this algorithm? Thanks in advance. * * * EDIT Your answers are very useful for me, and I'm wondering how all of you use Mathematica in a very smart way! For my first question it's very clear all your solutions, but, it is not clear for me (surely I didn't explain in a right way my problem) if I've got this kind of dataset               mydataset={{1, 2, 3, 4}, {3, 4, 5, 4}, {1, "", 3, 4}, {10, "", 12, 13}, {20, 30,     40, ""}, {100, 200, 300, ""}};      I want to select the row in this way: I can admit blank entries for the second column, but not for the fourth column. So the result would be:               result={{1, 2, 3, 4}, {3, 4, 5, 4}, {1, "", 3, 4}, {10, "", 12, 13}}      Can I modify your algorithm in this way? Thanks again, and sorry!


title: UnitStep in Mathematica when t varies differently

text: How can I use the `UnitStep` command when I have a piecewise function $f(t)$, where $f(t)= 0$, when $|t|>4$, and $f(t)=1$, when $|t|<4$? I tried with `UnitStep[t-4]` but didn't work like I want it to work.


title: Asymptotic expansion

text: I wanted to expand a function of $x$ about $x=\infty$ and see its coefficients as a function of the parameters $m,n,q,y$ and I wrote this - but it didn't work! It gave me back a very complicated expression with powers of $x$ scattered everywhere - but I want a Laurent series expansion of it! Can someone kindly help with this?               Assuming [ y ∈ Reals &&  m ∈ Reals && q > 0 &&  n ∈ Integers    && x > 0 , Series [   ((         Gamma [ I x + (1 + y)/2]   Gamma [ -I x + (1 + y)/2]    )/(        Gamma [I  x] Gamma [ -I  x] ) )* (1/(        x^2  + m^2 + (n/q)^2)), {x, Infinity, 3}] ]      To write it readably - the function is, $\frac{ \Gamma (ix + (1+y)/2) \Gamma( -ix + (1+y)/2)}{\Gamma (- i x) \Gamma (i x) } \frac{1}{x^2 + m^2 + (n/q)^2 }$ * * * On some computers and Mathematica versions - the answer to the above comes out as -               (1/x)^-y (1/x+(2 π (-m^2/(2 π)-n^2/(2 π q^2))+1/24 (-y +y^3)) (1/x)^3+O[1/x]^4)      but I don't know why on my computer and Mathematica it doesn'! * * * Some simple examples do work like Series [ x/(x^2 + 3) , {x, Infinity, 2}]


title: solution of differential equation

text: I have the following code that gives you a phase portrait of a 2d system and I can't understand what means the 3rd and 4th line (sol1 and sol2).               sys = {x'[t] == 3 x[t], y'[t] == -y[t]};          ss = DSolve[sys, {x[t], y[t]}, t];          sol1 = ss[[1, 1, 2]];          sol2 = ss[[1, 2, 2]];          toplot = Flatten[       Table[{sol1, sol2} /. {C[1] -> i, C[2] -> j},          {i, -0.5, 0.5, 0.25}, {j, -0.5, 0.5, 0.25}], 1]          graphs = ParametricPlot[Evaluate[toplot], {t, -3, 3}]      I searched the documentation but I couldn't figure it out. Thank you. @J.M. @belisarius I try to extend it in non linear eqiations. I tried another example with a non linear diff eq. What I wanted to find was the phase space. When I put μ>0 then it plots a solution, but it does not show the other fixed point that is non stable. For everything else μ it does not do anything. `sol = NDSolve[{x'[t] == μ - x[t]^2, y'[t] == -y[t], x[0] == x0, y[0] == y0}, {x[t], y[t]}, {t, 0, 100}]` `toplot = Table[{x@t, y@t} /. sol, {x0, -.5, 2, .25}, {y0, -.5, .5, .25}];` `ParametricPlot[Evaluate[toplot], {t, 0, 100}, PlotRange -> All]` I now the dynamics of the above, I do not want you to explain that to me. I want your help because I am trying to learn mathematica.


title: Manipulate which creates and deletes Manipulators dynamically

text: I want to plot a function in a `Manipulate` in which the number of terms varies and a `Manipulator` for the coefficient of each term is created or deleted as the terms increase and decrease. For example, when I have three terms, I should get the equivalent of               Manipulate[       Plot[a0 + a1 x + a2 x^2, {x, 0, 10}],        {a0, 1, 10},        {a1, 1, 10},        {a2, 1, 10}]      I want to let the number of terms vary and but still control each coefficient with a `Manipulator`. I tried to do it in the following way:               Manipulate[       Plot[Total[ToExpression["a" <> ToString[#]] x^# & /@ Range[0, n]], {x, 0, 10}],       {n, 1, 10, 1},       Dynamic[Sequence @@ ({ToExpression["a" <> ToString[#]], 1, 10} & /@ Range[1, n])]]      It did not work. Can anybody suggest what I should do to make it work?


title: How to read image files in Analyze 7.5 format?

text: I am using GATE/Geant4 for simulating photon beams interacting with matter. For 3D dose distributions, GATE outputs the data into an Analyze 7.5 format [1]. I was wondering whether there exists a function in _Mathematica_ that could read files in this format and display the data. For what is worth, Matlab has `analyze75read` [2] for this purpose. [1] http://eeg.sourceforge.net/ANALYZE75.pdf [2] http://www.mathworks.com/help/images/ref/analyze75read.html ( This comment will soon be deleted: I don't have access at the moment to my Mathematica installation, but here is a file in case anyone would like to play with it: http://leaf.dragonflybsd.org/~beket/geant4/Config-gamma-Dose.hdr and http://leaf.dragonflybsd.org/~beket/geant4/Config-gamma-Dose.img ).


title: Keep order of mulciplication in Matrix production

text: {{λ E, B}, {λ A1, λ E}}.{{E, 0}, {-A1, E}}      \begin{align*}\left(\begin{array}{cc} E^2 \lambda -A1 B & B E \\\ 0 & E^2 \lambda \\\\\end{array}\right)\end{align*} The result is not quit true, since $A1 B$ may not equal to $B A1$ when $A1$ and $B$ are block matrix.


title: Using LinkSnooper for monitoring the communication with an installable MathLink program

text: How can I monitor the communication between an installable MathLink program and the kernel? Can LinkSnooper do this?


title: Find area of polygon on a sphere from a set of latitude-longitude points

text: Given a list of latitude and longitudes say               {{32.6123, -117.041}, {40.6973, -111.9}, {34.0276, -118.046},       {40.8231, -111.986}, {34.0446, -117.94}, {33.7389, -118.024}}      how can I find the area enclosed by the polygon formed by these points. In other words, how can I implement the 3D convex hull (surface area) on a set of lat-long pairs?


title: Want to label vertices of a graph and manually move them around

text: I would like to plot a graph in such a way that   1. The vertices are labeled using labels that I've given them, rather than just their number,    2. I can manually move the vertices around. In the code below, `A` is my 4 x 4 adjacency matrix, and `People` specifies the labels that I'd like for the 4 vertices. `AG` gives me a graph that accomplishes (1) but not (2). `GP` gives me a graph that satisfies (2) but not (1) -- it only labels the vertices by their number. How can I accomplish both (1) and (2) simultaneously? `GraphPLot` does not seem to allow for `VertexLabels` as an option, so I'm at a loss here.               A = {{0, 1, 1, 1}, {1, 0, 0, 0}, {1, 0, 0, 1}, {1, 0, 1, 0}}     People = {Bob, Eric, Lucy, Liz}     AG = AdjacencyGraph[A, VertexLabels -> Table[i -> People[[i]], {i, 1, Length[People]}]]     GP = GraphPlot[AG, VertexLabeling -> True]


title: Eigenvectors inside a maniupulate function

text: I am trying to make a physics application and it requires that the eigenvectors be taken for a 3x3 matrix. It is my intention that Mathematica never have to deal with the matrices symbolically. Therefore, because the element I am plotting by is in the matrices, I have used set delay in my code to make sure that when the functions are called all parameters have numerical values. Nonetheless, Mathematica continuous to return the error that not all the eigenvectors can be found though I have `SynchronousUpdating -> False`, and what I also find strange is that having a set delay inside the manipulate function causes the application to continuously update even when nothing is changing. The code below is a simplified case of how the code runs. Does anyone have ideas to how to make this code run so that it is not continuously updating and athematica never has to deal with things symbolically.                Manipulate[      g[e_] := ( {     {e, ρ, 11},     {1, e, ρ},     {1, 1, e}} );          U[e_] := (Transpose[Eigenvectors[g[e]]]).( {      {0, 0, 1},      {0, 1, 0},      {1, 0, 0}     } );      LogLinearPlot[(\!\(     \*UnderoverscriptBox[\(\[Sum]\), \(l = 1\), \(3\)]\(\(U[e]\)[\([1,        l]\)]\)\)), {e, .01, 50},        AxesLabel -> {"Disrance (Km)", "Probability"},        PlotRange -> All], {{ρ, 9.6,         "\!\(\*FractionBox[\(g\), SuperscriptBox[\(cm\), \(3\)]]\)"}, 0.,        120.}, ControlPlacement -> Left, SynchronousUpdating -> False,       ContinuousAction -> False]


title: How to transform equation

text: Is there any possible way to write this equation of 4th order as a system of two diff equations of second order with two new variables and to do that automatically? statespace command is transforming it into first order                 eq=a1*X1[x] + a2*Derivative[2][X1][x]-Derivative[4][X1][x];


title: will the same result be evaluated twice per evaluation?

text: here is the silly question of mine, if `mathematica` takes `3` seconds to evaluate the function `f[3]` then I plug the this value `f[3]` into a new function `g[f[3],f[3]]`, Let's ignore the evaluation time for the new function `g`, how long does it take for `g[f[3],f[3]]`, 3 seconds or 6 seconds? if it is 6 seconds, how can I make `mathematica` temporarily to remember the value of `f[3]` thanks


title: HSB -> HSL Converter

text: Starting from an image I would like to apply a custom filter to an image. I have thought and implemented this filter in HSL space and it goes like this :   * Boost the saturation of the pixels that have a S value > .5    * Decrease the ones where S < .5. Would I have the HSL Values instead of the HSB the code would go like this :               img = Import["ExampleData/lena.tif"];     ImageColorSpace[img]     img = ImageResize[img, 128];     img = ColorConvert[img, "HSB"];     imgd = ImageData[img];     newimg = ({#[[1]], 1/(1 + E^(10*#[[2]]*(#[[2]] - .5))), #[[3]]} & /@        imgd[[#]]) & /@ Range[Length[imgd]];     newimg = Image[newimg]      **My Problem :** I cannot figure out how to convert HSB (only hue based space in M9 to my knowledge) to HSL.


title: Exporting 3D plotted figure complete with legend ready for Word

text: I have one more problem, still with exporting full quality 3d figure into Word. I want perfect quality in a Word document of a 3d figure prepared with legend (traditional form of text). Extremes of the function in figure is nice to be yellow and rest of the function feature red. Example,                 Plot3D[Sin[4 x]*Cos[4 y], {x, -2, 2}, {y, -2, 2}]      I need this figure to import in Word with full prepared legend and combination of color (red-yellow).


title: TensorContract of inverse matrix

text: ### Matrix inverse in mathematica If $A$ is an invertible $n \times n$ matrix, then $A\cdot A^{-1} = I$. To get this statement in Mathematica, you need the assumption   `MatrixPower[A, 0] = IdentityMatrix[n]`               $Assumptions = {Element[A, Matrices[{n, n}]],                      Det[A] != 0, ForAll[{A}, MatrixPower[A, 0] == IdentityMatrix[n]]}     TensorExpand[Inverse[A].A] // Simplify      `Out[1]= IdentityMatrix[n]`. ### Matrix as a tensor A matrix can also be seen as a tensor of rank 2; i.e. a list with two levels, on for the columns and one for the rows. The tensor product $A \otimes A^{-1}$ corresponds in Mathematica with the outer product of the two lists. In this case it is a list with four levels, a four-tensor. When matrices are viewed as tensors, the dot product is the same as a tensor product followed by a contraction. In Mathematica the matrix product $A\cdot A^{-1}$ can also be written as               TensorContract[Inverse[A]\[TensorProduct]A, {2, 3}]       **Question 1** How can I let Mathematica evaluate the above expression to IdentityMatrix[n]? ### Involving more tensors Suppose there is a second $n \times n$ matrix $B$. In that case one can think of more complex tensor products, for example $B \otimes A \otimes A^{-a}$. This is a rank 6 tensor. Contracting slots 3 and 4 of the 6-tensor gives 4-tensor $B \otimes I$, where $I$ is the identity matrix. In Mathematica, this contraction can be written as               TensorContract[B\[TensorProduct]A\[TensorProduct]Inverse[A], {3, 4}]       **Question 2**   Also for the above contraction, I would like Mathematica to use the idenity $A\cdot A^{-1} = I$. It should evaluate to               B\[TensorProduct]A\[TensorProduct]Inverse[A], {3, 4}]       More over, I want Mathematica to use the same identity in more complicated tensor products, like $ B \otimes A \otimes B \otimes A^{-1} $. The last example should evaluate to               TensorTranspose[B \otimes I \otimes B, {{4, 5}]      How can this be realized with Mathematica 9? ### Generalizations Ihe above, there was allays only one invertible matrix which was called $A$.   **Question 3**   Can you take identity relations are into account for any invertible matrix, irrespectively of the names or number of invertible matrices?


title: Problem with Integrate

text: Integrate[(c*al*be)/Beta[a, b]*x^ -          (be + 1)*Exp[t*x]*Exp[-al*a*c*x^-be]*(1 - Exp[-al*c*x^-be])^(b - 1),        {x, 0, ∞},        Assumptions -> {a > 0 ,  b > 0, c > 0, al > 0, be > 0, t > 0}]      When I evaluate the above expression in _Mathematica_ , I do not get a solution.   What's the problem? For `t = 0`, the above expression is a proper "pdf". With a simple transformation we can prove the value of the integral is 1. But Mathematica not get solution. For manual solution, I get the following: > $$\frac{c^* al^* be}{B(a,b)} \int_0^\infty x^{-be-1} e^{-al^* a^* c^* > x^{-be}} (1-e^{-al^* c^* x^{-be}})^{b-1}\,\mathrm{d}x$$ Write $z=e^{-al^* > c^* x^{-be}}$, whence $$\mathrm{d}z = e^{-al^* c^* x^{-be}} (al^* be^* c^* > x^{-be-1})\,\mathrm{d}x$$ and $$\frac{\mathrm{d}z}{z} = (al^* be^* c^* > x^{-be-1})\,\mathrm{d}x$$ By substitution, $$\frac{1}{B(a,b)} \int_0^1 > z^{a-1} \left(1-z\right)^{b-1} \,\mathrm{d}z = 1.$$


title: Interfacing with a LabJack

text: I have a LabJack U3-HV and I wanted to use it with _Mathematica_ to interface some hardware. I cannot find any information on the Internet; if I have to use Python, I will, but I would rather use _Mathematica_. Does anyone have any advice on this? Specifically, I can't figure out how to read "AIN0" (the LabJack's first analog input) using _Mathematica_.


title: Calculating difference ratios (Δβ/Δρ) from a data set

text: I am little bit confused about how to calculate `δβ/δρ` value if I have set of values like this. I have the values of β and ρ like this.               β          ρ          0,324     0,687     0,322     0,695     0,319     0,721     0,317     0,759     0,316     0,798      aka:               β={0.324, 0.322, 0.319, 0.317, 0.316};     ρ={0.687, 0.695, 0.721, 0.759, 0.798};      from the above set of values I would need to calculate `δβ/δρ`. Can anyone explain me how to do it with _Mathematica_?


title: How can I set the kernel for CreatePalette?

text: I have written some code that requests some calculations from an SQL server every N seconds and uses a palette:               CreatePalette[Dynamic[DateListPlot[...]]]      I create many copies of this notebook, each with different parameters, and launch as many independent kernels. But there is a problem. Frist, I launch the 1st palette on kernel1. Next, I start a 2nd palette on kernel2, (Evaluation->Notebook Kernel), but when I do that, the first palette thinks that its kernel is kernel2. How can I set the kernel for `CreatePalette` ?


title: Passing optional parameters to functions

text: Assume I want to write a function which has to have an argument structure like               myFunction[variable_,parameters_]      for compatibility reasons. Where parameters should contain a variable number of parameters (myFunction has just two parameters however). I have been using rules lists to functions to solve this:               variable=0     parameters={param1->1,param2->2}     myFunction[variable,parameters]      which I accessed inside the `Module` as `param1 /. parameters`, etc. Now I am reading that this kind of substitution is disfavored for efficiency reasons and that it is better to use `With` or `Block` to insert values. So what is the recommended way to pass to and substitute in functions with given argument number multiple parameters? As an extra: Is there a way to do it which is compatible with `Compile`?


title: LinearModelFit with millions of rows

text: I'd like to do a simple regression with millions of rows of (x,y) data. It seems to be too long for Mathematica. Is there a way to speed it up? It shouldn't be that hard to do, I am not sure what Mathematica is doing. For example here's how the timing grows with the size of the input:                   First@Timing[LinearModelFit[RandomReal[NormalDistribution[], {#, 2}], x, x];] &              /@ {10, 100, 1000, 10000, 100000}      generating on my machine:                   {0., 0.015600, 0.046800, 0.670804, 26.722971}      It doesn't seem like it should be taking so much longer for longer data, and yet it does.


title: How to generally match, unify and merge patterns?

text: This question was split from this one. While that question is now about how to match two _particular_ patterns (mostly using `Verbatim` or `HoldPattern`), this question is about **how to match _any_ pattern with another one**, in other words: "How can I test if a given pattern intersects with, or is a subset of another pattern?" (borrowed from Mr.Wizard). Consider the following examples where one can see that the left pattern should "match" the right one, but which all return `False`:               MatchQ[a|b, b|a]     MatchQ[{a..}, {a..}]     MatchQ[{a..}, {a...}]      Of course one trivial way to deal with `Alternatives` would be to simply `Sort` its arguments:               MatchQ[a | b | c, Verbatim[Sort[b | c | a]]]  --->  True      but things get complicated if the pattern involves more than `Alternatives`.      ## Problem specification:    Therefore I am looking for a predicate function that **compares any pattern with another pattern** and decides whether the first one matches the second one. For this, one needs a general way of matching two expressions that may contain any of these operators: `{|, .., ..., _, __, ___}` and possibly anything else that is specific for patterns. The predicate should have the following behaviour:               PatternMatchQ::usage="PatternMatchQ[e1, e2] returns True     if the set of expressions matched by pattern e1 is the same     or is a subset of the expressions matched by pattern e2, False otherwise."      i.e. the first pattern should cover the same (or smaller) domain as the second does. Now of course if any of the arguments is a non-pattern, `PatternMatchQ` can fall back to `MatchQ`.      ## Examples:      * `a|b` agrees with `b|a`   * `a|b` agrees with `c|b|a` (as `a|b` covers a domain that is covered by `a|b|c` as well)   * `a|b|c` does not agree with `b|a` (as `a|b|c` covers a domain that is larger than the domain covered by `b|a` **unless** `c == a` or `c == b`, in which case the pattern simplifies to `a|b`)   * `{a..}` agrees with `{a..}`   * `{a..}` agrees with `{a...}`   * `{a...}` does not agree with `{a..}`    ## Extension:    Now the concept of matching can be extended in the following way. So far we were only concerned about whether it is true that $domain(e_1) \subseteq domain(e_2)$, and if not, return `False`. But even if the test gives false, it is possible to define the smallest (most simple) domain that both patterns cover. Also, a full pattern-set-algebra emerges, if one thinks it further. Accordingly, for example `PatternUnion` could work on any number of arguments, and should return the most general unifier of all the argument patterns. The union of patterns would be equivalent to the merging of patterns. Now, of course, " _The thing that hath been, it is that which shall be; and that which is done is that which shall be done: and there is no new thing under the sun_ "... in certain fields (e.g. in logic or in linguistics and especially in construction grammar), this method is called unification: > Two expressions $e_1$ and $e_2$ are said to unify iff there exists a > substitution $s$ such that $s(e_1) = s(e_2)$ where a substitution is a **binding** of variables (i.e. implicit, hidden variables introduced by _Mathematica_ to deal with e.g. `_`, `__`) in patterns $e_1$ and $e_2$ with actual fitting values. Note that the substituted value of a pattern-variable can be any atom, even symbols, it does not matter. Thus what the code should look for is the equality of variables (i.e. implicit pattern variables). If such an $s$ exists, it is called a **unifier**. It is known that if two expressions $e_1$ and $e_2$ unify, then there always is only one most general unifier (up to a renaming of variables). Now this general unifier of two pattern expressions can be called (or used to describe) the intersection of $e_1$ and $e_2$.


title: Mathematica performance on Mac

text: I recently got a trial version of both Mathematica 9 and MATLAB 13a for Windows. I was stunned by the performance difference in the Windows and the Mac version. It was a simple test in matrix multiplication. Here's the code:               a = RandomReal[{0,1},{1000,2000}];     b = RandomReal[{0,1},{2000,3000}];     Timing[a.b;]      On Windows, **running on VMWare Fusion** , the above code takes 0.17 second to complete, more or less same as MATLAB. But on the Mac, it takes 1.8 seconds, or 10 times longer to complete the calculation. Something is terribly wrong here. What can be the explanation for this discrepancy? (I have 12GB free RAM on my 2012 Mac Mini so we can rule out memory shortage). **Edit:** here some benchmarking information. Windows is running in Bootcamp in the benchmark, not from VMWare Fusion:                                               Mac        Windows                                     -------    -------     Data Fitting                    0.666      0.468     Digits of Pi                    0.711      0.733     Discrete Fourier Transform      1.082      0.874     Eigenvalues of a Matrix         0.737      0.608     Elementary Function             1.072      0.780     Gamma Function                  0.532      0.655     Large Integer Multiplication    0.518      0.608     Matrix Arithmetic               1.         1.108     Matrix Multiplication           0.841      0.562     Matrix Transpose                0.889      0.842     Numerical Integration           1.083      0.764     Polynomial Expansion            0.118      0.094     Random Number Sort              1.459      1.061     Singular Value Decomposition    0.751      0.671     Solving a Linear System         0.767      0.655     ------------------------------------------------     Total Time                     12.226     10.483     Benchmark Result                1.132      1.320      Mathematica on Mac seems to be a good 20% slower than on Windows.


title: Print numbers in the terminal

text: I am trying to run a parallelized version of my Mathematica code on a cluster and i want to display some information on the terminal. When i try to display the time taken for the calculation, using AbsoluteTiming[], i get a number displayed on the terminal that does not represent the time taken for the calculation. I assume it has to do with the data format that i am trying to print and how bash interprets it, but i could not find a solution. Here is some of the code:               Print[ $ProcessorCount, $MachineType, $System]          output = AbsoluteTiming[Parallelize[Table[Table[MyExpression[..],{iterator1,...}],{iterator2,...}]]];          Print[N[output[[1]],3]]      Feel free to comment on my use of Parallelize[]. There is probably a more intelligent way to do this but i found that ParallelTable[] is slower in my case (evaluating the expression using two iterators).


title: Add Piecewise functions expanding domains

text: I want to reproduce these plots for further development in Mathematica: ![enter image description here](http://i.stack.imgur.com/Ad9VZ.jpg) To do so I defined the functions A and B as following `A[x_ /; 0 < x < 200] := Piecewise[{{65, 0 < x < 100}, {110, 100 < x < 200}}]` `B[x_ /; 0 < x < 200] := Piecewise[{{40, 0 < x < 100}, {90 , 100 < x < 200}}]` Now when I plot their sum the domain is fixed and the ranges are added together. In the graph above the domains of A and B are added. Then in a try in each step of the new domain the minimum of A or B or A+b is returned. How one can make this graph below from A and B? EDIT: The domain of the functions are not necessarily unique. Take this example: `A[x_ /; 0 < x < 200] := Piecewise[{{65, 0 < x < 100}, {110, 100 < x < 200}}]` `B[x_ /; 0 < x < 300] := Piecewise[{{40, 0 < x < 170}, {90 , 170< x < 300}}]`


title: Having SetOptions[] affect CDF styling

text: Instead of writing a package and importing it, at the beginning of many of my .nb files I have a string of SetOptions commands which govern things like plot styling. However, when I subsequently make a CDF based on elements using those options, the CDF doesn't incorporate them. Is there an easy way to fix that?               SetOptions[Plot,       AxesStyle -> Directive[25, Thickness[.005]],        PlotStyle -> {Thickness[.005]},       ImageSize -> 550     ];     Manipulate[       Plot[x^e, {x, 0, 1}, PlotRange -> {{0, 1}, {0, 1}}, AxesOrigin -> {0, 0}],       {e, 0, 5}     ]      Thanks!


title: Call Functions From File Without Modifying Context (Sandbox)

text: Let's say I have file named `test.m` containing               test[arg1_] := ( Print[arg1];)      What is the best technique for calling test like `test["value"]` while preventing test from being added to the `$ContextPath`? The following almost works except you must know function values ahead of time               Block[{$ContextPath,test}, Needs["test`"];test["test"]];      My question is: **How do I generalize the call above to work with any number of functions without the user needing to input definitions manually?**


title: Set default font for Output

text: Is it possible to set the font family to Arial for axes, legends and labels globally? I found out about               SetOptions[       Legending`GridLegend,        Legending`LegendContainer -> (Framed@ Append[#, FontFamily -> "Arial"] &)     ];      for legends, but now I am trying to set the axis labels.


title: Count the number of sqrt and 4th powers in a function

text: This is a simple and short question. I have a function which contains a certain number of square roots and 4th powers, lets take this one:               f=Sqrt[x] Sqrt[y] Sqrt[z + 2] b^4 + c^3 + d^4      I want to be able to count the number of occurrences of the square roots (3) and the number of occurences of the 4th power (2). I think it should be possible to use `Count` for this, but I can't figure out how. I have tried               Count[f,_Sqrt,Infinity]      and               Count[f, Power[4, _], {0, Infinity}]      but both don't seem to work. Can someone tell me how to achieve this?


title: Find dy/dx given an equation

text: Here's a homework problem from the Coursera course Calculus: Single Variable by Robert Ghrist > Find the derivative $\frac{dy}{dx}$ from the equation $x \tan y - y^2 \ln > x=4$ I wanted to check my work using Mathematica so I tried this:               Dt[x Tan[y] - y^2 Log[x] == 4];     % /. {Dt[y] -> dy, Dt[x] -> dx};     Reduce[{%, dy/dx == z}, z]      On my system (Mathematica 9, Windows 7), this computation seems to hang. Does anyone have a suggestion on how to solve this? **Edit:** I'm also interested in why `Reduce` doesn't handle the problem well when used as above whereas `Solve` handles it just fine (see answers).


title: How to trash files / directories?

text: Both `DeleteFile` and `DeleteDirectory` can only delete files / directories, and lack the option to move them to the trash. Is there an elegant (and OS- independent) way to trash items?


title: What is the difference between NotebookEvaluate and FrontEndToken

text: I am wondering what exactly are the differences in using `NotebookEvaluate[filename]` **vs** `FrontEndExecute[FrontEndToken[nb, "EvaluateInitialization"]]`; to evaluate cells in a given notebook. In particular, I am referring to the discussion: Evaluate Initialization Cells of another notebook. Given my new status here, I couldn't see how I could continue with that conversation directly, so I decided to post a new queston. The comments in the referenced question proposed these two solutions to the problem:   * method 1.              filename = SystemDialogInput["FileOpen"];     NotebookEvaluate[filename, EvaluationElements -> "InitializationCell"]        * method 2.              filename = SystemDialogInput["FileOpen"];     nb = NotebookOpen[filename];     FrontEndExecute[FrontEndToken[nb, "EvaluateInitialization"]];     NotebookClose[nb]      I am trying to solve the same problem. Taken at face value, it seems both approaches are valid. Are there any subtleties that make one preferred to the other, issues of scope/context, etc.?


title: Drawing Zonotopes from Adjacency Matrix

text: This is crossposted in cs.stackexchange.com, but I have been trying to use Mathematica do this and figured it might be more appropriate to ask here. Define a " **simple zonotope** " to be a regular $2n$-gon which is tiled by the following rule: all tiles are rhombi. They key point here is that rhombuses have equal side lengths (say equal to 1), but their shapes are allowed to vary arbitrarly. Here's an example of a 12-gon zonotope: ![Zonotope](http://i.stack.imgur.com/YATPS.png) There are many characterizations and properties of these objects. For example, one can encode a zonotope using $2n$ vectors (one for each outer edge) since we can just translate copies of each vector. **What I would like to do is the following:** I have the adjacency matrix of a graph that I believe to be a simple zonotope. Specifically, you can assume that we are starting with a _planer geometric graph_ , in that I have an adjacency matrix, in addition to having (x,y) coordinates of each point. In other words, it's fairly straightforward to identify which vertices go to the outer vertices of the $2n$-polygon.Here's an example of a geometric graph that I could have: ![enter image description here](http://i.stack.imgur.com/TFPlL.png) In the above picture, the two red vertices indicate the north/south poles of the zonotope they are mapped to (which happens to be the zonotope in the first picture). > Question: What is the most painless way of drawing the simple zonotope from > a given adjacency matrix plus geometric graph coordinates? Some observations: part of the algorithm is somewhat clear to me: one should work from the outside in. Once a specific rhombus side has been identified, all sides below it must be the same until we run into the opposite side of the zonotope. However this all seems very computationally expensive. I am honestly not preferential to any specific solution. I would even accept something akin to attaching springs to vertices and then running the algorithm until the graph converges to a zonotope. What I have tried in Mathematica 8.0: I've been trying to use               GraphPlot[A, VertexCoordinateRules -> VertexCycleCoordTag, VertexLabeling -> True,         Method -> {"SpringElectricalEmbedding", "RepulsiveForcePower" -> -2}]      Here 'A' is the adjacency matrix (in this case a 22x22 matrix). 'VertexCycleCoordTag' fixes what I know to be the outer vertices of this particular adjacency matrix. Here is the output: ![enter image description here](http://i.stack.imgur.com/OHBaI.jpg) Not too shabby! The repulsive force helped organize things here a bit. However, I would _ideally_ like to fix the edge lengths to all be equal and to start seeing rhombi. I've had trouble doing this, even after consulting a post talking about EdgeWeight. It doesn't seem like GraphPlot has the EdgeWeight option (is this amended in Mathematica 9.0?). Here's the full code, where 'VertexCycle' denotes the vertices which run around the edge of the 2-n gon in counterclockwise order:               A={{0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      1}, {0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      1}, {0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      1}, {1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      0}, {1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      0}, {0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0,      0}, {0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0,      0}, {0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0,      0}, {0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0,      0}, {0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0,      0}, {0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0,      0}, {0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0,      0}, {0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,      0}, {0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0,      0}, {0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,      0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 0, 1, 1, 0, 0,      0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0, 0, 0, 1, 1, 0,      0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 1,      0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1,      0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1,      0}, {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0,      0}, {1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,      0}};          VertexCycle={21, 18, 15, 9, 4, 1, 22, 3, 8, 14, 17, 20};          n = Length[VertexCycle]/2;     VertexAngles[{x_, y_}] := {x*Cos[Pi/n] - y*Sin[Pi/n],      x*Sin[Pi/n] + y*Cos[Pi/n]}          VertexCycleCoordTag = {};     For[i = 1, i < 2*n + 1, i++,          VertexCycleCoordTag =          Append[VertexCycleCoordTag,          VertexCycle[[i]] -> VertexCycleCoord[[i]]]];          GraphPlot[A, VertexCoordinateRules -> VertexCycleCoordTag,          VertexLabeling -> True,          Method -> {"SpringElectricalEmbedding", "RepulsiveForcePower" -> -2}]


title: Matching a list of sequences with common form

text: I am trying to find a pattern that matches a list of sequences that share a common form. The sequence form is: 1 followed by zero or more nonzero integers, followed by 0. An example list is:               {1,3,2,0,1,0,1,2,0,1,1,4,0}      The closest thing I've struck on so far is this:               MatchQ[{1, 2, 0, 1, 2, 0}, {PatternSequence[1, s___ /; FreeQ[{s}, 0], 0] ..}]      which yields `True` in this case because the sequences are both the same. Is there a way to get the `s___` to apply uniquely to each instance in the `Repeated`? This would solve the problem. Other suggestions are most welcome.


title: Cleaning up a List of HTML Data to Render Usable Information

text:
I am using Mathematica to scrape information from webpages. To get file information, I am gathering plain text that is enclosed by `<tr>` and `</tr>` tags. I have made a list, of which each element is the entire data. I want to somehow scrape the plaintext readable element out of this. By way of example, here are two elements from my list:                  "
              1.	              1841-1869 (Province of \         Canada), number 195, 21 June 1845, page 15	         GIF | PDF
", "
              2.	              1841-1869 (Province of \         Canada), number 402, Extra, 16 May 1849, page 4	         GIF | PDF
"      I've been playing around with `Shorten[]` and `StringCases[]` to try to find a way, but would there be a way to quickly map a function on this list that would result in the following:               "1841-1869 (Province of Canada), number 195, 21 June 1845, page 15",     "1841-1869 (Province of Canada), number 402, Extra, 16 May 1849, page 4."      The actual text changes, i.e. it doesn't always say 1841-1869 etc., but the general format of the `<tr>` portion remains consistent. I don't mind if the GIF | PDF part remains either. Would there be a quick way to just render the actually visible part of the HTML file in this list? * * * If somebody wants to reproduce the list I am using, here is my code (I include this only to make things simpler, but this is probably more of a theoretical question):               baseurl =        "http://www.collectionscanada.gc.ca/databases/canada-gazette/001060-\     110.01-e.php?q1=youth&q3=&interval=199&sk=";     pagelist =        Import[baseurl <> ToString[#], "Source"] & /@ Range[1, 1889, 199];     pagetext = Apply[StringJoin, pagelist];     trlist = StringCases[pagetext, Shortest["
" ~~ ___ ~~ "
"]];


title: Can the position of Tooltips be changed?

text: Is it possible to change the position of tool tips, which currently always appear to the lower right of the mouse position. In the screen grab below the mouse is over 10000000 and the tooltip appears to the bottom right (8.0.4 on Mac). ![enter image description here](http://i.stack.imgur.com/8B9Y8.png) By way of an example how would you go about making the tooltip appear to the bottom left (courtesy of photo editing): ![enter image description here](http://i.stack.imgur.com/U9ijy.png) (This was originally asked on StackOverflow, but it did not draw any answers.)


title: NullSpace[_, Method->"OneStepRowReduction"] is sometimes wrong; how can I work out when this happens?

text: (This is on MMA 7.0.1.0 on OS X) I've just found a large matrix `m` for which `NullSpace[m]` and `NullSpace[m, Method->"OneStepRowReduction"]` give different answers (the first one is the correct answer). I put the matrix up at pastebin as won't fit here! What's going on? How might I guess ahead of time which arguments are going to break `Method->"OneStepRowReduction"`? (Update; it seems the bug has got _worse_ in 8, rather than better.)


title: Generate a new output using Manipulate

text: Thanks to methods found in the below, I was able to assemble those elements : Tile image on specific location without space between them How to combine images with the same dimensions in a grid? ![enter image description here](http://i.stack.imgur.com/SepuA.jpg) Now, I would like to use Manipulate [] to have a button that, when pressed generate a new composition, "re-run" the code.


title: Why don't I get the graphics output I'm expecting?

text: **Today,I want to use a point generate a circle,the main picture as below:** ![enter image description here](http://i.stack.imgur.com/qlnEv.jpg) Given that I know the equation of circle, and the value of $L_1$,$L_2$.The coordinate of point $A$ is $(p_x,p_y)$. I use the equations: $$p_x=L_1 cos(\theta_1)+L_2cos(\theta_1+\theta_2) \\\ p_y=L_1 sin(\theta_1)+L_2sin(\theta_1+\theta_2)$$ to solve the results of $\theta_1,\theta_2$ as below:$$cos(\theta_2)=\frac{-L_1^2-L_2^2+p_x^2+p_y^2}{2 L_1 L_2} \\\sin(\theta_2)=\pm \sqrt{1-cos^2(\theta_2)}$$ $$sin(\theta_1) =-\frac{sin(\theta_2) L_2 p_x-L_1 p_y - cos(\theta_2) L_2 p_y}{p_x^2+p_y^2}\\\ cos(\theta_1) =-\frac{-L_1 p_y - cos(\theta_2) L_2 p_x - sin(\theta_2) L_2 p_y}{p_x^2+p_y^2} $$ My trial as below:               Manipulate[       Module[{L1, L2, θ1, θ2, A, B, C1, D1, px, py},         L1 = 35; L2 = 20;       A = (-L1^2 - L2^2 + px^2 + py^2)/(2 L1 L2);       B = Sqrt[1 - A^2 ];       C1 = -((-L1 px - A L2 px -        B L2 py)/(px^2 + py^2));       D1 = -((B L2 px - L1 py - A L2 py)/(       px^2 + py^2));       px = 50 + 15 Cos[20 ° t];       py = 50 + 15 Sin[20 ° t];       θ2 = ArcTan[B, A] // Simplify;       θ1 = ArcTan[D1, C1] // Simplify;      Graphics[              {Line[{0, 0}, {L1 Cos[θ1],          L1 Sin[θ1]}, {L1 Cos[θ1] +          L2 Cos[θ1 + θ2],          L1 Sin[θ1] + L2 Sin[θ1 + θ2]}], Red,         Point[{L1 Cos[θ1] + L2 Cos[θ1 + θ2],          L1 Sin[θ1] + L2 Sin[θ1 + θ2]}]},        Axes -> True]     ], {t, 0, 18}     ]      ### Edit Thanks for Mr.Wizard's help.               Manipulate[       Module[{L1, L2, θ1, θ2, c2, s2, c1, s1, px, py},     L1 = 35; L2 = 20;     c2 = (-L1^2 - L2^2 + px^2 + py^2)/(2 L1 L2);     s2 = Sqrt[1 - (c2^2) ];     c1 = -((-L1 px - c2 L2 px - s2 L2 py)/(px^2 + py^2));     s1 = -((s2 L2 px - L1 py - c2 L2 py)/(px^2 + py^2));     px = 50 + 15 Cos[20 ° t];     py = 50 + 15 Sin[20 ° t];     θ2 = ArcTan[c2, s2] // Simplify;     θ1 = ArcTan[c1, s1] // Simplify;     Graphics[     {Circle[{50, 50}, 15],       Line[{{0, 0}, {L1 Cos[θ1],          L1 Sin[θ1]}, {L1 Cos[θ1] +           L2 Cos[θ1 + θ2],          L1 Sin[θ1] + L2 Sin[θ1 + θ2]}}],       Blue, PointSize[Large],       Point[{L1 Cos[θ1], L1 Sin[θ1]}],       Red, PointSize[Large],        Point[{L1 Cos[θ1] + L2 Cos[θ1 +θ2],         L1 Sin[θ1] + L2 Sin[θ1 + θ2]}]},       Axes -> True, PlotRange -> {{-20, 80}, {-20, 80}},       AspectRatio -> Automatic] /. z_Complex :> Re[z]],      {t, 0, 18}]      It generates: ![enter image description here](http://i.stack.imgur.com/xINw7.jpg) **By manipulating the value of`t`,I found the length of shaft `L1` and shaft `L2` vary. This is contradictory because the length of `L1` and `L2` are constants. I don't know why.**


title: Using a function name instead of its definition in AxesLabel

text: I seek to use a token as an axis label, but this token, having other meanings, is expanded by Mathematica. If I enclose the token in quotes, it is not expanded, but it is also no longer italicized. Using `LabelStyle->{Italics}` results in italicization of all fonts in the figure (axis labels and axis tick labels). How do I circumvent token expansion (or equivalently, in effect, italicize only the axis labels and not the axis tick labels)? Two examples: (1) I may wish to plot a function `f` (say `f=x^2`) and want the axis label to be simply `f` (in italics), but it is expanded to `x^2` by the command `Plot[f, {x, -2, 2}, AxesLabel -> {x, f}]`. Changing to `Plot[f, {x, -2, 2}, AxesLabel -> {x, "f"}]` results in italic `x` and roman `f`. (2) I may wish to label an axis with `E`, but it is changed by Mathematica to `e` (the irrational constant). Again, I can use `"E"`, but this has the undesired effect of altering the font face.


title: Efficient ways to create matrices and solve matrix equations

text: I am attempting, for the first time, to use Mathematica to do some serious linear algebra. I would like to solve systems of equations of the form $$U_{n n'} f_{n'} = b_n.$$ I have an expression for $U_{n n'}$ that is of the general form $U_{n n'} = f_1(n) \delta_{n n'} + f_2(n,n')$. Is using 2 nested Table commands the easiest/most efficient way to build this matrix in Mathematica? I am not entirely sure how large I will need to make the matrix (it results from discretizing an integral equation, so the number of rows/columns will be as many as I need to get an accurate solution). I guess that it could be as large as 10,000 x 10,000, maybe. Is LinearSolve efficient enough to handle these sized systems on a standard desktop PC? Is parallelization for this automatic or do I need to do something manually? After I have found the solution, I am going to need to feed the solution to another equation to find the quantity that I am actually interested in. Is there anything I should do at the outset to make my life easier later? I apologize for the general nature of my question, but this is all new ground for me, so I am not sure what general guidelines and practices are best.


title: Mapping higher dimensions to color, opacity, point size, etc

text: I have a set of points of dimension >3, and I'd like to modify ListPointPlot3D so that the higher dimensions are mapped to different variables, such as color, opacity, point size, etc. so for example               a = Table[RandomVariate[NormalDistribution[3], 4], {5000}];     ListPointPlot3D[a] +some options...


title: Tutorial for basic numerical methods for PDEs

text: I'm afraid this is probably not going to be a "good" question, but I'd like to use _Mathematica_ to learn about basic numerical schemes for solving pdes. For example, I'd like to compute the solution of a 2D heat equation initial value problem using finite differences and Euler timestepping, and then look at how big errors are or stability (not interested in using `NDSolve` directly). My question is, are there any resources that already do this the "right" way? I'm just getting acquainted with _Mathematica_ and don't know the language well, but I do know I want to use packed arrays and avoid loops. There's lots of language-agnostic references for the numerical methods themselves, but I can't find good clean examples of _Mathematica_ implementations of these methods. Edit: One of the books recommended in the answers suggest doing stuff like (1d heat equation IVP):               Clear["Global`*"];     gridX = 10; (* num interior points *)     dx = 1./gridX;     dt = .005; (*cfl: dt/dx^2 <= .5 *)          T[i_, j_] := T[i, j] = T[i, j - 1] +                        (dt/dx^2) (T[i + 1, j - 1] - 2 T[i, j - 1] + T[i - 1, j - 1]);          T[i_, 0] := 1. (* initial value *)          T[0,         j_] := 0.; (* boundaries *)     T[gridX + 1, j_] := 0.;           TFinal[t_] := Table[T[i, IntegerPart[t/ dt]], {i, 1, gridX}];     ListLinePlot[TFinal[1]]      But I suspect that it's not the best way, because as soon as I crank up the grid size and shrink down the time step, I get a recursion limit error. The code above is storing the solution at all time steps, which I definitely don't want. I'm sure there are clean, non-recursive sample implementations of this method out there, just can't seem to find.


title: Find the domain in which a sequence converges

text: I seem to have a lot of problems in the format of: > Given the sequence $a_n=\frac{n^\alpha+1}{2n^8+5}$, for $\alpha > 0$, find > the values of $\alpha$ such that the sequence converges. However, I can never seem to get _Mathematica_ to solve for a variable in a limit. I have tried               Solve[Limit[(1 + n^a)/(5 + 2 n^8), n -> Infinity, Assumptions :> a > 0] == 0, a]          Reduce[Limit[(1 + n^a)/(5 + 2 n^8), n -> Infinity, Assumptions :> a > 0] == 0, a]      `Solve` gave me no solutions, with a warning about inverse function. `Reduce` gave me the solution is `C[1] ∈ Integers && α == 0`, which also violates the initial assumption ($\alpha > 0$). However, I tried particular cases manually, such as               Limit[(1 + n^3)/(5 + 2 n^8), n -> Infinity, Assumptions :> a > 0] == 0        which gave `True`. Am I going about this in the wrong way?


title: Find roots of a function involving Bessel functions

text: I'm trying to find the roots of a function involving Bessel functions. Here is my code               Clear[f, eta, chi, omega, alpha, beta, h, M, T, v, rho, phi, a, n, k, Zeros, z];     eta = Sqrt[beta^2 (Sqrt[4 alpha^2 omega^2/beta^4 + 1] - 1)/(2 alpha^2)];     chi = Sqrt[beta^2 (Sqrt[4 alpha^2 omega^2/beta^4 + 1] + 1)/(2 alpha^2)];     beta = Sqrt[alpha^2*(14.682 phi)/a^2];     alpha = a^2*omega/k;     a = .5;     f[n_, k_, phi_] = eta*(BesselJ[n - 1, eta*a] - BesselJ[n + 1, eta*a]) -         chi*((BesselI[n - 1, chi*a] + BesselI[n + 1, chi*a])*(BesselJ[n,eta*a]))/BesselI[n, chi*a];      Plotting the functions for different values of $n$ and $\phi$               Manipulate[Plot[f[n, k, phi], {k, 1, 300}, PlotRange -> {-10^1.5, 10^1.5}],           {n,0, 5, 1}, {phi, .25, 3, .25}]      ![enter image description here](http://i.stack.imgur.com/3ny7R.png) Now, based on this post FindRoot giving false roots with Bessel Functions , I tried to obtain a list of the roots just by renaming my function and manually introduce the values of $n$ and $\phi$ as follows               n = 0;     phi = .25;     k = z;     Zeros[z_] = f[n, k, phi];     (zeros = First@     Last@Reap@       Quiet@NDSolve[{y'[x] == Zeros'[x], y[0] == Zeros[0],           WhenEvent[y[x] == 0, Sow[FindRoot[Zeros[z], {z, x}]]]},          y, {x, 0, 40}, AccuracyGoal -> 1,          PrecisionGoal -> 1]) // AbsoluteTiming      But it is not working!!! Mathematica gives the following error               First::first: {} has a length of zero and no first element. >>     {0.044039, First[{}]}      Any support that you can give me is highly appreciated.


title: Finding all paths of certain length between vertices in path graph, non-simple ones too

text: First I will tell you what my ultimate goal is, because maybe there's another way of doing it other than what I am trying. I need a list of all $(a_1, a_2, \ldots, a_N)$ tuples that satisfy certain conditions.   * $a_i$ can take integer values between $1$ and $s$, that is, from the set $\\{1, \ldots, s\\}$.   * Neighbouring entries differ by $1$, that is, $|a_i - a_{i+1}| = 1$   * A "periodic boundary condition" holds. That means that $a_N$ and $a_1$ also differ by $1$ (we effectively have a ring).   * $N$ can be assumed to be even, because otherwise it's not possible to satisfy the previous two conditions at the same time. For $N=6, s=5$, I've put $a_1$ at the back of the list in parentheses for clarity. $2,3,4,5,4,3(,2)$ works.   $2,3,4,5,4,5(,2)$ doesn't, because $5$ and $2$ don't differ by one.   $2,4,3,4,3,3(,2)$ obviously doesn't work, because some pairs of neighbouring entries don't differ by $1$.   OK, I've been thinking that I could take `PathGraph[Range[1,s]]`, which is a builtin Graph with 1 being adjacent to 2, 2 being adjacent to 3 (and 1), 3 being adjacent to 4 (and 2), ..., s-1 being adjacent to s (and s-2). Now I can easily get _the number_ of tuples with the above properties by calculating the Nth `MatrixPower` of the `AdjacencyMatrix` and taking the Trace of that matrix, because the entries on the diagonal are Paths of length N, starting at 1, ending at 1, (plus the ones starting at 2 ending at 2, plus ...) possibly going back and forth between vertices. However, I need to have the tuples to work with them, so I wanted to get a list of paths of length N between two vertices of that simple path graph. But I can't seem to get that with the builtin functions. `FindPath[PathGraph[Range[1, 7]], 1, 3, {2}]` will give the path `1 -> 2 ->3` which has length 2. However, `FindPath[PathGraph[Range[1, 7]], 1, 3, {4}]` will give an empty set. It won't give me the path `1 -> 2 -> 3 -> 4 -> 3`, which visits nodes twice and goes back and forth along the same edge. Is there some way to get all of these? (the mentioned one and, say `1 -> 2 -> 3 -> 2 -> 3`). Of course I've read numerous posts on paths on these forums and a couple of entries about functions concerning graphs in the Mathematica documentation, but I couldn't seem to find what I need. I'd expect `FindPath[PathGraph[Range[1, 7]], 2, 2, {2}]` (same starting and ending point) to give me `2 -> 3 -> 2` and `2 -> 1 -> 2`. Which would get me the tuples $2,3(,2)$ and $2,1(,2)$, speaking the language from the beginning of the post.


title: k-means clustering using squared correlation in Mathematica

text: I am trying to cluster data using the squared correlation coefficient since in the case of my data, -1 correlation is equivalent to 1 correlation (polarities do not matter). How can this be done in Mathematica using the k-means algorithm?


title: Join decimal part

text: I have a list of mesures that each vector is like `{0,1,-2,259}` but it should be like `{0.1,-2.259}` So I did a rule, like `list/. {a_,b_,c_,d_}->{a.b,c.d}` but for the positives number it works fine! but for vector like this one I get `{0.1,(-2).239}` how can I fix this?


title: How to generate a blank crossword sheet?

text: I attempted to generate a blank crossword sheet. My method is by combining the rows and columns as shown on the graph below. However, some of the `across` and `down` numbers then appeared out of place after combining. What is the better way to obtain a blank crossword sheet? ![enter image description here](http://i.stack.imgur.com/WVSaf.gif)               fillRow[i_] := (        startPos = RandomInteger[{1, randomStartPos}] ;        randomWordLen = RandomInteger[{minWordLen, dimX - startPos}];        endPos = startPos + randomWordLen - 1;        Do[cwSheet[[i, n]] = 0, {n, startPos, endPos}];        AppendTo[ hintNumPad, { counter++, {startPos, dimX - i}}]         If[endPos <= dimX/2,          randomWordLen = RandomInteger[{minWordLen, dimX - endPos - 1}];          Do[cwSheet[[i, n]] = 0, {n, dimX, dimX - randomWordLen + 1, -1}];          AppendTo[            hintNumPad, { counter++, {dimX - randomWordLen + 1, dimX - i}}];          ]        );               fillCol[j_] := (        startPos = RandomInteger[{1, randomStartPos}] ;        randomWordLen = RandomInteger[{minWordLen, dimY - startPos}];        endPos = startPos + randomWordLen - 1;        Do[cwSheet[[   n , j]] = 0, {n, startPos, endPos}];        AppendTo[ hintNumPad, { counter++, { j, dimY - startPos  }}]          If[endPos <= dimX/2,          randomWordLen = RandomInteger[{minWordLen, dimX - endPos - 1}];          Do[cwSheet[[n, j]] = 0, {n, dimY, dimY - randomWordLen + 1, -1}];          AppendTo[ hintNumPad, { counter++, {j, randomWordLen - 1  }}];          ]         );          minWordLen = 3;     hintNumPad = {};     {dimX, dimY} = {9, 9};     randomStartPos = 4;     Clear[cwSheet];          cwSheet = ConstantArray[1, {dimX, dimY}];           counter = 1;      Do[fillRow[k], {k, 1, dimY, 2}];            counter = 1;      Do[fillCol[k], {k, 1, dimX, 2}];                g = MatrixPlot[cwSheet , Mesh -> All,       Frame -> False,       ColorFunction -> "Monochrome",        Epilog -> {Text[Style[#[[1]], 9], #[[2]] + {-0.9, 0.8}] & /@           hintNumPad}]      The correct positions of the hint numbers should look like this: ![enter image description here](http://i.stack.imgur.com/TBgkg.gif)


title: Why is Mathematica not able to calculate more digits

text: When I want a numerical value with a precision of 50 digits...               N[1.15/(1 - E^-0.2)^2, 50]      Why is Mathematica not able to provide the desired solution? ![enter image description here](http://i.stack.imgur.com/TnBIo.jpg) And I know that this is irrational and the given solution is not precise and besides Mathematica would provide more digits even if the solution is already precise in other cases. ![enter image description here](http://i.stack.imgur.com/PIGUS.jpg) So what is the problem here and how can I get more digits?


title: Why is evaluation Enter for Mac and shift+Enter for Windows?

text: Per the title, why is evaluation done using just the Enter key for Macintosh and shift+Enter for Windows? UPDATE Okay, I see the Mac keyboard's "Enter" key is actually labeled "Return", so by Enter we mean the numeric keypad Enter.


title: BVP - shooting method

text: I really don't know how to realize this method. The examples in internet and the reference aren't helpful for me. 1) I have the values for today:                x[0] == 0, y[0] == 0.84, r1[0] == 0.39, r2[0] == 0.39, z[0] == 0      Now I need the initial conditions at t=-20 that reproduces the values today.               alpha = 0.5     beta = 1          sol = First@NDSolve[{           x'[t] == -x[t]*a[t] - 3*x[t] + alpha*y[t]^2 +         1/2*beta*(r1[t]^2 - r2[t]^2),      y'[t] == -y[t]*a[t] - alpha*x[t]*y[t],       r1'[t] == -r1[t]*a[t] - 3/2*r1[t] + beta*x[t]*r1[t],       r2'[t] == -r2[t]*a[t] - 3/2*r2[t] - beta*x[t]*r2[t],      z'[t] == -z[t]*a[t] - 2*z[t],      x[0] == 0, y[0] == 0.84, r1[0] == 0.39, r2[0] == 0.39, z[0] == 0},      {x, y, r1, r2, z},     {t, 0, -20}];     a[t_] = -1/2*(3 - 3*y[t]^2 + 3*x[t]^2 + z[t]^2)      Most of the examples are integrated in a plot. First I don't want that. 2)Is it maybe also possible to say that I have the conditions at the present as follows:                 x[t]^2 + y[t]^2==0.5       r1[t]^2 + r2[t]^2==0.5      PS: This topic can be deleted: boundary problem


title: How to debug Mathematica crash?

text: If i have some program which crash Mathematica every time it's run. What are the steps to make a more informative report and/or how do i go about debugging it? EDIT: I guess essentially my question is how even professionals such as Wolfram support will go about doing the initial diagnosis.


title: k-means clustering in parallel

text: How can the k-means algorithm for some given distance function be implemented using ParallelMap or other parallel processing program constructs in Mathematica?


title: ImageDifference. Is there an ImageSame, or how would one do that?

text: Is there an inverse to ImageDifference? What in two images are the same?