0
votes
0answers
6 views

Weird error with syntax

Since I don't know how to reproduce this error with simpler code, let me reproduce it exactly in form I encountered it. ...
5
votes
6answers
157 views

Brackets around each item in matrix

I have a matrix where every item in the matrix has its own brackets that I do not want. How can I remove the brackets around each item?
3
votes
0answers
19 views

RandomPoint works with a 2D ImplicitRegion but fails for any higher dimension

This is inspired by this answer which features code that I cannot get to work at all, and I tried to figure out why. It boils down to using the function ...
11
votes
3answers
247 views

Using NDSolve to find particle trajectory

I'm trying to simulate a particle in an electric and magnetic fields, but numerically instead of analytically. This is basically solving the equation $$q \cdot \left(p'\times B\right) + q\cdot E = m ...
1
vote
0answers
9 views

Install[] Hangs for Precompiled Cuba Integration Executable

I am trying to use the Cuba integration package in Mathematica 10.2 on a Windows 10 machine. However, having downloaded the supplies Vegas.exe MathLink executable, when I try running ...
1
vote
2answers
47 views

List of options

It seems this should be easy, by I just can not figure out how. I want to have a function that I can pass a list of options to, or use a default. I have found two very similar questions, but I can't ...
2
votes
0answers
49 views

Low accuracy while solving a multi-variable equation numerically

My question is as following: I was trying to make a function Vs2[r] with two parameters fit a set of conditions. Vs2[r]: ...
13
votes
2answers
432 views

Cluster a signal into areas of equal intensity

Introduction I have a greyscale photograph that I want to partition into areas of equal intensity. This means, that the integral over each partition should be (roughly) equal. There is no unique ...
0
votes
2answers
42 views

How to plot in the complex plane? [duplicate]

I am new to Mathematica and I would like to ask how to plot in the complex plane in general. Also, as an example, how do you plot $e^{i\theta}$ in Mathematica? In physics the function $e^{i\theta}$ is ...
11
votes
1answer
300 views

How to numerically solve a 1-d time-independent Schrodinger equation?

The point is to solve the eigensystem of the given Hamiltonian. I tried ParametricNDSolve combined with FindRoot to search for ...
3
votes
1answer
29 views
3
votes
1answer
73 views

Statistical measures of a function of a 2D matrix of random variables

Im new to Mathematica, and I have been searching online without success an answer to what should be an easy question. I want to define a function $f$ on, say, $n$ independent random variables and ...
17
votes
4answers
544 views

LogPlot axes labels destroyed when working in high precision

Bug introduced in 7.0 or earlier and persisting through 10.3.1 or later (I'm using Mathematica 8.) I have a Taylor series: ...
0
votes
1answer
37 views

Using Solve with Mod [on hold]

I'm new to Mathematica, and it seems like what I'm doing should be a simple operation, but I can't seem to get it to work, or return the right result. I'm assuming I'm doing something fundamentally ...
0
votes
1answer
32 views
19
votes
2answers
2k views

Generating convex polyhedron from face planes?

Suppose I have lists of normals and points for planes. There's a convex polyhedron whose faces lie on these planes and are bounded by plane intersections. What would be the easiest way to produce an ...
14
votes
2answers
4k views

CDF plugin no longer launches in Chrome

I exported a web-embeddable CDF, and created an html page with the automatically generated code. Both are in a local folder. When I open the HTML page in a Chrome browser, i get the PNG image telling ...
-3
votes
1answer
69 views

How to symbolically integrate 2D exponential function? [duplicate]

Is it possible to symbolically solve a 2D integral of the following form $$\int d \vec{r}e^{-\frac{\left| \vec{r} - \vec{r}' \right|^2}{2c}}e^{-i \vec{k} \cdot \vec{r}} $$ where $\vec{r} = (x,y)$ and ...
0
votes
0answers
32 views

How to define an exclusion zone for NDSolve

I need to numerically integrate a differential equation and define two exclusion zones to stop the integration. The Mathematica code looks like this : ...
0
votes
1answer
71 views

Simplify fractions and square roots

I would like to 'Simplify' Sqrt[5/6]/2 to Sqrt[5/24] I've tried to penalize Times and Rational using ComplexityFunction, ...
15
votes
5answers
350 views

Partitioning a list when the cumulative sum exceeds 1

I have a long list of say 1 million Uniform(0,1) random numbers, such as: dat = {0.71, 0.685, 0.16, 0.82, 0.73, 0.44, 0.89, 0.02, 0.47, 0.65} I want to ...
1
vote
2answers
110 views

Is there the possibility to write many times a value in definite list of file1.nb?

The commands testData = RandomReal[{0, 1}, {1, 1}]; Export["C:\\Users\\Alex\\Desktop\\1\\file1.nb", testData]; write the “testData” (value generated by ...
2
votes
1answer
69 views

How to make image3d smaller? Is `ImageResolution` useful?

I want to make the output of Image3D much smaller. For example ...
1
vote
1answer
31 views

ContourIntegral keyword

In version 10.1 ContourIntegral seems to be a keyword as it appears in the completion box. However, one cannot access to the documentation page by pressing "F1". Does anyone know what is it for?
12
votes
1answer
586 views

Can a LatticeData image be displayed in a space filled fashion

I'd like a FaceCenteredCubic image as in the in LatticeData docs, but space packed, and cropped on all the boundaries, so that it illustrates the geometry of the calculation that leads to the ...
5
votes
4answers
436 views

Entropy[…] doesn't calculate the entropy of a probability distribution? What does it do?

I know the definition of entropy of a probability distribution: $$H = - \sum_i p_i \log p_i $$ So for example, in a Bernoulli distribution with $p = 0.2$, $1-p=0.8$, the entropy is $0.5$. However, ...
7
votes
1answer
123 views

Why is Random faster than RandomReal?

As of version 6, Random[] was superseded by RandomReal[ ] etc, but both still work perfectly well. Playing with some timing ...
4
votes
1answer
141 views

How do I plot a space curve as a ribbon?

I know Mathematica has a built in Tube function, but I want to be able to change the parameters of a ribbon and visualize that. Is this possible? How do I do this? ...
4
votes
2answers
108 views

How to draw a moving point with time?

I am new to Mathematica. Try to draw a point moving with time. Like at t=0, a point is at p1(coordinates are random numbers); at t=1, this point is at p2. And there is always ONE point on the graph. ...
3
votes
1answer
116 views

Plotting function with unique symbols [on hold]

I would like to plot a function which involves multiple symbols created using Unique. Consider the following simple example. ...
2
votes
0answers
30 views

NDeigensystem returns error due to mesh discretization when calculating vibrations of a cantilever

There was an transcription error in the code I provided in a previous post: NDeigensystem returns complex non-hermitian error for the calculation of vibrations of a cantilever This resulted in it ...
5
votes
0answers
110 views

Unexpected behavior from Indexed

I was going to include Indexed in this answer, thinking that it operated much as a List-only ...
3
votes
2answers
76 views

Why some alpha + Evaluate return Pod, some return only return an Entity?

Why some alpha + Evaluate return Pod, some return only return an Entity? Here is an example One guess is some direct match/index will return a Entity, if with some NLP of Input, then will return ...
3
votes
1answer
70 views

I want to compute the derivative of Black and Scholes option

Good evening to everybody, my question is about computing the derivative of a Black and Scholes option and to draw it. My code is ...
1
vote
1answer
47 views
6
votes
5answers
168 views

How to generate two group of $n$ random numbers in $U(0,1)$ such that sum of these two groups equal? [on hold]

I want to have two groups of $n$ random numbers $u_i$ and $v_i$ in $U(0,1)$, such that $\sum u_i = \sum v_i$ What I tried is: I can firstly get $u_i$ by ...
7
votes
6answers
226 views

Combinations of multiple matching patterns

I wonder if there is any nice way to combine DownValues (or any other suitable rule-/pattern-/function -based Mathematica construct) when multiple patterns match an expression. Let me explain what I ...
10
votes
6answers
277 views

Split according to List and apply rule

I have a list which looks some thing like this {a1, a2, a3, a4, a5, a6, a7, a8, a9, a10} Now I want to split it according to lengths ...
36
votes
4answers
2k views

Compiling more functions that don't call MainEvaluate

I would like to use Compile with functions defined outside Compile. For example if I have the two basic functions ...
395
votes
15answers
88k 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 ...
-1
votes
0answers
44 views

Creating Vector Field Plots for an Implicit Equation [on hold]

I am having difficulty creating a vector field plot for the implicit equation Log[(2x-1)/(x-1)] == t (* Did your best to use Mathematica syntax *) Where ...
6
votes
1answer
129 views

What kind of Arnoldi method is used in Mathematica?

Can someone give me a bit more information about what mathematical method Mathematica is using, (preconditioner, filtering-restarting, deflation) in the Lanczos implementation when I input something ...
9
votes
4answers
165 views

Evaluation of Alternatives

I recently stumbled upon a few examples that suggest patterns containing Alternatives do not evaluate for individual alternatives. For example: ...
5
votes
2answers
60 views

How to define a complicated function inside the body of Compile?

I want to compile a function in a way to keep its memory footprint down. In the example below, I am trying to compile a function f that makes three calls to ...
0
votes
0answers
43 views

Why doesn't mathematica evaluate the cells?

I have the following code in mathematica. Everything was ok and I was simplifying but suddenly mathematica crashed and after that it seems that it doesn't evaluate the functions. ...
5
votes
2answers
48 views

Why ParallelEvaluate[x = 0; {$KernelID, Dynamic[x]}] returns {{1,x},{2,x}}?

I'd expect that ParallelEvaluate[x = 0; {$KernelID, Dynamic[x]}] returns {{1, 0}, {2, 0}}, and that if in a parallel ...
0
votes
0answers
40 views

Unable to plot higher order polynomial equation using NSolve and contourplot

I have a polynomial equation in 'a,b' and I am trying to plot a curve between 'a' and 'b'. Both NSolve and ContourPlot works well upto 'a=15' , but after that the plot has scattered points. Is this ...

15 30 50 per page