Datasets:
id stringlengths 1 5 | title stringlengths 15 150 | text stringlengths 43 28.9k |
|---|---|---|
10001 | How to improve the performance of solutions to Project Euler (#39)? | This is the problem 39 of Project Euler, which I asked in the chat room two days ago. My original code runs as slowly as snails, and finally I got two answers from JM and Rojo. Unfortunately, both of them are faster than mine but still not enough. Here is the problem: > If p is the perimeter of a right angle triangle w... |
10002 | How to compare the InputField values in For loop dynamically | I am using a `For` loop for printing five `InputFields`. The loop gets its values from the variable tx. I want to compare the values dynamically with 10 and print the result. But, the comparison is going out of loop, why? tx = {4, 1, 6, 7, 8}; Reap[For[i = 1, i <= 5, i++, Sow[ {InputField[tx[[... |
10003 | How to see the 'source code' of DockedCells? ALT: How to 'show expression' of DockedCell? | Here is a CDF file with the dockedcells toolbar (at the top). I'm trying to see how he created and positioned the logo, the formatting buttons, table of contents, etc, through a source code of it, but I can't select it like a cell and say 'show expression'. Primary Questions: How to see the 'source code' of DockedCells... |
10008 | Plotting function lists | > **Possible Duplicate:** > Difference in Plot when using Evaluate vs when not using Evaluate > Why do I have to put Evaluate[] here > Why is ContourPlot not displaying this curve? Why is nothing (empty plot, without error) plotted, when using the following code? tab = Table[x^2 + y^2 == R, {R, ... |
10013 | Draw tangent to point in ListLinePLot | I am using `ListLinePlot` to draw a number of points to a graph: ListLinePlot[{{5 10^-3, 0}, {4.65 10^-3, 100}, {4.32 10^-3, 200}, {3.74 10^-3, 400}, {3.23 10^-3, 600}, {2.6 10^-3, 900}, {2.09 10^-3, 1200}, {1.68 10^-3, 1500}}] How can I also draw the tangent to the line in a point? |
10017 | Calculate with units | If I want to calculate with units, for example using Pythagoras theorem, I would do this: c = Sqrt[(3m)^2 + (5m)^2] The result will be `5 Sqrt[m^2]`. How can I define that `m = Sqrt[m^2]` and so forth? |
10024 | Particular solutions of a Differential Equation not evaluated in a given case | Below first case which gives particular solutions of an OED correctly: ClearAll[soln]; (* case 1 *) soln[a_?NumericQ] := soln[a] = DSolve[{y''[t] + y[t] == Sin[t], y[0] == a, y'[0] == 0}, y[t], t]; res1 = Grid[ Partition[ Table [soln[i][[1... |
1003 | Is there an equivalent of FullGraphics for Graphics3D? | For 2D graphics, there exists the function `FullGraphics` to turn the stuff Mathematica generates automatically on `Graphics` (like axes) into explicit graphics primitives. However that function doesn't work on `Graphics3D` objects. So is there some (possibly undocumented) function which does the same for 3 dimensional... |
10030 | Extraneous Keyboard Shortcut for ctrl + '^' in Mathematica 8 | I would like to use the keyboard shortcut `Ctrl``^` to enter a superscript. I have tried to type this two different ways, and each time i have gotten an undesirable result. According to the file `KeyEventTranslations.tr`, the binding is correct: Item[KeyEvent["^", Modifiers -> {Control}], "Superscript"] ... |
10032 | Windows IME Chinese blocking shortcut for ctrl + space | I currently use the Windows IME on Windows Vista to allow myself to type Chinese characters (not in _Mathematica_ ), and by default typing `Ctrl``Space` switches between the English keyboard and the Chinese keyboard. When in Mathematica, I would like to use the default shortcut `Ctrl``Space` to move out of subscripts a... |
10035 | Can I create a dynamic number of rows in TabView through an iteration? | I have written code, with the help of stackoverflow of course, and I want to make it user friendly so that other people in my lab can use it. I'm playing with DialogCreate and similar functions. I want to do something like this so far: CreateDialog[TabView[{ "General" -> Column[{ ... |
10036 | Help with Permutations | I am currently trying to generate a list of permutations of length 2 of elements of a list of strings. For example: Permutations[{"s1", "s2", "s3", "s4"}, {2}] {{"s1", "s2"}, {"s1", "s3"}, {"s1", "s4"}, {"s2", "s1"}, {"s2", "s3"}, {"s2", "s4"}, {"s3", "s1"}, {"s3", "s2"}, {"s3", "s4"}, {"s4", "s1"}, {... |
1004 | Can we use letter with a subscript as a variable in Mathematica? | I tried In[1]:= Subscript[a, 0] = 1 Out[1]= 1 In[2]:= Clear[Subscript[a, 0]] During evaluation of In[452]:= Clear::ssym: Subscript[a, 0] is not a symbol or a string. >> In[3]:= Clear[a] In[4]:= Subscript[a, 0] Out[4]= 1 Any idea? |
10041 | Automating FTP upload within Mathematica? | I have MMA-generated html and would like to automate uploading to a named directory to a web host via SFTP or HTTP POST, ideally without creating local temp files. The closest question I could find on MMA.SE is this question which doesn't really address this issue. Based on this "minimal http upload gci" in Python, and... |
10042 | How to add a grid on Plot, ListLinePlot and ListPlot? | > **Possible Duplicate:** > How to insert guide-lines in graphics without specifying range? When we're using `ArrayPlot`, it's possible to draw a grid by doing: ArrayPlot[{{1, 0, 0, 0.3}, {1, 1, 0, 0.3}, {1, 0, 1, 0.7}}, Mesh -> True] But I can't find a way of doing it on `Plot`, `ListPlot` and `L... |
10044 | How to find out available fonts from within Mathematica? | How to find out available fonts on the system from within Mathematica? When I do Style["foobar", FontFamily -> "Foobar"] how do I know which font the displayed output is using/falling back to use? |
10045 | Probability and distribution from actual data | Let's say I have some data from a real world system: data = {0.026666156, 1.27421*^-6, 0.027878597, 0.017035598, 0.011036215, 0.038684388, 0.025161479, 0.021353902, 0.027487123, 0.021190747, 0.029328752, 0.014554109, 0.040037348, 0.020063044, 0.018363514, 0.0116034, 0.02609979, 0.0... |
10049 | Series expansion with irrational power | I need the series expansion of a fairly nasty function and its derivative: f = (x - a) (1 + b (1/(x - a))^((5 + Sqrt[73])/12) * Hypergeometric2F1[(-7 + Sqrt[73])/12, (1 + Sqrt[73])/12, ( 6 + Sqrt[73])/6, -(a/4)/(x - a)]) + a/2 $f\left(x\right) = (x-a) \left(1+b \left(\frac{1}{x-a}\right... |
10055 | How to avoid this kind of numerical error caused by extreme parameters when using NDSolve? | Here I use a one-dimensional heat conduction equation as the example. I found that when the thermal diffusion coefficient is small enough, Mathematica will give a result against the second law of thermodynamics: fun[k_] := (a = NDSolve[{D[tes[t, x], t] == k D[tes[t, x], x, x], tes[t, ... |
10057 | Table in a Legend | Calculated data: data= {{3.54216*10^6, 5.43391*10^6}, {3.5422*10^6, 5.43392*10^6}, {3.54224*10^6, 5.43393*10^6}, {3.54215*10^6, 5.43395*10^6}, {3.54219*10^6, 5.43396*10^6}, {3.54223*10^6, 5.43397*10^6}, {3.54214*10^6, 5.43399*10^6}, {3.54218*10^6, 5.434*10^6}, {... |
1006 | Problem with EllipticE documentation | The complete elliptic integral of the second kind, `EllipticE`, is defined as, Integrate[Sqrt[1-m Sin[t]^2],{t,0,z}] According to the version 8 docs, the first of the "Possible Issues" is supposed to evaluate `Integrate[Sqrt[1-m Sin[t]^2],{t,0,z}]` as If[(m Sin[z]^2 \[NotElement] Reals ... |
10062 | How can I make CDF which uses user defined function | I have a user defined function which is called many times in the code. I want to ask that when I am deploying the code to`CDF`, I need to define that user defined function also. I tried it using `DynamicModule` and `With`. But none is working. How should I give that user defined function so that it can be deployed into... |
10065 | How to Rasterize in "Printout" style | I am trying to ascertain how large a justified text block will be when printed by rasterizing it in the `"Printout"` style environment. However, `Rasterize` is reverting to the `"Working"` environment. How can I obtain a raster of the graphic as it appears in `"Printout"` style? The following code illustrates the probl... |
10066 | How to turn a random graph into a matrix | I have constructed a random graph with Mathematica using the `RandomGraph` command. Now I would like to convert this graph to a matrix, but I don't know how. The command `//MatrixForm` just shows the same with "//MatrixForm" so that doesn't help to much either. |
10067 | Convert an expression to a Function | I need a function which can take an expression and return a pure function based on the symbols in the expression. The symbols might have values so must be protected from evaluation. It is probably easiest to give an example: I would like to evaluate something like x = y = 1; extractPureFunction[Sin[Pi... |
10077 | Correcting a correlation matrix to be positive semidefinite | Does Mathematica have a way to "fix" a correlation matrix that is not positive semi-definite? I looked through the documentation and search the internet but could not find anything. |
10079 | What strategies can I use to evaluate a limit when Limit[] returns unevaluated | I'm trying to find the following limit using _Mathematica_ : $$\lim_{N\to\infty}\sum_{k=1}^N\left(\frac{k-1}{N}\right)^N$$ The problem is taken from here and is known to converge to $\displaystyle\frac{1}{e-1}$. However, using `Limit` in a straightforward manner returns unevaluated: Limit[Sum[((k - 1)/n)^... |
1008 | Is it possible to speed up ContourPlot on multi-core machines? | It is not very difficult to face a function for which `ContourPlot` works too slow. And it seems natural that this function can be parallelized well. Anyway, naive `Parallelize@ContourPlot` produces " _ContourPlot[...] cannot be parallelized;_ "... So, is it possible to parallelize ContourPlot? |
10089 | How to use FindFit to fit an implicit function? | Now I am trying to fit some data with a implicit model function. Firstly, I tried a toy example. # Toy example with input and output data = {{1, 1}, {2, 1.4}, {3, 1.8}, {4, 2.4}, {5, 2.9}}; fitfunc[a_,b_,x_] := y /. FindRoot[a y + b Log[y] == x, {y, 1}]; FindFit[data, fitfunc[a, b, x], {a, b}, x] ... |
10093 | How to wrap this dynamic code inside a Manipulate? | My goal is to set up a Ising-type simulation, where many fast simulation steps are done in the background, and a visualization of the current state is displayed as the simulation evolves, being updated once or twice per second. I manage to do that by displaying an image of the system inside `Dynamic`, and having the im... |
10096 | Efficiently keeping elements in a list (an input list) that exist in another list (a keep list) | I have some code that generates lists of integers (one such list is called, for example, `inputList`). I also have a "master list" of integers that should be kept, if present, in `keepList`. I would like to write a function `keepElements` that keeps integers in `inputList` that exist in `keepList`. Alternatively, I cou... |
1010 | 2D Gaussian distribution of squares coordinates | I would like to imitate the structure of this great painting from Ellsworth Kelly in Mathematica. Yet with all the colored squares in Black and the beige one in white.  Below is what I have wrote to generate a square made out of 100 squares but I am con... |
10102 | Manipulating OptionsPatterns[] | How do you combine `OptionsPatterns`? For example, I would like to have a function that can take both options that I specify, and options for all graphs: Options[f]={"a"->b} + OptionsPattern[LogPlot] f[...,OptionsPattern[]] := LogPlot[..., ImageSize->OptionsValue[ImageSize]] A related question, h... |
10105 | Variable variable names | I have two variables, $ u \in \{0,40\}$ and $\gamma \in \{0,1\}$. I take $10$ values of $u$ and $5$ values of $\gamma$ and using their combinations as a pair of input parameters, I perform some mathematical operations a total of $10*5 =50$ times. Now, say for $u=40$ and $\gamma=0.5$, I performed my mathematical operati... |
10106 | Increasing the tickrate of an ErrorListLogPlot | I'm new to Mathematica and am trying to do an `ErrorListLogPlot` using the "ErrorBarLogPlots" package (from the Wolfram Library) for a graphical evaluation. Needs["ErrorBarLogPlots`"]; ErrorListLogPlot[ { { {{1/8.85, 43.59`}, ErrorBar[{0, 0}, {-0.42, 0.42}]}, ... |
10113 | How to force Dt[ ] to recognize dependencies | I want to differentiate a function `f[]` for which I don't have a specific expression. `f[]` depends on `x` and `y` and has parameters k1 and k2 in it. `x` and `y` depend on `t`,and not on `k1` nor `k2`. So when I use the total derivation operator `Dt[f, t]`, only `x` and `y` should be differentiated. But how can I say... |
10130 | Formatting and printing lists with Mathematica scripts | I'm just starting out with _Mathematica_ and I'm using `MathematicaScript` rather than the GUI. However, I'm having trouble formatting a list when printing it. Suppose I have a list and I want to print it using `Column`: list = {a, b, c}; Print[Column[list]]; Calling this outputs `Column[{a, b, c... |
10133 | How to make use of NumericQ[x] = True (and use it safely)? | * * * ## Basic Issue: I'm trying to understand the proper use of `NumericQ`'s "magical" capabilities. Please consider the examples below. Actual question and some links are at the very end. * * * ## Example 1: Many of you are aware that `NumericQ` can be used as follows, without unprotecting: In[1]:= ... |
10135 | Handing a list of constraint expressions to a C++ function with MathLink | I need to solve an optimization problem, which is defined in a Mathematica notebook. Using Mathematica's `FindMinimum` is not an option, because it is too slow. So, the idea is to use an external solver for quadratically constraint quadratic problems and use MathLink to get the constraints of the problem from Mathemati... |
10137 | Converting a string containing whitespace-delimited numbers to a list of numbers | Suppose I have a string `str` that contains only whitespace-delimited real numbers: str = " 0\t1.46604\t1.44829\t12.0546\t1.57075\t1.64044\t12.0489\t1.58142"; I would like to convert `str` to a list of real numbers. One way to accomplish this is to split the string using `StringSplit` and then `Map` ... |
10139 | ComplexInfinity/Indeterminate error when evaluating derivative | **Motivation:** I want to find the coefficients for the polynomial that is obtained when one adds together the first $n$ natural numbers to the power of $a$; that is, when you consider $1^{a} + 2^{a} + \cdots + n^{a}$. The way I wanted to do this was: find the polynomial, then take the $j$-th derivative, evaluate at 0,... |
10143 | How to pick an element of a row corresponding to the minimum in a particular column? | How can I find what value in column 1 of my list corresponds to the minimum value in column 2? |
10151 | Tweaking Prime[n] to return 1 when n==0 | I manually evaluate this cell to set Prime[0] Unprotect[Prime] Prime[0] = 1 Protect[Prime] I manually evaluate this cell to reset Prime[0] Unprotect[Prime] Prime[0] =. Protect[Prime] In case I forget to do it, is there a way to automatically evaluate the second... |
10157 | How do you insert more columns into Table cells? | **How do you insert more columns into Table cells as shown below?** To get to this table, go to _File -> New -> Styled Notebook -> Textbook -> New -> Scroll down to the Table Cells_.  |
10159 | Problems with images caused by which stylesheet is used | **Update** > This looks now like it was a bug in Mathematica version 8, because > everything works as expected - at least for this minimal example - in > version 9. (As an aside, I couldn't seem to find the Creative stylesheets > using the menu interface, although they're still installed at > "/Applications/Mathematica... |
10162 | How to map rotate, pan, zoom to manipulate controls | I am wondering if there is a way to restrict the motion of the rotate mouse cursor in when moving around a 3d plot. For example, I want the y direction of the cursor to correspond to pulling the z axis toward or away from me (the camera), and the x direction to rotate the graphic around the z axis. I can do something s... |
10163 | How To Span Table Headings? | What I am doing wrong? I would like to get a header to the table and based on your code I tried this: hdr = {{"Calculated Coordinates", SpanFromLeft}, {"No", "x", "y"}}; hdr1 = Grid[hdr, Frame -> All]; legendmarkers=Range@Length@data;
legendlabels=Map[Style[Accounting... |
10164 | Get the first element after the first sequence of length N of consecutively increasing values | I'm looking for an efficient way of extracting the first element after the first sequence of N consecutive elements in which the values are increasing. If these are the data of a toy example: data = {{1, 4}, {2, 3}, {3, 4}, {4, 5}, {5, 6}, {6, 4}, {7, 6}, {8, 3}, {9, 4}, {10, 5}, {11, 6}, {12, 7},... |
10175 | Where in the documentation can I find a list of function argument types? | Recently, I learned that it is possible to assign "types" to function arguments in the definition of a function. Suppose I have a function `stringFun` that does some operation (e.g., `StringSplit`) on an input string `str`. I could define the function in this way: stringFun[str_] := StringSplit[str] ... |
10180 | Plotting a complex valued function over a circular region | I would like to apply some complex valued function to some region in the plane, say, a circle of radius $R$ centred at $k$. How can I do this? |
10185 | How do you define an affine transformation that is translated by itself? | This one should be simple, but I can't figure it out. I would like to define a transformation (function) such that $r$ maps to $m.r + r$ The help file on AffineTransformation says that AffineTransformation[{m,v}] maps $r$ to $m.r + v$ so for example tt = AffineTransform[{d*IdentityMatri... |
10188 | How to force native styling of controls? | While preparing a dynamic module, I discovered a weird behaviour of Mathematica's controls when you rotate them: Rotate[Button["Toto", Null], 0] Rotate[Button["Toto", Null], 0.01] Rotate[Button["Toto", Null], 0.02]  The first ... |
10191 | How to export data from For loop in text file? | I'm new in Mathematica and I am trying to write numbers from 1 to 10 in txt file. But "Null" is everything that is written in my file. The code is: Export["C:\\Users\\Sealy\\Desktop\\list.txt", For[k = 1, k <= 10, k++, Print[List[k]]]] |
10196 | Creating sums of elements from a list | I have a list $(d_1, d_2, .. d_k)$ and I want to create all sums that I get for adding only two elements for my list $(d_1+d_2, d_1+d_3,...d_{k-1}+d_k)$. The `RotateLeft` function gives me only some of my sums and I need all of them. |
10204 | How to uncompress only the compressed elements in a matrix | I have data in a rectangular structure – something like `matrix={{a,b,c},{d,e,f},{g,h,i}}`. The problem is that some of the columns consist of uncompressed data and some not. Now I'm looking for an elegant way to uncompress the whole matrix. Unfortunately `Uncompress[matrix]` doesn't work. |
10207 | How can I manipulate with elements inside sublists if sublists of different lenght? | I have some kind of output like this: {{1, 5}, {1, 13}, {1, 5, 25}}. I would like to be able to enter in each sublist and make sums of every two elements in sublists, for example my desired output would be {{6}, {14}, {6, 30, 26}}. I can export these sublists in txt file, but I don't know if this is even necessary. Is ... |
10210 | Pack Solve results into a vector | I am currently using a really easy function to get the eigenvectors of a corresponding eigenspace: Eigenspace[mat_, ev_] := Solve[ (mat - IdentityMatrix[Part[Dimensions[mat], 1]] * ev) . Table[Subscript[x, i], {i, Part[Dimensions[mat], 1]}] == Table[0, {i, Part... |
10211 | Applying And to lists of Booleans | I'd like to take `{True,True,False}` and `{True,False,False}` and apply `And` to get `{True,False,False}`. Right now I'm using And @@ # & /@ Transpose[{{True, True, False}, {True, False, False}}] Is that really the best way? I would like `And[{True, True, False}, {True, False, False}]` to work but it... |
10220 | Obtaining joint distributions and conditional distributions using Mathematica | I have two multivariate Gaussian distributions $p(x)$ and $p(z)$ with mean vectors $m_x$ and $m_z$, and covariance matrices $\Sigma_x$ and $\Sigma_z$. my model is a simple linear model $x = W z+n$ where $n$ is a noise vector with mean $0$ and diagonal covariance matrix of the form $\sigma^2 I$, where $I$ is the identit... |
10223 | Improving the source-code indentation in Wolfram Workbench | One thing that I like about the more recent versions of the Mathematica front- end is that I think it does a good job indenting code. The language's functional nature, in my experience, leads to a lot of nesting, and the small indentation works well for this pupose. However, for some reason, the rules used for Wolfram ... |
10224 | Slow Dynamic Button Does Not Print | > **Possible Duplicate:** > Why do buttons with ChoiceDialog freeze the front end? > Why is SystemDialogInput failing to return a save file path? > Evaluation inside Button stops after some seconds I am trying to use the code from: Make a button that evaluates a function over and over to make a button evaluate... |
10229 | CountryData and the areas of the world | If I add the WaterArea and the LandArea of the world, I get the same number as if I asked for the total area of the world in the first place: In[1]:= {CountryData["World", "WaterArea"] + CountryData["World", "LandArea"], CountryData["World", "Area"]} Out[1]= {5.10066*10^8, 5.10066*10... |
10231 | Calling MATLAB from Mathematica | How can I call MATLAB functions directly from Mathematica and transfer data/variables between the two systems? |
10238 | How to demodulate an FM signal in continuous-time? | _I'm not sure if this is a math or Mathematica question, but I'm posting it here because I'm interested in possible Mathematica tools/functions to solve the problem._ I'm stuck. I want to simulate the effect of a EMP (ElectroMagnetic Pulse) disturbance on an FM signal. Here's my code: f1[t_] := Sin[t]; (*... |
10239 | MapThread with several cells as output | Assume I have defined the following function: FF[{x_, y_}] := {x^2 + y^3, 3.5*x*y} I would like to apply `FF` on a list of input such as: XX = {xa, xb, xc} YY = {ya, yb, yc} In order to do it I input the following syntax: MapThread[FF, {XX, YY}] but as output... |
10241 | Comparing elements of the $n^{\text{th}}$ sublist in a ragged list with the $n^{\text{th}}$ member of a sequence | I have a list of lists that are not of the same length (for example, `{{6}, {14}, {6, 26, 30}}`), but I have to compare every element in the $n^{\text{th}}$ sublist with the corresponding $n^{\text{th}}$ odd number. So, 6 in the first sublist with 1 (first odd number), 14 in the second sublist with 3 (second odd number... |
10245 | Sum of Squares without multiplication | I want to sum the squares for a given number N from 1 without using Multiplication. Is it possible? |
10250 | How does Mathematica know my location? | On the `AstronomicalData` page in the online reference, it says for AstronomicalData["Sun", "NextRiseTime"] that it finds the next rise time for the Sun **from your current location** and time. Where does _Mathematica_ keep that? I don't remember giving that during installation and I can't find it in... |
10253 | DSolve gives complex function although the solution is a real one | I have a problem with the DSolve[] command in mathematica 8. Solving the the following 4th order differential equation spits out a complex solution although it should be a real one. The equation is: y''''[x] + a y[x] == 0 Solving this equation by hand yields a solution with only real parts. All const... |
10254 | Dynamic[] and Print[] | > **Possible Duplicates:** > Intermediate display similar to PrintTemporary > Estimating progress on plots > How to create a progress bar? > How to determine how much of a table is generated? I'm trying to print an output from every iteration of a `Do[]` loop, but without it continuing down the notebook. I ... |
10267 | Drawing dessins d'enfants (bipartite graphs subject to certain conditions) | I want to write a function which constructs all possible _dessins d'enfants_ (bipartite graphs fulfilling certain criteria, given below) from a collection of data presented in the following form: $\begin{Bmatrix}r_{0}\left(1\right),r_{0}\left(2\right),\ldots,r_{0}\left(W\right)\\\ r_{1}\left(1\right),r_{1}\left(2\right... |
10273 | Higher order periodic interpolation (curve fitting) | I have a list of points in 3D, and I want to get a smooth interpolation or curve fit (it is more for illustration) of these points such that the first and second derivatives at the start and end points agree. With ListInterpolation[pts1, {0, 1}, InterpolationOrder -> 4, PeriodicInterpolation -> True] ... |
10278 | What is the default file path used by the Put function and how do I pre-evaluate an expression to use in Put? | I have a problem of trying to store some output in an external file. In one note book I define a function `f[x_]:=AdvancedCalculation`, where this function generates a relatively large output and is dependent on a significant number of definitions. In another notebook, I would like to have the expression `terms=f[x]`, ... |
10279 | FindRoot Domain restriction | I am solving a system of four non-linear equations in four variables using FindRoot. I have some sense of the relationship between the variables so I don't want Mathematica to do its computations in certain funky regions of the domain. For example, I want to solve: $\begin{align} g_1(w,x,y,z) &=0\\\ g_2(w,x,y,z) &=0\\\... |
10280 | Need help evaluating definite integral to a function of Y | Suppose $Y = \sqrt{2T}\cos(U)$, $ 0 \le u \le \pi $, and $ 0 \le \cos^{-1}(\frac{y}{\sqrt {2t}}) \le \pi ) $, so $ -1 \le \frac{y}{\sqrt{2t}} \le 1 $, with all $ \mathbb{R}$. The iterated integral is $$ G(y)= P(Y \le y) =P(\sqrt{2T}\cos(U) \le y)=\int_{0}^{y}\int_{0}^{\cos^{-1}(\frac{y}{\sqrt {2t}})} \frac{e^{-t}}{\pi ... |
10282 | Manipulating the axis on a ListLinePlot | I am trying to create a plot using `ListLinePlot` in which the x-axis is represented in a logarithmic scale, and is reversed (so larger values are on the right side). I have found that `ScalingFunctions -> {"Reverse"}` will reverse the axis and `ScalingFunctions -> {"Log"}` will scale the axis to a log scale, but the t... |
10289 | Visiting nodes in a tree bottom up | I have a problem that can be reduced to this one: Suppose I have an unbalanced (almost random) tree. The leaves of the tree have one property already set, and all vertex (including the leaves) have another property that I have to update upon visiting. To update that property, I need to cast a function `f[father_Vertex,... |
10290 | Integrating over a region without singularity gives an error indicating the function has singularity in that region | I have the following 2D region over which I want to integrate a function: r1 = Sqrt[mη^2 + (Sqrt[w1^2 - mπ^2] + Sqrt[w2^2 - mπ^2])^2] // Expand; r2 = Sqrt[mη^2 + (Sqrt[w1^2 - mπ^2] - Sqrt[w2^2 - mπ^2])^2] // Expand; mη = 0.547; mηp = 0.958; mπ = 0.137; RegionPlot[mηp - w1 - w2... |
10292 | Derivatives (divergence, gradient, curl) of interpolated 3D data | How can I calculate a vector derivative (i.e. divergence, gradient, curl) of interpolated data? For sample data, you can use: f[x_, y_, z_] := Exp[I z] {1, 0, 0} testdata=Flatten[Table[N@{x,y,z,f[x,y,z]},{x,0,4 Pi,Pi/10},{y,0,4 Pi,Pi/10},{z,0,4 Pi,Pi/10}],2]; intf = Interpolation[testdata] I ... |
10296 | Problem while solving system of two second order non linear coupled differential equations using NDSolve function | I am a completely new to _Mathematica_ , and I am sorry if this question is dumb. I have to solve a system of two second order non linear coupled differential equations (that I got from the Lagrangian equation of motions for a particular system). The following is my code: I hope it is clear. NDSolve[ ... |
10298 | CustomTicks and ListPlot - Can't seem to get them working | I have a very large list of numbers like list={{a1,b1},{a2,b2},...,{ai,bi}} where a1 ranges between 10^-9 and 10^-5 and bi varies between 0 and 100. I have generated successfully the plots and am now tweaking them with CustomTicks to look a bit better. But I'm not able to get the XX axis as I want. T... |
10301 | How do I use the ShowLegends function to produce a legend for my framed graphic? | I'm new to this site and new to Mathematica as you can see from my question. I'm also new to programming, btw. I'm trying to produce a legend for my plot which I've coded as follows: Needs["PlotLegends`"] ds1 = {{0, 0.53}, {10, 1.00}, {20, 2.19}, {35, 3.61}}; ds2 = {{0, 0.52}, {10, 0.91}, {20, 1.9... |
10302 | Evaluation indicator for a notebook | I have a GUI with a number of `TabView` and other `Manipulate` controls. Sometimes clicking from one tab view to the other can take a while, and I would like to have a global "Please wait" indicator. So one way is to implement it for each button or slider, but I would essentially like to have a visual indicator that wi... |
10306 | How to properly handle mutual imports of multiple packages? | I'm new to the mathematica platform and I am developing a simulation framework as my first exercise and have been tearing my hair figuring how to make packages interact with each other. Ill explain a minimum package experiment I developed to understand my problems and please I would like a theoretical explanation of wh... |
10309 | Why does the name of a pattern affect the result of a transformation rule? | I was playing a little dirty, trying to get a template for defining a `Curl[]` operator. I wrote the following rule, which I knew was going to spit out a few errors, because all symbols there (including the lists), were undefined: Cross[{d[1], d[2], d[3]}, {2, 3, 4}] /. Times[a_, b_] -> b[[a]] Notwit... |
10312 | Microsoft SQL DatabaseLink connection using Windows Authentication | For those who use _Mathematica_ with databases in companies, a common way to securely connect to those is using Windows Authentication (detailed here). _Mathematica_ doesn't seem to support this authentication method. How can you connect to a database securely using Windows authentication? |
10320 | Selecting polynomial roots and plotting against parameters | An implicit function $f(x,k)=0$ is quadratic in $x$ and contains one parameter $k$ which I must vary. Using `Solve`, I get two real solutions for each specific $k$: $x_1$ and $x_2$, of which I must choose the one that lies within $[0, 0.5]$. I must do this for a continuum of parameters $k$ between, say, $0$ and $1$. I ... |
10322 | Elegant manipulation of the variables list | I have a list of global variables (some of them are indexed variables), for example: varsH = Hold[U0[1], U0[2], B0, V0[1], V0[2]] Or (if it is easier to handle) I can have them as a `List` of `Strings`: varsS = {"U0[1]", "U0[2]", "B0", "V0[1]", "V0[2]"} Now I need to be able to do ... |
10325 | How to create Locator[] hierarchies? | I'd like to 'parent' Locators to one another, ideally organized in any arbitrary tree. The simplest case: If I have two Locators, A and B, then moving A will move both together, but moving B will only move that one. Any simple suggestions? |
1033 | How do you get high resolution plots in applications using the Mathematica MathService? | This is for Mac users only using MathService (MathService it seems, given that it was created back in 2004, is a power pc code and requires Rosetta to run on Intel). If I type a plot command in another application (in this case TextEdit):  ...and then u... |
10331 | How do I get the critical value in statistical hypothesis testing? | What I am trying to do is to get the value of $\chi^2$ for given probability (let us say $\alpha$=0.01) and degrees of freedom (for example df=3). How do I get that? Inverse...Distribution functions return something quite different from expected. Thanks in advance. |
10333 | How to check if a 3D point is in a planar polygon? | Following up on ndroock1's question, I naively tried to apply the solutions to a 3D point and polygon and they didn't work. For example, functions involving `ArcTan` that are used in kguler's answer don't work with three arguments, Mac's answer doesn't consider the 3rd dimension at all, the undocumented function `Graph... |
10338 | First evaluation fails | I am fairly new to _Mathematica_ (version 7), so please bear with me... I have duplicated, in _Mathematica_ , a program that I originally wrote in C (it generates OEIS sequence A191837). The problem is that each time I make a change to the function `nCk` the first evaluation doesn't print. I have to stop the evaluation... |
10344 | Labeled and Graph don't mix? | In an attempt to create a legend for a graph drawing, I find that Labeled only works without the position options (except for `Center`). Graph[Range[2], { Labeled[DirectedEdge[1, 2], "BEFORE"]}]  But Graph[Range... |
10348 | Why is LogLogPlot[] slower than Plot[]? | I notice that `LogLogPlot` runs quite bit more slowly than ordinary `Plot`. For example, consider the following two blocks of code which plots (using `Manipulate`) a region in linear scale and log-linear scale. Notice how the log-log-scale manipulation runs more sluggishly. Is there a way to speed up the log-log-scale ... |
1035 | How to Text justify string that includes SubScriptBox in it? | I am using Grid to document a demo I have. i.e. I am writing the documentation of the demo as a help option, which will display information when clicked on. Everything is working well. I am using the following pattern to do that: help=Block[{a,b,c,.....}, (*Block is needed to prevent $nnn in symbols showi... |
10350 | Mathematica for linear algebra course? | I'm taking a linear algebra / matrix theory course and we are free to use any software we want, and will be "expected to use MATLAB or an equivalent" for homework. The professor and textbook (Applied Linear Algebra) prefer MATLAB, some students seem to like R, but I'm already familiar with Mathematica and have a studen... |
10354 | Trying to calculate a sum within a module - why is the iterator not creating integers? | Suppose I have the code: #!/usr/local/bin/MathematicaScript -script SetOptions[$Output, FormatType -> OutputForm]; foo[bar_?IntegerQ, baz_?IntegerQ] = bar; M[g_?IntegerQ] = Module[ {sum}, sum = Sum[foo[i, g], {i, 1, 4} ]; N[sum] ]; Print[M[1]] ... |
10359 | How to Solve or LinearSolve $A = I$ matrix equation? | I'd like to solve this equation for $A = B$ where $B = I$, which represents 3 systems of 3 linear equations, for $a, b, c, d, e, f$, without writing `LinearSolve` 3 times. What is a simple way to accomplish this? Input: A = { {a + b, -a + b, a + 2 b}, {c + d, -c + d, c + 2 d}, {e... |
10362 | FindRoot Infinite expression 1/0 encountered error | I have 1 equation in 1 variable, which when I use `Plot`, looks like this: i = 9 Plot[ A1[[i]]*(92)^(-1.7049946543060777) + B1[[i]]*(92)^(2.9716613209727445)- c1[[i]]*80/0.057 + 65.89077138196083`, {H1S, 125, 135}, AxesOrigin -> {125, 0}] . Same queries, documents
and relevance judgements as the benchmark evaluates — reshaped into one strict schema shared by every dataset
in this collection.
| Source | mteb/cqadupstack-mathematica @ 90fceea13679 (the revision pinned in mteb) |
| Domain · languages | stackexchange · eng |
| Queries / documents / qrels | 804 / 16,705 / 1,358 |
| Qrels per query | min 1 · mean 1.689 · max 56 |
| Score values | 1 ×1,358 |
| Layout | queries · corpus · qrels, split test |
| License | cc-by-sa-4.0 |
Schema
| config | columns | rules |
|---|---|---|
queries |
id: string, text: string |
ids unique and non-empty; every query has ≥ 1 qrel |
corpus |
id: string, title: string, text: string |
title is always present ("" when the source has none) |
qrels |
query-id: string, corpus-id: string, score: int32 |
referential integrity to both tables; no duplicate pairs; no floats |
Files are Parquet, sorted by id, zstd-compressed, sharded at 500 MB. Every rule above is enforced by a validator
before publishing; provenance.json records the source file hashes, what changed, and the output file hashes.
What changed from the source
- byte-preserved all text — no whitespace, newline, or control-character normalisation
- cast
qrels.scoredouble -> int32 - kept 1 documents whose text is identical to another document's — a property of the source; note that models embed such documents identically and retrieval ties among them are broken by corpus order
- renamed
_id→id - renamed source splits (
queries←queries/queries,corpus←corpus/corpus) totest
Load it
from datasets import load_dataset
queries = load_dataset("Hyukkyu/beir-cqadupstack-mathematica", "queries", split="test")
corpus = load_dataset("Hyukkyu/beir-cqadupstack-mathematica", "corpus", split="test")
qrels = load_dataset("Hyukkyu/beir-cqadupstack-mathematica", "qrels", split="test")
License and attribution
The data is redistributed under the source's terms — cc-by-sa-4.0. All credit belongs to the
original authors; see the source repository and the references in mteb's task metadata (http://nlp.cis.unimelb.edu.au/resources/cqadupstack/).
This repository is an independent repackaging and is not affiliated with the RTEB or MTEB maintainers.
License discrepancy. The upstream dataset card declares
cc-by-sa-4.0whilemteb'sTaskMetadatadeclaresapache-2.0. This card carries the upstream value as the more conservative choice.
- Downloads last month
- 39