16
votes
2answers
153 views

Dataset vs an association of associations

Associations with a record structure (e.g., a flat table) can be organised in one of two main ways. First as a list of associations, which is also used in the case of Mathematica's data set ...
0
votes
0answers
10 views

Random non-overlapping disks in a square

I've found a nice code snippet from this place (last code on that page), that I'll reproduce here for reference : Plotting random circles in a square ...
0
votes
0answers
5 views

Can someone tell me what mr is in the following code? [migrated]

I found this algorithm to convert a rotation matrix into a quaternion but i can't seem to understand which matrix mr is? If mr is the rotation matrix then what is mat? ...
1
vote
0answers
22 views

Performing a convolution for smoothing a function

I want to smooth a one-dimensional oscillating function by convolving it with another function that I'll call the screening function. The screening function has a trapezoidal form and goes to zero ...
68
votes
5answers
5k views

Minimal effort method for integrating C++ functions into Mathematica

As of Mathematica 8, what is the minimal effort way to integrate an existing C++ function into Mathematica? I think we have these: MathLink (it was quite long ago I used it last time) communication ...
0
votes
0answers
21 views

Linking to C++ files

I have written mathematica file that does manipulations on a certain set of points. I would like to access code that someone else has written for a least square fit in C++. How do I access this C++ ...
8
votes
2answers
646 views

How to sort colors properly?

I can't seem to be able to sort colors by their hue and perceptual brightness correctly. Here's my current solution but it's not right, there are all these dark bands: ...
1
vote
1answer
27 views

How do I extract units from an expression

I need to take the units off of this expression: (5 Coulomb)/(6 Second) In order to do some unit simplification. Is there any way to do this? I have tried Case, but could not get it to work ...
1
vote
1answer
29 views

Solving a transcendental equation

I want to solve the a transcendental equation, e.g. NSolve[-(1-x)*Log[1-x] - x*Log[x] == 0.5, x] Mathematica is not able to solve, wheres WolframAlpha -- is able ...
2
votes
1answer
14 views

Set control “A” to a specific value if control “B” is ever changed (Manipulate)?

I've had trouble with this and issues similar to this in the past, where I need to track when a controlled variable is changed. Basically I have two Sliders (call ...
1
vote
0answers
23 views

Converting a quantity to a decimal form

I have a function giving me this: (5 Coulomb)/(6 Second) as output. I want this in decimal form and would like to have the variables taken off the end for unit ...
3
votes
2answers
35 views

How to use locally scoped dynamic variables in Manipulate for expression and control parameters

I have a Manipulate that has dynamic variables that I want to use in the displayed expression and use in the parameters for the manipulate controls. I only ...
11
votes
1answer
142 views

What's wrong with Simplify and FullSimplify?

I have a quite complex list of equations and inequalities I combine to a boundary condition for my cost function. After investigation of two days I found the bug (I really name it a bug!). One of my ...
0
votes
1answer
89 views

How can I solve the sum with two unknowns?

I have the following code description ...
1
vote
0answers
71 views

Alternative to use a function as an argument in Compile

I am currently working on problems that require the use of functions such as : ...
1
vote
1answer
42 views

Reduce Inequality

How can I reduce the inequality in terms of modulus of alpha. ...
2
votes
3answers
115 views

Efficiently test membership for a list of values

I have two lists: excluded and values. I would like to efficiently determine whether ...
2
votes
2answers
133 views

Fitting - Exponential

I'm trying to fit the following data using Mathematica, but unfortunately im not getting any decent results. ...
2
votes
2answers
100 views

How to declare a function as real in order to get rid of Conjugate in front of the expressions?

I have a complicated complex function containing some other ones that are real, f=f(A,B,C,...) ,where A=A(r) and it is real, for ...
2
votes
2answers
258 views

How I can integrate $\int_0^{a} x e^{-\frac{b^2 x^2}{2 c}} J_0(n x) dx$?

How can I get a solution to the integral given below ? $\quad \quad \int_0^{a} x e^{-\frac{b^2 x^2}{2 c}} J_0(n x) dx$ where $a,\,b,\,c$ and $n$ are constants and $J_0$ is a Bessel function of the ...
0
votes
1answer
41 views

If statement for evaluating small values

I have a simple calculation which I am trying to use if condition to evaluate summation of some values, here's a code; ...
1
vote
1answer
68 views

Implicit derivatives in one line. How do I do it?

I have this little script to derive implicitly $PrePrint = # /. {D[y_, x_, NonConstants -> {y_}] :> y'[x]} &; Example: ...
0
votes
1answer
42 views

Write a function pollard[n, B] that tries to factor an integer n, using Pollard's p − 1 method with at most B iterations

This is what I got but it seems it's not working. When I test it, it just goes through and nothing gets returned. Is there something I'm missing? ...
6
votes
1answer
87 views

Is there a practical way to define a default value for missing keys in an Association?

It can be very useful to define background or default value for an object that can be incremented or otherwise modified. A simple (and for me, common) use is a counter: ...
2
votes
4answers
98 views

ToExpression in Manipulate

lets take this small example code: Manipulate[Plot[Sin[x (1 + a* x)], {x, 0, 6}], {a, 0, 100}, Button["a=90", ToExpression["a=90"]]] By clicking the button I ...
0
votes
1answer
29 views

How to get DistributionChart to show normalised densities?

I am having some issue getting DistributionChart to show bin widths as expected, or perhaps it is in my interpretation of the plots. I have four data sets, all of the same length, and plot them in ...
13
votes
0answers
135 views
+50

How can I smooth a 3D surface generated by RegionBoundary?

I have a set of points that belong to the surface of an object. I would like to approximate a surface to which I can compute the distance. of other points. With the nice code of this post, I was able ...
0
votes
1answer
115 views

Scatter Plot of Lists

This is very similar to Make a scatter plot from two lists I have executed a = Import["file.csv"] b = Import["file2.csv"] and now have a {{1,2,3}} and b ...
1
vote
1answer
74 views

Better way to binarize an image

I have an image: pic = Import[ "http://note.youdao.com/yws/public/resource/\ 2c5a562224240edcf1631fcd39810f56/55FA538207424C0A98AB548724994AE1"] that I ...
0
votes
0answers
61 views

PDE with Laplacian time derivative term

Using Mathematica 9 I am trying to solve the 2D PDE: c1*Laplacian[-u[x,y,t],{x,y}] + c2*D[Laplacian[-u[x,y,t],{x,y}],t] == 0 (Eq.1) with time-dependent Dirichlet ...
8
votes
3answers
224 views
4
votes
2answers
186 views

What is the idiomatic way to shift and extend a list by a number of elements?

I have a lists, list, and want shift it right by a given number of elements, m, extending the list by repeating the last ...
1
vote
2answers
43 views

How to delete blank valued keys from nested association?

Considering we have: acs = <|"A" -> <|"a" -> " ", "aa" -> "asd"|>, "B" -> <|"bb" -> " "|>|> How can we come to have a result ...
5
votes
3answers
133 views

Finding the conditions for degenerate solutions to a cubic equation

I have a cubic equation (corresponding to the band structure of a physical system) given by w in the code below. ...
0
votes
0answers
20 views

How to make 3D error bars in a plot? [duplicate]

if I have the following data in this format and the error bars are the same for each point: ...
78
votes
6answers
7k views

Generating visually pleasing circle packs

EDIT: (my conclusion and thank you note) I want to thank you all guys for this unexpected intellectual and artistic journey. Hope you had fun and enjoyed it the same as I did. I would like to ...
1
vote
2answers
103 views

Are variables always assumed to be real in Jordan Decomposition?

If you give the Input in Mathematica 9.0 (Student Edition) JordanDecomposition /@ ({{1, #}, {#, -1}} & /@ {i, I}) Mathematica gives you two completely ...
0
votes
0answers
12 views

Comparing association using MatchQ [duplicate]

For me below query results into False.I expect it to return True. ...
1
vote
1answer
39 views
+50

How to access timings of each individual test in a TestReport?

I want to know how long each VerificationTest took to complete in the test report, so see which one was the longest and do some statistics on them: ...
1
vote
0answers
34 views

How to solve a nonlinear overdetermined system of equations

i'm trying to solve a nonlinear overdetermined system of equations (124 equations, 123 variables) i tried this procedure (newton raphson) ...
3
votes
2answers
58 views

Retaining relative sizes of local maxima using MaxDetect[List]

I would like to be able to find the position of the two greatest local maxima in a list. For the example: list={1,2,3,4,2,1,2,6,5,4,3,2,} I would like to return ...
11
votes
3answers
474 views

How to speed up Colorize

I have a list of about 500 images similar to the following: A = Import["http://i.stack.imgur.com/1bV4O.png"] ...
6
votes
0answers
101 views
+50

NMinimize with NIntegrate (crash in symbolic evaluation, memory leak)

This is a "common" problem from what I've seen, but with a different spin. I have a function I use often that finds a fit of an expression to another expression with some free parameters (e.g. for ...
0
votes
1answer
51 views

Solving a linear differential equation [on hold]

I have been following examples in an introduction to mathematica. But the following example regarding a linear differential equation does not work: ...
3
votes
0answers
15 views

Declare new “Form” wrapper and avoid this wrapper being recorded in Out[…] [duplicate]

When I input {{1,0},{0,1}} // MatrixForm and then m = %;, the value that m takes is the ...
0
votes
0answers
30 views

what the meaning of subscript in matrix below? [on hold]

${-, 0, 0, 0, 0, 0, -((b 1 (1 (n-n 1)-a 2 (-1+2)))/(n ))}, {0, -, 0, 0, - Subscript(1,0)[(n 1 1+a 2 2)/(+),0], 0, -((b  2 (n 1 1+a 2 2))/(n  (+)))}, {0, 0, -g-, 0, 0, 0, (b ...
2
votes
2answers
93 views

How to restrict the motion of a Manipulate-generated Locator along a line?

If one uses a stand-alone locator and needs it to only be movable along a curve, say, defined by a function f[x], one can use a simple construct: ...

15 30 50 per page