3
votes
2answers
74 views

Is the MaximalBy function still used [on hold]

On the mathematica reference website it gives examples using the MaximalBy function, However when I am using it, I see no desired output. This leads me to wonder if mathematica has stopped using this ...
1
vote
3answers
135 views

Plot a one-dimensional list of numbers as a column/row of labeled colored squares

I have a list of numbers and a matching list of labels. I want to plot a column of colored squares, with the color of each square matching (in some color scale) the value of the corresponding number. ...
4
votes
0answers
46 views

Operator and VariationalMethods [on hold]

I'm trying to get the variational derivative $\delta E$ respect to $\Phi$ of this functional $$ E[\Phi] = \int d^3r\ \left[ -\frac{\hbar^2}{2m}\nabla^2\Phi + V(\vec{r})\Phi^*\Phi + ...
0
votes
0answers
6 views

Probability in a knock-out tournament [migrated]

Maths newbie so please go gently. Imagine if you would: 4 teams in the semi-final of a soccer tournament A,B,C,D. A,B and C all have 20% chance of winning the tournament. D however, is the favourite ...
0
votes
0answers
42 views

On the order of rules specification [duplicate]

I wanted to understand how Mathematica parses function definitions in rules-based programming, so I started with the simple code: ...
2
votes
3answers
128 views

Alternatives to Append/AppendTo for generating a list in an interactive DynamicModule?

I have a stack of timelapse microscopy images that I am trying to segment frame-by-frame using some of Mathematica's image processing functions. I have created a little interactive DynamicModule with ...
0
votes
1answer
65 views

Hypergeometric function with a matrix argument [on hold]

I am looking for the evaluation of a Hypergeometric function with a matrix argument as for example in Ploev and Edelman or as showcased in this Wikipedia article. From what I understand from ...
5
votes
1answer
107 views

Numerical error in Mathieu functions

Consider the MathieuCharacteristicA function, which is a piecewise function according to the documentation. The discontinuity happens at integer number. ...
2
votes
2answers
75 views

Local variables whose definitions depend on each other [duplicate]

Consider the following (pseudo-)function definition: f[l_] := Let[{ a = Length[l], b = First[l], c = b/a, }, c*10] So for ...
2
votes
1answer
25 views

ExportString and HTML: where are saved images?

I want to use ExportString to generate HTML expression. Here is an easy example: ExportString[x^3, "HTML", "FullDocument" -> False] gives ...
5
votes
1answer
79 views

ListPolarPlot: 0 Degree at vertical axis

Is it possible to have ListPolarPlot start plotting at the vertical axis? By Default ListPolarPlot gives this result: ...
7
votes
2answers
164 views

Numerical value of physical constants Mathematica 10

Is there a way to use the physical constants in calculations and have Mathematica 10 figure out the final unit and numerical magnitude? When I try ...
1
vote
1answer
47 views
0
votes
0answers
40 views

How to deal with matrices involved in system of SDEs?

This question is in continuation of the the previous posts Solving Stochastic differential equation and Fast Simulations with Compile. What I want to do is numerically solving the epidemic model which ...
3
votes
1answer
45 views

Filling dependence on order of points in ListPlot

ListPlot[{{{1, 0}, {0, 0.5}}, {{1, 1}, {0, 1}}}, Filling -> {1 -> {2}}, FillingStyle -> LightGray, Joined -> True, Frame -> True] Results in no ...
2
votes
0answers
40 views

Some global variables are defined even at the start of a fresh session

In a fresh Mathematica session evaluating Names["Global`*"] doesn't give an empty list. The result is either {rhs, z} ...
4
votes
2answers
52 views

Problem with general assumptions

I hope I am not to redundant with my questions. As part of solving a physical problem, I want to assume once and for all that all my variables and parameters are real, positive and finite. Is it ...
18
votes
2answers
285 views

Object separation from a 2.5D surface

I'm trying to identify the shape and the boundaries of objects. The data was generated with a laser scanner and represent the surface of an area in which many boulders lay on the ground and making up ...
0
votes
1answer
88 views

Specifying initial conditions for a PDE

I have simple diffusion equation with point source at c(0, t) = 1 and initial condition c(elsewhere, 0) = 0. How should I apply ...
6
votes
1answer
239 views

Tuples without self-loop

I have a simple question coincerning the Mathematica function Tuple. Currently, I apply the following code ...
3
votes
0answers
53 views

Efficient processing of Special Ordered Sets with LinearProgramming

I'm playing with integer linear programming, especially problems involving lots of constraints which would appear to be special ordered sets. Below is a toy example, three last rows of the matrix ...
0
votes
0answers
52 views

What is the meaning of a result of {{}}? [closed]

What does an output of {{}} mean in Mathematica after solving a system such as: $e^{x}=e^{x}$ for $x$?
2
votes
1answer
114 views

How to solve three equations with four unknowns iteratively?

I have three equations of the form $\quad \eta = f(N1L, N2L)$ $\quad N1L = g(\eta, R)$ $\quad N2L = h(\eta, R)$ I want to eliminate $\eta$, so that I can get $N1L$ and $N2L$ for a range of $R$. I ...
2
votes
0answers
47 views

Program file deleted while running

I have a program running for some time at one computer. Today, unintentionally, I edited the program file from another computer (I use Dropbox), and the program kept running. Trying to correct my ...
11
votes
2answers
325 views

Find maximum value of interpolation function - obviously wrong result

Minimizing and maximizing interpolation function has already been asked and answered, see here for example. Yet, I observe a strange behaviour. Well, I can understand that the wrong guess of ...
6
votes
2answers
105 views

Export MatrixPlot graphics to PDF

I am trying to export a plot generated by MatrixPlot to PDF but am having problems with the way the exported PDF is rendered. ...
2
votes
0answers
88 views

Power::infy: error using FindFit

I have a 2D data to fit (the Airy type pattern from diffraction of Gaussian beam on the circular aperture). Please see the attached picture. I was going to use a function like ...
3
votes
3answers
94 views

Solving determinant of a Kronecker product of matrices gives a numerical error - why?

I am doing the following steps (code at the end of the post): I start with a 2x2 matrix (smatrix), which is a function of a single variable (u2). I want to set the determinant of this matrix ...
3
votes
3answers
118 views

Transformation of Derivatives under change of coordinates [duplicate]

I have an expression depending on the two variables z and t, and the derivative of a known function $f(t,z)$. Something like: $$myexp \ =\ t\ z\ \partial_z\ f(t,z)$$ Now I want to make a change of ...
1
vote
2answers
93 views

How to do a region plot with many functions [duplicate]

Hello i am trying to compare many function, i want to see witch one as the lowest value depending on 2 variables. My solution so far is something like this: I have 7 function: P1 P2 P3 P4 P5 P6 P7, ...
0
votes
0answers
11 views

Applying chain rule to evaluate a derivative when the component function is not differentiable at one point [migrated]

I got the following question. Can anyone help me? Thanks! Y is a smooth function of X. and X is a function of r, which kinks at r=r0, but is smooth everywhere else. I was try to compute dY/dX at ...
0
votes
0answers
42 views

Extract the minimum positive root from a quintic [closed]

I need to compute the values of ϵϵ and x2 from the following sytem: ...
0
votes
0answers
77 views

plot $f(x)$ against $\frac{1}{x}$ [closed]

Hi guys this is really a simple question: if i have $f(x)$ how do i plot this function in mathematica against, for example, $\frac{1}{x}$? thanks in advance
12
votes
8answers
507 views

UnFlatten an array into a ragged matrix

Trying to unflatten an array that was part of ragged array of sub matrices. As input we have flattened array: ...
6
votes
2answers
51 views

Recursive function with array of variables

I am trying to create a recursive function which works with an increasing array of variables. Since the formula is quite complex, i will try to simplify my example to the core of my problem. The ...
1
vote
0answers
27 views

Conditions for proper integrals with DSolve on Mathematica

DSolve[{RCS'[s] == SNPH[s] - Sqrt[R2[s] - RCS[s]^2]/b,SNPH'[s] == RCS[s]/a^2, R2'[s] == 2 RCS[s] SNPH[s], RCS[0] == 0., SNPH[0] == snal, R2[0] == ri2}, {RCS, SNPH, R2}, s ]; Here {a,b,snal,r12} are ...
15
votes
7answers
2k views

Distance between point and line segments

How would you determine the shortest distance between a point and one or more segments? For example, what is the shortest distance between the point and the two segments below? Clearly the point is ...
7
votes
6answers
569 views

Installing RLink on Linux

I'm trying to install RLink here. Needs["RLink`"] InstallR[] After downloading it throws an error: ...
1
vote
2answers
373 views

Specifying parts from lists for plotting using Show

I have the following data: ...
8
votes
1answer
196 views

Testing for primality in quadratic rings?

Testing for primality in $\mathbb{Z}[\sqrt{-1}]$ in Mathematica is easy: PrimeQ[n, GaussianIntegers -> True] But how can I test for primality in, say, ...
82
votes
4answers
6k views

Resources for beautiful Mathematica Stylesheets

When the Wolfram Demonstrations were introduced and the Documentation-Center was redesigned, I remember it was the first time I thought someone had put some effort into creating a beautiful ...
10
votes
2answers
3k views

Performing a chi-square goodness of fit test

How would I perform a chi-square goodness of fit test? I have tried the following, where my data consists of the observed values whilst the data pair contains the correct values. Then I use the ...
7
votes
3answers
2k views

Doing a chi-square independence test in Mathematica

I have a matrix consisting of the following data: Needs["HypothesisTesting`"] data = {{11, 206}, {32, 1374}} How would I make a chi-square independence test ...
83
votes
5answers
6k views

How to compile effectively?

What are the best practices of compiling functions? I understand that this is a vague question, but let me list some aspects that might trigger useful answers. Some of these have already been answered ...
10
votes
1answer
579 views

Toolbars in Mathematica

Mathematica seriously lacks some useful toolbars. I wonder why keeping a totally barebone gui is part of WRI's policy? Would such a feature be so platform-specific that it does not worth design it? I ...
27
votes
4answers
2k views

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 ...
25
votes
3answers
1k views

Saving a notebook as PDF, preserving syntax highlighting

Currently, one may save notebooks as PDFs from the menu by Save As... and then selecting PDF (on a Mac, I imagine it is similar on other OSs). However, the ...
36
votes
1answer
2k views

Adaptive sampling for slow to compute functions in 2D

EDIT: Although I have posted an answer based on my current progress, this in incomplete. Please see the "open issues" section in the answer. Most plotting functions in Mathematica adjust the ...
293
votes
12answers
52k views

Where can I find examples of good Mathematica programming practice?

I consider myself a pretty good Mathematica programmer, but I'm always looking out for ways to either improve my way of doing things in Mathematica, or to see if there's something nifty that I haven't ...
14
votes
5answers
4k views

Plotting discontinuous functions without spurious vertical segments

Consider the plot of this discontinuous function: f[x_] := If[2 < x < 3, 0, x] Plot[f[x], {x, 0, 5}] I'd like to plot that without the vertical segments. ...

15 30 50 per page