8
votes
2answers
612 views

Mathematica rule substitution memory

First I present the specific programming question, and then I provide further background details. Given an expression in Mathematica, say f=3x+7y, there are two ...
8
votes
4answers
798 views

Automatically counting the number of lines of code in a set of notebooks

How can I automatically count the number of lines of code "Input" existing inside all the notebook files contained in a specified folder? I know there is the issue of considering or not the automatic ...
7
votes
2answers
220 views

Why do I get a different value when I change the order of integration?

I think the following two-dimensional integrals should be equal, since they both integrate the function over the half plane defined by $t>\tau$. $$\int_{-\infty}^\infty \mathrm{d}t ...
7
votes
2answers
165 views

How to un-eat memory?

Consider this code: ...
7
votes
4answers
252 views

How to make Mathematica simplify $\cos[(i + j + k)\pi]$ to $(-1)^{i+j+k}$?

We know that: $$ \cos\left[(i+j+k)\pi\right] = (-1)^{i+j+k} $$ for $i, j, k$ being positive integers. In Mathematica I've tried: ...
7
votes
3answers
301 views

How do I create a histogram with unequal bin widths?

I would like to create a histogram for human population by age, but the $2010$ census data I have available is for five uneven cohorts: ages $0$-$17$, $18$-$24$, $25$-$44$, $45$-$64$, and $65+$. My ...
7
votes
2answers
155 views

How do I define an argument pattern for a Head of NOT a given value?

I want to define a function f with an argument that matches only when an argument Head is NOT of a given value. I know I can define a pattern that matches the Head for an argument: ...
7
votes
2answers
1k views

Labeling points of intersection between plots

There are several answers where Mathematica used mesh points to show graphically where curve intersections exist. For example: Marking points of intersection between two curves or Is there a better ...
7
votes
2answers
137 views

How to ignore list elements when extracting with pattern matching

If I have a simple list, say {1, 2, 3}, and I want to extract a subset of the elements, what is the correct syntax? e.g. { i, _, j } = {1, 2, 3} I want i = 1 ...
7
votes
1answer
121 views

What should I call the messages that appear when the mouse moves over failed graphics output?

I attempted to evaluate the following Plot[x^2, {x, 1, 2}, PlotStyle -> {RGBColor[a]}] which, of course, failed. After the failure, putting my mouse over the ...
7
votes
1answer
136 views

Specifying optional arguments with variables

Perhaps this is poor programming on my part, but I would like to create a function that uses a variable as an optional parameter: var = 2; f[a_:var] := {a} The ...
7
votes
2answers
505 views
7
votes
1answer
210 views

Making FindShortestPath a little bit sloppy [duplicate]

I have a dense graph, and I'd like to find multiple "almost shortest" paths from a source vertex, $v_s$, to a sink vertex, $v_s$, on an undirected graph $G$. How can I repeatedly run ...
7
votes
1answer
159 views

How to plot inequalities taking into account that points must be integers and not reals?

I have solved with Mathematica 9 the following integer inequalities using Reduce: ...
7
votes
1answer
611 views

Normal lines to surfaces or planes in a 3D plot

How do I make the normal line to a plane actually look perpendicular? ...
7
votes
2answers
559 views

How to change an expression to Fortran90 form?

I have a large expression produced by Mathematica. To use this expression in my Fortran program I need to change it to a Fortran90 form. I am not satisfied with the ...
7
votes
1answer
125 views

Restrict access to Lightweight Grid

When using the default configuration of the Lightweight Grid Manager, anyone connected to the same internal network where the grid severs are can launch kernels on the grid. What possibilities are ...
7
votes
3answers
465 views

How can I get a running sum for a list?

I've got following data I'm reading from a file: ...
7
votes
1answer
211 views

Getting R textual output into Mathematica

I use Mathematica with R because I am able to keep my code and output organized with the notebook interface. Although I can get R structures into Mathematica using REvaluate, I can't figure out how to ...
7
votes
1answer
333 views

Log-scale histogram bug

Not really a question, more a solution to what I call a bug in mathematica v8(.0.0.4). I already sent a bug report to Wolfram. Problem The documentation for the Histogram-function explains the ...
7
votes
3answers
365 views

Filter list based on date

What I would like to do is remove entries from a list of instrument data when it is in maintenance. The maintenance data I have is a series of dates which look like this; ...
7
votes
3answers
389 views

How do we solve N-Rooks variation using primes?

Using a $p_n $x $p_n$ matrix, how can we solve the N-Rooks problem to find a prime in every row and column? ...
7
votes
1answer
919 views
7
votes
1answer
195 views

Is it possible to specify a context-sensitive, “depth-agnostic” rewrite rule?

I'm using the term "depth-agnostic" in this post to describe structural patterns featuring a "target" sub-pattern that can occur "at any depth" relative to one or more "context" sub-patterns. As a ...
7
votes
3answers
439 views

Specifying string patterns in DeleteCases

It seems that DeleteCases is not compatible with string patterns, at least directly (see, for example, this question). Is this true? If so, why is this the case? ...
7
votes
3answers
446 views

Is there an easy way to put time ticks on a parametric plot?

I have a parametric plot showing a path of an object in x and y (position), where each is a function of t (time), on which I would like to put a time tick, every second let's say. This would be to ...
7
votes
2answers
191 views

Internal Representation of ?name and ??name

Code FullForm[Hold[?name]] Syntax::bktmcp: Expression "Hold[?name]]" has no closing "]". Syntax::sntxi: Incomplete expression; more input is needed . Question ...
7
votes
4answers
2k views

Checking if two trigonometric expressions are equal

Say I have two trigonometric expressions which are a bit complicated. Is there a quick way to check if they reduce to the same thing (that they are equal) using Mathematica? I was solving this: $y'' ...
7
votes
3answers
218 views

Safely nesting RuleDelayed

Say I have the following, straightforward-seeming functions: ...
7
votes
3answers
418 views

Image of input and output cells is not exported correctly

Wolfram Blog uses PNG images to display input and output cells in a notebook. For example, the following is an image from Samuel Chen's post: I should be able to produce a similar image by ...
7
votes
1answer
590 views

Simplify an expression containing NonCommutativeMultiply

How does mathematica evaluate the following expression to zero: ...
7
votes
4answers
242 views

Evaluating a function using arguments from a sliding window over a list [duplicate]

Possible Duplicate: How to Map a subset of list elements to a function? I want to evaluate a function using arguments from a sliding window over a list. As an example, lets use ...
7
votes
2answers
188 views

Graph does not accept Property Options

My question is concerned with the Graph functionality, which was newly implemented in Mathematica 8. I already used GraphPlot ...
7
votes
1answer
1k views

Import DCD (CHARMM/NAMD binary trajectory) file

How can one import the coordinates stored in a binary CHARMM/NAMD DCD file? This is the structure of the file: ...
7
votes
1answer
184 views

How do I re-direct FilePrint's output?

I recently wanted to use FilePrint to print the contents somewhere else but in the notebook I was using. However, the obvious-seeming solution doesn't work at all: ...
7
votes
1answer
304 views

Setting the DifferenceOrder Option

I've been playing around with Method in NDSolve[...] and can't quite seem to figure out how to force ...
7
votes
1answer
106 views

$InputFileName backwards compatibility

What would be a good replacement for $InputFileName (which has been added recently to Mathematica 8) to achieve backwards compatibility with let's say M6 and M7? I ...
7
votes
3answers
459 views

Composition of functions

I have a number of rotations computed by rot = RotationTransform[theta, point], and I would like to compose them to produce one function that is the composition of ...
7
votes
2answers
588 views

Working with large data, pass-by-reference, compiled functions

I think I know the answer to this, but after two days of Googling, this is my last effort before going down an unwanted path... I have a function that takes lots of large data as arguments as well as ...
7
votes
1answer
181 views

DiracDelta attributes

Is there any reason why DiracDelta isn't a NumericFunction but DiracComb is? I just ate a ...
7
votes
2answers
248 views

What's the purpose of the Unique function?

As the title says: What's the purpose of Unique? I understand that it generates some unique symbol, but when and for what is it to be used? Are there applications ...
6
votes
4answers
198 views

Counting adjacent elements in a Matrix?

To start, I have a situation where I have some matrix, for example $$ A=\left[ \begin{matrix} 4&2&2&3&3\\ 2&3&1&2&3\\ 3&0&4&0&4\\ ...
6
votes
5answers
227 views

Removing reverse versions of lists from a nested list [duplicate]

I need to remove the reverse versions of lists from list of lists. I.e.: {{1,2},{2,2},{2,1},{a,1,2},{2,1,a}} I need to reduce to ...
6
votes
2answers
206 views

Inaccurate plot

Could someone please tell me how I can increase the accuracy of this plot, please? Or is there some other reason the lines are breaking up? ...
6
votes
1answer
171 views

In version 9 PlotLegends, how can I remove the strange edges that appear around LegendMarkers?

I'm running Mathematica version 9. I am using ListPlot to plot two sets of data. For each data set, I am using different ...
6
votes
3answers
140 views

Using PatternTest and/or Condition to detect equal list lengths as well as list element formats

On searching Mathematica.SE for information about overloading functions, I came across several threads about PatternTest and ...
6
votes
2answers
140 views

Looking for feedback on this function

I'm not sure this is an appropriate question; if not, I'm sure someone will close it :) I've got the following function, listed below; its job is to accept a graph (function) presented either as a ...
6
votes
1answer
275 views

Importing Excel Spreadsheet containing Array Formulas

Has anyone had any success with importing an Excel Spreadsheet holding an array formula into Mathematica? The Syntax I'm using is ...
6
votes
1answer
469 views

How can I get better control over StreamPlot?

I'm having some difficulties with the command StreamPlot in Mathematica 7.0. Here's the basic plots I'm doing : ...
6
votes
2answers
261 views

How to display the support supp(f) of a piecewise function z = f(x,y)?

I'm wondering how to display the support $\mathrm{supp}(f)$ of a piecewise surface $z = f(x,y)$. As an example, let's consider the following piecewise function (and plot it): ...

15 30 50 per page