# All Questions

167 views

### Probablity weighted ReplaceAll

I'm looking for an elegant way of doing a probability weighted replacement rule, something like this f[x_] := x /. {1,2,3,4} -> {50%{ 4,3,2,1} ,50%{1,3,2,4}} ...
406 views

### Given f[1] … f[k], k = 1, 2, 3… how do one find the general function f[n]?

If I have that ...
169 views

Consider replacing head of List by head Association: {a -> x, b -> y, c -> z} /. List -> Association (*<|a -> x, b -> y, c -> z|>*) ...
144 views

### Operator-Input Form for Lists?

The documentation on Operator-Input Forms shows the following example which suggests that there is an alternative, convenient, operator-style, tidy technique for inputting lists. However, there is ...
917 views

### Can NDSolve handle discountinuos data?

It is possible to numerically solve a differential equation if not-smooth data are involved? For example the following instruction return the error NDSolve::bvdisc: ...
267 views

### Backslash commands in strings?

I discovered by playing around that Text[DisplayForm@SubscriptBox["\[Lambda]", "k"]] produces the same result as ...
348 views

### Is there a faster way to Map an Association?

Consider mapping an existing Association in a manner such as this: ...
53 views

### Automatic substitution of fractions

I have several equations with many variables, and here and there I would like to do a variable substitution. For example, in the equation: a (b + 42 c / d) I ...
171 views

### Which function definition is used to evaluate an expression that matches the lefthand side of more than one definition?

In a case like this: f[a_] := a; f[{a_, b_}] := a; I'm wondering whether I should expect f[{2, 3}] to return ...
351 views

### Testing Credit Usage in Wolfram Programming Cloud

I currently have a free WPC account, which I am using for testing purposes. Amongst other things, I want to find out more about how the credit system works, in particular how many credits are used, ...
63 views

### Unique CellID in-between notebooks

Documentation says that CellID is guaranteed to be unique for a given notebook. I've noticed that CellID are fairly high numbers and although probabilistically speaking the odds of coincidence are low,...
119 views

### Black line after ImageTrim

as shown in Image correlation I would like to detect the shift between a stack of images. Here are the images: and here the code: ...
973 views

### How do I exclude the vertical line plotted at a discontinuity?

Condsider function = Tan[1 x] + Tan[2 x] Plot[function, {x, 0, 1.5}] It has a strong discontinuity around 0.8. The problem is , if I want to find ...
126 views

### How do I plot a U- form cylinder

I'm really new to Mathematica, trying to learn some things, but I need help trying to plot this kind of cylinder, a U tube like cylinder. Tried to use an example code like this, and then vary some ...
175 views

### How to get a list of all expressions in a notebook matching a certain pattern?

Suppose I have a Mathematica notebook saved to a certain location on disk. Given a pattern I need to get the list of all expressions matching this pattern that appear in input, output or print cells ...
187 views

### Improving the speed of evaluating Table with nested functions

I am a Mathematica novice working with a stack of 1024 x 1024 WatershedComponents (or MorphologicalComponents) label matrices ...
88 views

### Inconsistency of output format in Eigenvalue

I am bothered by the output format of the last two elements of efre. Is there a way to make these two look like the same format as the first two in ...
392 views

### “NotAvailable” and “NotApplicable” data points returned by WeatherData[]

I am trying to use ListVectorPlot in combination with WeatherData and CountryData to show ...
454 views

### Providing a color function for ListPointPlot3D

Is there a way to write ListPointPlot3D expression, so when given a list of points, the the color of the points plotted is a function of the index/element number of ...
618 views

### Converting a nested for loop from MATLAB

In MATLAB I have the following series of nested for loops that update a matrix. (It's not my code, but someone else's that I'm trying to replicate - I don't know ...
444 views

### Deploying to the Cloud for Public Access

Note: Fixed sometime around the 18th of August 2014. Bug present from the release of 10.0.0. until then. I wanted to test how a simple deployed program would appear to a non-mathematica user. I ...
79 views

### Conditions in SparseArray

I got confused by {i_, j_} /; in the following code. I didn't see an explanation in the SparseArray documentation. Can anyone ...
461 views

### Calculate geo location based on distance from other locations

Given a list of entities (or GeoPositions) and their distances from a particular location, how do I find that location's ...
641 views

### Fast method to select matrix elements based on a vector of positions

There is an operation for which I have long wanted to find a better solution. Let: a be a matrix of dimensions $m\times n$ v...
150 views

### eccentric anomaly expansion equation

I try to use this simple algorithm (paper) to calculate the Eccentric Anomaly expansion: ...
318 views

### Partial Differential Equation in Parallel

is there any native way to implement multi-core parallel solving of PDE in Wolfram Mathematica? WM 10 now supports Finite Elements Method, but it is actually useless without parallelization. Usually ...
234 views

### Zero-order interpolation not going fully around

Connected to this question, I want to do a zero-order interpolation of a bunch of datapoints which is periodic. The code I use is as follows: ...
261 views

### TrueQ returning False on true statement

Why does TrueQ return False on the following? TrueQ[Log[2]/Log[8] == 1/3] (* False *) ...
47 views

### How to correctly use PatternTest (?) [duplicate]

This works fine: {3, -5, 2, 7, -6, 3} /. x_ /; x < 0 :> 0 (*{3, 0, 2, 7, 0, 3}*) and this works fine: ...
130 views

### Utility information using FindGeoLocation in Ver.10

It is possible for some commuters to track the location of their bus, train or tram through a personalised GPS tracking device (e.g.see http://www.adelaidenow.com.au/news/south-australia/new-...
412 views

### How can I mend this broken heart?

Try to evaluate the following code: ...
456 views

### How to slice TimeSeries data?

When retrieving curated data, v10 now returns TimeSeries objects. For example, ...
351 views

### Geographic background containing both outlines and contours: how?

I would like to create a map which will show lakes and rivers together with elevation contours and contour labels. What is the simplest way to do this with ...
267 views

### how to write TableForm expression into file?

Now I have a list stored in data as follows data = {{"Ca", 1, 1, 1}, {"Ca", 2, 2, 2}, {"Ca", 3, 3, 3}} the ...
48 views

### How to avoid joining MathieuCharacteristicA in a plot? [duplicate]

In the documentation As a function of the first argument, MathieuCharacteristicA is a piecewise continuous function So how to avoid joining different pieces of the function? For example, <...
113 views

### Changing the data indices for a large dataset plotted with ContourPlot

I have a large (square) dataset that I am plotting with ListContourPlot ... The data is 128x128 -- without coordinates for each point. I.e. - {{0,0,1,0,...,0},{0,2,1,1,...,1},...{3,1,1,1,...,2}} So ...
59 views

### Asymptotic expansion on 3 nonlinear ordinary differential equations

The 3 nonlinear differential equations are as follows $$\epsilon \frac{dc}{dt}=\alpha I + \ c (-K_F - K_D-K_N s-K_P(1-q)), \nonumber$$ \frac{ds}{dt}= \...
358 views

### Sqrt disappeared when exporting plot to PDF in version 10

Bug introduced in 10.0.1 or 10.0.2 and fixed in 10.1.0 In version 10, if we plot with Sqrt in y-axis, and export to PDF, the square root disappears in the PDF ...
186 views

### NDSolve: EventAction list specification using Table fails

I have an NDSolve problem that needs a list of a large number of events that are generated programmatically. Here is a simple example that demonstrates the problem on Mathematica 7 and 8 (the versions ...
315 views

### Create a list of random reals

How can I create a list of random pairs $(x,y)$ where $0<y<x<1$ and $x,y \in \mathbb{R}$ ? I can't seem to place that inequality restriction on the random numbers that are generated.
197 views

### One ChartLegend for multiple charts in Dataset?

Dataset's documentation shows how to leverage GroupBy operator at multiple levels ...
60 views

### Can I use what “headerlines” removes from a CSV as TableHeadings for the table I create from that File?

I am reading in some data from a CSV file that has a line which gives titles to each "column". Here is an example: ...
105 views

### Result of Integrate depends on order of integration although the domain is rectangular

The following: ...
174 views

### Simplifying a symbolic product of rational powers

I'm trying to symbolically evaluate a lot of equations that can consist of up to 10 parameters. The form of these expressions is a product/quotient of rational powers of the mentioned parameters, ...
88 views

### How to read from /dev/random?

I am looking to read a few bytes from /dev/random on OS X and Linux. The simplest approach fails on both operating systems (see below). Why? What is a workaround?...
543 views

### Possible bug in Dynamic

The code below crashes the Mathematica kernel in version 10 (not in V9) every time I run it on Windows and on Mac OS. I've sent it to WRI, but was told that they could not reproduce the crash. Does ...
676 views

### How to transpose x and y axes on a LogPlot?

Consider the following simple LogPlot: LogPlot[Exp[x],{x,0,5}] Is there a nice way to switch the axes of a LogPlot? I'm aware that plotting the inverse ...
708 views

### Extrude 2D cross-section to 3D shape with shrinkfactor

I would like to create a 3D shape from extrusion and scaling of a 2D contour. The 2D contour that I have looks like this: and it consists of a bunch of points (here plotted with ...
The PDE that I want to solve is:  \frac{\partial f}{\partial t} + \frac{1}{m} \left( p_x \frac{\partial f}{\partial x} + p_y \frac{\partial f}{\partial y} + p_z \frac{\partial f}{\partial z} \right) ...