# All Questions

150 views

### Interprocedural optimization

Lets say I want to build a list of the first 1000000 primes. This is simple enough, I can just do: AbsoluteTiming[plist = Table[Prime[i], {i, 1000000}];] and it ...
512 views

### Space-efficient null space of sparse array

I have a roughly 100,000 × 3,000 matrix (as a SparseArray) that I'd like to find the kernel (null space) of. It has about 500,000 nonzero entries, all -1 or 1. ...
1k views

### Is there a way to convert an image into a Graph?

I'm trying to convert an image with several overlapping dots into a Graph. The goal is to be able to derive the Kirchhoff matrix for the randomly created "network ...
905 views

2k views

### Recursive function with if-statement

I am trying to represent the following function definition in Mathematica: \begin{align*} f(1)&=1 \\ f(2n)&= \begin{cases}f(n) & \text{if}\space n\equiv0\pmod{2} \\ 2f(n) & ...
183 views

### ParallelTable running on outermost index only

I need to run a simple ParallelTable: ...
498 views

### Can not Import PDF

I try to import PDF and extract text from it Import["D:\\Vegetarian MS.pdf", {"PDF", "Plaintext"}] but with some files I have a problem like this ...
205 views

### Subscripts in programatically generated section headers

Consider the following command: TextCell["\!$$\*SubscriptBox[\(H$$, $$2$$]\)", "Section"] How can I display the string as section header and get the DisplayForm? ...
837 views

### optimization problem with NDSolve

I want to minimize the function fcc. When fcc is calculated for a specified point the answer is correct: ...
1k views

### How do you check if there are any equal arguments(even sublist) in a list?

I would like to set up a function which has to return True if at least two arguments of a given List are equal. So if I give {1,4,6,2} to the function it has to ...
480 views

### Discrete coloring in Plots

I would like to have a plot that is filled to the axis with Green if the y value is greater than 10, and ...
1k views

### Checking if the roots of a function are real

I'm trying to determine if the roots of a function are real. How would you do that? (In particular I'm interested in verifying that the roots of LegendreP[6, x] ...
2k views

### What does “Tag Integer is Protected” message mean?

(Newbie question) For every function I define I get this message: When I close and reopen Mathematica, and re-enter the function definition, I don't get the message anymore. What does it mean?
279 views

### Get Mathematica to simplify $\cosh(i x)$ [closed]

I want Mathematica to simplify Cosh[I x] to Cos[x] if I tell Mathematica that x is Real. I ...
228 views

### Can't get DynamicModule[{..},..EventHandler[] ] working

This makes a slider to control the number of points. Click in the Graphics and the points slide over to where you click. ...
440 views

### Splitting a list

Please consider the following list: data={1, 0, 0, 0, 2, 5, 2, 3, 0, 0, 3}; Now I would like to split the list into 0-sequences and Not-0-sequences as following: ...
423 views

### Defining symbol shortcuts in the Front End

I was wondering (because I could not find any documentation on this) if it is possible to do shorthand abbreviations for domains or could one define them? E.g. In[1]:= Element[p,Complexes] ...
300 views

### Memory Leak in RowReduce?

Recently I tried to do what I thought was a fairly small (relative to the 6 GB of RAM that I have on my machine) row reduction calculation on a matrix representing an undetermined linear system and ...
185 views

### ListInterpolation causing .cdf security problems?

I've made a simple .cdf that makes a function from a list of data I've provided in table form (using ListInterpolation) and ...
250 views

### Determining the dates of days

I'm trying to use WeatherData[] to give me (not sure how) the temperature, humidity, wind-speed, cloud cover... at a certain location. I only want the information ...
633 views

### Optimizing a function involving NDSolve results in error messages

I want to minimize a function f with NMinimize but an error occurs that says: ...
626 views

### When to make (file.nb) instead of (file.cdf)?

I started with File > New > FreeCDF so I can save my work in a format compatible with the CDF Player. I can use Mathematica to make new cells, evaluate input and so in the CDF file. What are the ...
640 views

### Indices and variable definitions in Mathematica

Does anyone know how I can do this in Mathematica? Just an example.. Defining indices and variables (defined over indices), "mapping" variables and indices: ...
6k views

### How can I calculate a jigsaw puzzle cut path?

I want to generate a path to cut an arbitrary shape into a set of jigsaw puzzle pieces. All pieces must be unique to preclude placing a piece in the wrong spot. Pieces must be interlocking such that ...
2k views

### Performance tuning for game solving (peg solitaire | senku)

There's a game I saw at a friend's yesterday, that I often see at people's homes, but never for enough time to think on it too hard. It's called peg solitaire (thanks @R.M). So I came home and I ...
715 views

### Proving inequalities with Mathematica

Question summary: I would like to learn some tips and tricks on how to prove inequalities with Mathematica. I'm studying various inequalities in triangle that have the form $R+ar + bs\geq 0$, where ...
647 views

### How to render a 3D tubular graphics from a 2D image path

Question: Is it possible to create a tubular 3D image like Extruding along a path using "Tube" function in mathematica for following images? Image (1) Image (2) Thanks I have been ...
220 views

### Moving controls from Manipulate to a Palette ( or similar GUI object )

Consider the following snippet as a reference. ...
205 views

### How can I convert the dates returned by FinancialData into decimal representation?

I'm trying to run a regression using Fit on the output of FinancialData["SPY", "Jan. 1, 2011"]. However, the dates returned ...
3k views

...
370 views

### Creating simple procedure for The Least-Square $m^\text{th}$ Degree Polynomials

I am CS major, taking Computational Numerical Analysis course. Instructor gave us freedom of choice, we were allowed to use anything or any computer language we picked, I picked Mathematica.This is my ...
697 views

### How to find the maximum value and the argument of a function of three variables y dividing into grids?

I am dealing with a non-linear function of three variables, namely R0k, R1 and alpha. To find its maximum value, I divided the three variables into grids and maximized the function by plotting the ...
432 views

### Quickly differentiate and evaluate a function of several variables

How can I differentiate a function with respect to several variables and evaluate it at the same time ? I want to specify also the variable index that I want to differentiate and the number of times I ...
538 views

### What's the most “functional” way to do Cholesky decomposition?

I can do Cholesky in a procedural style, such as: ...
9k views

### Assign the results from a Solve to variable(s)

I understand Mathematica can't assign the results of a Solve to the unknowns because there may be more than 1 solution. How can I assign the 4 values of following result to variables?
1k views

### Adapt ticks in plot and font in legend

Some of my 2-dimensional data are displayed with a code similar to this: ...
523 views

### Scoping in assigning a derivative

While answering another question, I stumbled upon a problem I cannot easily resolve. To assign the derivative of a function to another function, typically one can do this with a ...
316 views

### How to resize the text content of a grid with it?

I am in a resizing mood these days. This code works quite well, up to a point. ...
487 views

### backward compatibility

When producing or enhancing code, it is tempting to use recent new primitives of Mathematica introduced in version 7 and 8, but for library code or in preparation or future version change in ...
165 views

### how to use button in place of checkbox

I am novice to Mathematica and want to ask how can I use Button in place of Checkboxes. I have used 4 ...
374 views

### How do I change the pressed button appearance?

On my system when a default button is pressed it turns light blue. This appearance can be changed using this code from the documentation: Use a second element to get the appearance of a pressed ...
620 views

### Count consecutive positions with the same value

I want to program a function that counts the successive positions with the same value: In[]= ConsecutiveValues[{1, 1, 1, 1, 2, 2, 1, 0}] Out[]= {4, 2, 1, 1} In ...
278 views

### How to process binary-encoded data without writing to file and importing?

I am consuming a webservice through NETLink that returns data directly in the response as a gzipped csv file. I can successfully process the data like this: ...
492 views

### Graphics and panel size

Consider the following snippet: ...
2k views

### How to convert from base 2 to base n?

I'm trying to use baseform to convert numbers in base 10 to base n, how can I make the convertion between, say base 2 to base n? Baseform seems to always think that the base in expr ...
387 views

### What alternative notation of subscripts/superscripts that are also treated as SYMBOLS in Mathematica?

I tried to avoid using the subscript $A_0$ in the Module, and get an error with $A[0]$. ...
156 views

### How can I make sure all InputFields have values before processing a nb form?

This is a two part problem: I have a form that accepts both numeric and text inputs, then runs a function using a "process" Button. The issue I'm having is users that forget to fill out all of the ...
83 views

### How to Clear a symbol with subscript in Mathematica? [duplicate]

Possible Duplicate: Clear complains that a variable is not a symbol or a string? I want to clear $\lambda_0$ which is assigned to be $\lambda_0=1$. From the reference here, Clear ...