1
vote
2answers
39 views

Label point on plot with image instead of text [on hold]

I can use this code to label my points with text. ...
-1
votes
1answer
38 views

Function for importing and plotting data from excel spreadsheet

I know this must be a very basic question, but I could not find any answers. I need to create a function that: 1) imports data from an Excel Spreadsheet, 2) assign specific information from this xlsx ...
13
votes
1answer
243 views

PlotLegends won't generate automatically more than 15 labels in v10

Update: NOT fixed in v 10.1.0 (Mar2015) While testing the examples from this recent post, i've noticed a problem in V.10 with PlotLegends when it has to ...
10
votes
0answers
103 views

Incorrect use of Scaled causes crash

Update: Fixed in 10.1.0 (OSX) Bug introduced in 8.0 and persisting through 10.0.2 While playing with Scaled, I made a syntax error which caused a crash ...
1
vote
0answers
22 views

Find region given by Exists statement

I want to find, calculate its volume and visualize the following region most efficiently: $\Gamma^\delta$ = { $\sigma$: $\exists \sigma' \in \Gamma$ with $F(\sigma,\sigma')\leq 1-\delta^2$}, where ...
4
votes
2answers
117 views

How to use FontWeight options in Mathematica 10.x

I‘m using stylesheets to create customized styles for course materials. That includes using fonts like Gill Sans, and Helvetica (Neue). Up to MMA version 9, it worked. When switching to version 10, ...
4
votes
1answer
50 views

How to use Epilog with Tradingchart

I am making a Tradingchart with data returned from Financialdata. I find I cannot add a line to the chart by giving the option ...
1
vote
3answers
102 views

Simplify a composition of functions

How do I make Mathematica simplify, for example, (1-#&)@*(1-#&) into #&? ...
7
votes
0answers
88 views

TimeConstrained[Delete[Range[1],1]] causes kernel crash

Run these two samples of code here (AFTER SAVING YOUR CURRENT WORK): Do[ TimeConstrained[ While[True, Delete[{1}, 1]; ];, 0.1];, {100}] ...
0
votes
2answers
22 views

Barlegend with a different z span for ListDensityPlot

I would like to rescale the colors in a plot and to do this in the same way for the color bar. (So this enables me to have the color bar span a (z) range larger than than the data itself.) I got this ...
2
votes
1answer
43 views

Set fontsize using setoptions not working in DateListPlot

I'm trying to use SetOptions to set the global font size for DateListPlot plots. My problem is that this is not working. Event this simple test does not change the font size: ...
1
vote
0answers
45 views

How to get Mathematica to compile with target C?

I have been trying to compile some functions in mathematica with target C for speed. basically when I try: ...
5
votes
1answer
63 views
0
votes
0answers
27 views

Statistical significance test of FindCluster

I have a list of vectors which could be roughly divided into two clusters. The list is huge so I have to use RandomChoice[list, 20000] to speed up the calculation. ...
2
votes
2answers
96 views

Filling between more than two boundaries

Here is a simple example of what I am trying to do; fill the area described by the three inequalities: $$ y \le 11 + x \label{1} \tag{1}$$ $$ y \le 27 - x \tag{2}$$ $$ y \le ...
1
vote
1answer
50 views

FindFit returns “tensors have incompatible shapes”

I'm trying to fit experimental data with FindFit and implicitly calculated function. It seems, that function works fine and satisfactorily approximates data when parameters are fed manually. However ...
12
votes
3answers
620 views

How to capitalize the first letter of each word in a string

The following examples only work for the first character of the whole string, but not of words. ...
2
votes
2answers
70 views
1
vote
2answers
100 views

Minimizing the largest difference between two functions

I have two functions defined on the same domain, $f(x)$ and $g(x)$ where $x$ is in $(0,1)$: f[x_] := (-1 + x) Log[1 - x] - x Log[x] g[x_] := Log[1 + 2 (-1 + x) x] ...
3
votes
1answer
139 views

How to enforce mathematica to analytically evaluate roots?

I am interested in simplifying expressions involving HeavisideTheta. A simple example could be: HeavisideTheta[1 + x - x^2 + x^3] The best I can achieve is with ...
0
votes
0answers
21 views

save as pdf output appears really narrow and has many pages

If I attempt 'save as' pdf I sometimes (but not always) get really narrow output, resulting in many pages of output. Notice how little text ends up on the page. I can't see any settings that I've ...
1
vote
1answer
51 views

Counting and updating a subset of matrix

I have an n by n matrix and would like to count the number of sub-matrices that is equal to a given matrix. Here is my code: DWBCL creates a matrix with elements a1, a2 and c2 in it and DWBCH with b1, ...
5
votes
1answer
157 views

Extra spaces when exporting strings into pdf (bug, linux)

Rationale: Imagine you would like to create a publication quality figure in Mathematica, from under Linux. Naturally, it will contain text/labels. Problem: Here is a simple string ...
0
votes
0answers
80 views

How to calculate the approximate entropy of a list of data? [on hold]

I've borrowed code from a website, because I do not know how to program in Mathematica. (Approximate Entropy (ApEn) is a popular tool in analysing the complexity of time series data especially in ...
3
votes
1answer
81 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 ...
6
votes
6answers
206 views

How to check if two nested lists have the same structure?

How can I check if nested lists like these have the same structure: ...
0
votes
1answer
173 views

Integration of linked PDFs over probability simplex

I'm trying to integrate the following expression: f[a1,p1+p2+p3+p4]*f[a2,p2+p3+p4]*f[a3,p3+p4]*f[a4,p4] Where ...
0
votes
1answer
28 views

How to determine a function that fits a geological model

I have a problem. I am currently working on a code that works by comparing data (real or synthetic) to an earth model (described by earth layers, or in this particular, velocity (...
38
votes
2answers
768 views

How is pattern specificity decided?

Mathematica has a notion of pattern specificity, which is a partial ordering on patterns. The rules (e.g. DownValues, ...
-1
votes
0answers
45 views

Optimal solutions of x and y for $\max_{x,y}\min [f(x,y),~g(x,y)]$

Can someone help me with Mathematica to find numerical solutions for optimal values of $x$ and $y$ which satisfy the following optimization problem? \begin{align} \max_{x,y}~\min & ...
3
votes
1answer
58 views

Syntax for FrontEnd`SelectionSetStyle

I know FrontEnd`SelectionSetStyle is undocumented, but its name suggests it does what I need. What is its syntax? I have already tried several variations of the ...
6
votes
2answers
148 views

Why can't I change the style of a cell repeatedly?

I ran into this when I was working with an example from the Help Pages of V9. Cells is a new function added in V9. The following appears to work the first time it ...
5
votes
2answers
130 views

Set the style of a cell

I know it's possible to programmatically change options on the selection in a notebook. I'd like to create a button that lets me change the style of a cell. It's a style that doesn't have a keyboard ...
4
votes
2answers
58 views

How can I get the style of a CellObject?

I want to work on a notebook programmatically with CellObjects. lets create a notebook for example: ...
339
votes
13answers
68k 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 ...
5
votes
1answer
91 views

Comparing memory consumption of two pieces of code

I have implemented something I want to do in two different ways, because I'm not sure which of the two approaches give best speed/memory efficiency. Comparing the speed of the two approaches is ...
3
votes
0answers
28 views

Compile, “global variables” and recursion

I am trying to do something similar to this, namely to make a Compile'd function outer that itself calls a ...
5
votes
1answer
92 views

Relaxation of Mass-Spring System with Pinned Masses

Problem Assume that four masses are connected to each other by springs while two of them are pinned down at their initial positions. Find the position of masses when system is at its minimum ...
5
votes
2answers
341 views

How can I get the inverse of my function?

The original function is $$f=\frac{1}{e^{\frac{\phi }{k t}}-1}-\frac{m+1}{e^{\frac{(m+1) \phi }{k t}}-1}$$ I want to express $e^{\frac{\phi }{k t}}$ about $m$ and $f$, so I tried: ...
6
votes
1answer
337 views

Poisson PDE over a irregular region with FDM

The problem modeled by the Poisson PDE is related to the torsion of prismatic beams and I use the Finite Differences Method (FDM). I've managed to solve the equation over a rectangle region with ...
0
votes
0answers
34 views

why Accumulate performs siginificantly different for two data sets with the same structure and length [on hold]

I used Accumulate to calculate partial sum for two lists of vectors. These two lists have the same dimension (same number of vectors, and each vector has three ...
24
votes
6answers
713 views

Partition string into chunks

This seems like it should be trivial, but how do I partition a string into length n substrings? I can of course write something like ...
5
votes
6answers
225 views

First pair out of order

I would like to know how to efficiently determine the first pair of elements in a list that are not in order according to some predicate p. That is, list[i] > list[j] according to p, and i is the ...
13
votes
2answers
1k views

Finding a subsequence in a list

I have a list and I want to find (in this particular case the first) appearance of a any of some subsequences, of possible different lengths. None of the subsequences is a subsequence of each other. ...
8
votes
2answers
162 views

Bad performance from SubsetQ?

Can I say this is a bad performance from the new V10 function SubsetQ? Here are some tests comparing it to ...
0
votes
3answers
113 views

How to define a function

How can I define a function which depends on a function of x? Something like this f[u[x]_,u[x]']= u[x]' + a [x] u[x] +b[x] I think I wasn't enaugh clear. If I ...
3
votes
2answers
114 views
3
votes
2answers
122 views

What's real analogue for FromDigits?

FromDigits only works for integer strings. What's its real-number analogue?
5
votes
2answers
169 views

How do I prune a list of pairs of numbers so that each number occurs on only one pair?

How do I select only the first pair of numbers in which a number occurs from a list of pairs of numbers? For example, I have ...
0
votes
0answers
36 views

find initial condition for NDSolve

I have a complicate second order differential equation to solve numerically (too complicate to be posted). Unfortunately I do not know the behavior of the solution $\theta(r)$ near $r=0$ and I am not ...

15 30 50 per page