12
votes
3answers
1k views

Remove redundant dependencies from a directed acyclic graph

Given a directed acyclic graph, I want to remove all the edges $v_i \rightarrow v_j$ if $v_j$ is reachable from $v_i$ by some other path. Given the rich set of graph algorithms in Mathematica, what is ...
18
votes
1answer
834 views

Calling Mathematica from Visual Studio - example

I am trying to set up a connection between Visual Studio 10 and Mathematica 8.0 on a Windows system. I found several sources of information on the Wolfram website, but I get entirely lost. Most of the ...
3
votes
0answers
100 views

Stylesheet modifications mimicking Stack Exchange styles

I find myself frequently highlighting and formatting portions of text cells in a Mathematica notebook. Bold and Italic typesetting is easy to handle but I would like to use ...
1
vote
0answers
83 views

Getting InputStream errors when including a call to ElementData within an Import definition

So I am writing an ImportExport converter for a common chemistry file format, and I've run up against a problem that seems to be about shared streams and whatnot. ...
2
votes
3answers
208 views

How to code the following product?

I am trying to examine the properties of the following product for a given tuple $\vec \lambda = (\lambda_1, \lambda_2, \dots, \lambda_n)$, then the product is as follows: $$ \dim \Gamma_\lambda = \...
5
votes
1answer
149 views
8
votes
3answers
980 views

Can Mathematica solve this sort of functional/differential equation?

I am looking for differentiable functions $f$ from the unit interval to itself that satisfy the following equation $\forall\:p \in \left( 0,1 \right)$: $$1-p-f(f(p))-f(p)f'(f(p))=0$$ Is there a way ...
2
votes
3answers
602 views

Outputting a fraction on one line with an oblique division sign

How can I make Mathematica output a fraction as x/2 as opposed to the x on top with a horizontal bar and ...
4
votes
3answers
254 views

Why the inequality does not take into account the domain?

I have this inequality: Reduce[(4000-1000k)/(k-4) < 0] and the answer is k ∈ Reals I would expect ...
5
votes
2answers
140 views

Why does MakeBoxes mess up RowBox ordering?

When I use RowBox for MakeBoxes the order of the elements is changed for TraditionalForm, if there is a plus (+) in the list of elements. ...
11
votes
2answers
653 views

Why is ParallelMap way slower than Map

I recently tried to use ParallelMap instead of Map and to my surprise encountered that ...
6
votes
1answer
213 views

Custom display format for custom operator

I've tried searching here and in the WRI documentation, but I haven't found what I'm looking for in either place. I'm defining a dx operator to act as a ...
14
votes
6answers
853 views

How to correct my code for solving the Josephus problem?

Problem Decription Recently, I have been reading the book Schaum's Outline of Mathematica (2nd Edition), where I encounted the problem: Flavius Josephus was a Jewish historian of the first ...
11
votes
2answers
1k views

How to improve the accuracy of this Monte Carlo simulation

A friend of mine went on an interview and he was asked to calculate the angle between the hour hand and minute hand of an analog clock when the time was 3:15. Arguably, this is a trivial problem that ...
8
votes
7answers
1k views

Better code to find Narcissistic number

My code finding Narcissistic numbers is not that slow, but it's not in functional style and lacks flexibility: if $n \neq 7$, I have to rewrite my code. Could you give some good advice? ...
7
votes
4answers
319 views

How do I find the number of countries that have a type of industry?

I am trying to find the number of countries that have a certain type of industry. Currently, I have this code: ...
18
votes
2answers
4k views

What's the correct way to shift zero frequency to the center of a Fourier Transform?

I'm trying to apply a Fourier transform of a one dimensional list of a time history of some quantity using the Fourier function. I'm interested in the frequency ...
0
votes
1answer
170 views

Better way to evaluate integral containing Boolean function

I am trying to compute the integral ...
1
vote
2answers
868 views

Classification of a linear system of equations with a parameter

I need to get every possible value of k that returns infinite number of solutions or no solution to this system: ...
0
votes
4answers
76 views

Don't understand why Do-loop index is not evaluated in Play expression

So here is some weird behavior: When I create a list inside a loop whose elements are Play functions, with arguments that depend on the counter, it is as if the counter is being stored symbolically, ...
4
votes
3answers
239 views

Long waiting time for computing a summation

It takes a long time to compute the summation below, and I'd like to know if there are alternative ways to compute things faster. When replacing $15$ by $\infty$, then I should get $3^{1/3}$. I need ...
2
votes
2answers
283 views

Transform Piecewise[] into sum of indicators

I'm interested in transforming a piecewise defined function into a sum of indicator functions, ultimately with the aim to be better able to integrate them. As an example I would like to transform the ...
5
votes
1answer
2k views

Continuous wavelet transform with complex Morlet function

The complex Morlet function is defined as: $$Ψ(t,f_c,f_b)= \frac{1}{\sqrt[]{ \pi f_{b} } }\exp(-t^2/f_b)\exp(\jmath 2πf_ct)$$ where $f_b$ and $f_c$ are two important parameters in modifying the ...
0
votes
1answer
398 views

Do loop - variable does not change [duplicate]

I got the follwing code which should add a '1' 100 times to an empty list. plotVals = {} Do[Append[plotVals, 1], {l, 1, Nmax}]; The output is again an empty ...
15
votes
1answer
2k views

Numerical solution of coupled ODEs with boundary conditions

I have to solve the following set of ODEs and just can't get good results using Mathematica $$ r\frac{d}{dr}\left(\frac{1}{r}\frac{d}{dr}A(r)\right)-\xi^2F(r)^2\left(A(r)-1\right)=0 $$ $$ \frac{1}{r}\...
13
votes
10answers
741 views

Counting sublists containing 0

Given a list: data = {{0, 2}, {0, 0}, {1, 0}, {1, 2}, {2, 3}}. I would like to count the number of sublists which contain zero. ...
0
votes
1answer
473 views

How to read image files in Analyze 7.5 format?

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 ...
2
votes
2answers
183 views

Keep order of mulciplication in Matrix production

{{λ 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{...
1
vote
1answer
57 views

Am I missing something in this integral?

I am trying to solve this simple integral: ...
3
votes
2answers
387 views

How does Accumulate work?

Accumulate can be used to compute the partial sums of a list. The partial sums can also be computed using a For loop but this ...
4
votes
2answers
728 views

Learning from Michael Trott's Guidebook with V8 or later

I am not sure this question is suitable for this site. Please let me know if my question is too vague or if it is hard to give a clear anwser. I'm a new user of Mathematica. My Mathematica use began ...
6
votes
2answers
140 views

Running MathKernel from Emacs brings cursor to end of line

When I start MathKernel from the Emacs shell, there are always extra spaces inserted so the cursor goes to the far right side of ...
0
votes
1answer
228 views

How to combine two usages of # into one and speed up the code?

I have a function num with two variables, matf and matg. How can I combine the last two lines of code below into one? The code is aimed to find out the maxiaml count bel when we give each $i3 = 1,\...
1
vote
1answer
181 views

Problem with GlobalClusteringCoefficient

I have a simple problem, I would like to measure the global clustering coefficient for a random graph. Here is my code: ...
-1
votes
1answer
778 views

How to remove the background noise from a single sound file? [duplicate]

I wandering if the following steps are practical or not? Import a sound in wav format, if not (for example, mathematica does not support ...
1
vote
1answer
1k views

Want more vibrant colors in plots

Is it possible to create plots that have vibrant colors like those I create in Python? For instance, take this thread function returning 0 where I used rainbow and here is the temperature gradient: ...
0
votes
1answer
133 views

Curve Fitting Errors

I am trying to fit a part of a dataset to the function $$ae^{-b\sqrt{x-c}}$$. My friend was using GNUPlot to this and got reasonably good results. However when I try to this with Mathematica : ...
3
votes
2answers
219 views

CustomTicks - Changing NumberPoint -> “,”

How can I change the number point from . to , in CustomTicks ? The Mathematica built-in ...
-1
votes
1answer
136 views

Plotting a function that uses the solutions to a system of differential equations

I am trying to draw a plot by using the solution of differential equations ...
5
votes
1answer
765 views

ReadList can't read from file containing high-precision Reals

I want to read a file which contains seven columns of real numbers. Mathematica seems to have a problem with the high precision I need. My code: ...
5
votes
1answer
393 views

Use Pattern with Vectors in Assumptions

I had a problem using Pattern with Vectors in Assumptions. Here's how I use ...
1
vote
1answer
249 views

function returning 0

Why is my function returning 0? ...
7
votes
2answers
784 views

Adjusting Density Plot Color Function for Diffraction Simulation

I'm trying to simulate Fraunhofer diffraction by a single slit using DensityPlot I run the code: ...
13
votes
1answer
757 views

Ellipse counting from image

I have hundreds of images similar to this image: I'm looking to count the number of ellipses as well as their major and minor diameters. The ellipses are touching, hence, ...
0
votes
1answer
1k views

Ellipsoid in spherical cordinates

I am trying to plot in spherical coordinates the ellipsoid defined as $$(x/3a)^2+(y/2a)^2+(z/4c)^2=1$$ This is my code: ...
3
votes
0answers
324 views

Exported PDF figure looks different in Apple's Preview than in Adobe PDF Reader

I'm trying to export figures into pdf, and the results looks good in Preview, but very bad in Adobe pdf reader. I'm using Mathematica version 8 on Mac 10.8.5. The Preview version is 6.0.1 (765.6) and ...
1
vote
1answer
97 views

Issues with creating functions [duplicate]

Sometimes when I try to create a function inside a function, Mathematica gives me a hard time. I usually just have to play around with the syntax until it gets something it "likes" but I really have ...
10
votes
8answers
1k views

Position of First nonzero number

I want to know is there any one line code to find position of first nonzero number without calculating position of all non zero numbers. For example, ...
12
votes
4answers
382 views

How to replace every possible $A+B$ and $AB$ in expansion of $(A+B)^{10}-A^{10}-B^{10}$ with $x$ and $y$, respectively?

I would like to replace every possible $A+B$ and $AB$ in expansion of $(A+B)^{10}-A^{10}-B^{10}$ with $x$ and $y$, respectively. How to do it with the simplest code in Mathematica? For example, \...
1
vote
1answer
451 views

Solve a total derivative - independent vs. dependent variables

I am trying to force mathematica to solve a generally defined function for d lp: In a reduced version, w depends on l2, ...

15 30 50 per page