All Questions

20
votes
3answers
3k views

Removing In/Out Labels before printing

I know that I can close a notebook and open it again in order to remove the In/Out labels. What I would like to know is if there is another easy way of removing these labels without having to close ...
23
votes
4answers
5k views

Plotting piecewise function with distinct colors in each section

I have a piecewise function that I would like to plot but I was wondering if it is possible that each part of the function that is plotted when its corresponding condition is true be plotted with a ...
32
votes
4answers
1k views

Which Distributions can be Compiled using RandomVariate

Recently, Oleksandr kindly showed a list of Mathematica commands that can be compiled. RandomVariate was part of that list. However, whether this can be compiled depends upon the distribution that is ...
8
votes
3answers
1k views

Efficient image Import

I have several sets of 20 images I need to import. Each time they have different categories. "Name"<>"Cat"<>"No" Electric B 1 for example. I need to create lists that contain the images for ...
17
votes
2answers
1k views

Built-in Mathematica data: are they cached? how to speed up the loading?

Mathematica has numerous built-in data for science and math. Every first call to a data function in a new Mathematica session will "re-initialize indices" (download the data). Is there a way to store ...
4
votes
1answer
1k views

Why these (error) messages?

Testing this answer I used: stream = OpenWrite["A:\\out.txt"]; Block[{$Messages = stream}, Mod[1, 2, 3, 4, 5] ] and I was surprised to find that the contents ...
30
votes
1answer
704 views

Is it safe to launch/close kernels in the middle of a parallel calculation?

It appears that it is possible to launch additional kernels (or close existing ones) during a parallel calculation. The newly launched kernels will be utilized for the rest of the calculation. Here'...
10
votes
3answers
493 views

Making sure that Timing[] isn't thrown off by caching

In playing with and comparing the various answers to my question here, I tried applying Timing[] to see how fast things ran, but it seemed that some of the answers (...
0
votes
1answer
151 views

FE`symbols that remain in notebook internals even after removing them and SaveDefinitions->True issue

How does one clear the notebook from symbols that remain in it after an edit session?
6
votes
1answer
193 views

Bug in LengthWhile?

Bug introduced in 8.0.0 and fixed in 8.0.1 Is this a bug or my MMA went insane or I'm missing something? LengthWhile[Reverse@IntegerDigits[1000], # == 0 &] ...
151
votes
8answers
15k views

List of compilable functions

Is there somewhere a list on the functions that Compile can compile, or the cases in which a particular function can be compiled that I haven't found? I'd be glad ...
27
votes
7answers
2k views

Efficient way to count the number of zeros at the (right) end of a very large number

If I want to count the number of zeros at the (right) end of a large number, like $12345!$, I can use something like: Length[Last[Split[IntegerDigits[12345!]]]] ...
5
votes
4answers
846 views

Some windows go off display

(I'm navigated from stackoverflow.com where I asked almost the same question) When I want to use additional windows, let's say for example "Basic Math Input", I feel reluctant to find visually where ...
6
votes
6answers
3k views

bar and hat only apply to certain letters

(I'm navigated from stackoverflow.com where I asked almost the same question) I'm a beginner in Mathematica. Like shown in the image below, I'm trying to put hat ...
12
votes
3answers
402 views

Memoization of Rounded inputs

Memoization is a technique for improving performance by having a function remember its previous arguments. For example, f[x_]:=f[x]=mySlowFunction[x] will be ...
23
votes
7answers
7k views

How to express an integer number in English words?

How do I convert a number to a readable string? I would like to implement a function, inWords[], inWords[n_]:= ? which ...
14
votes
2answers
2k views

Suppressing negative roots in Mathematica

Problem Using Mathematica's Solve operator can sometimes lead to an output involving a positive and negative root (say when solving for a variable such as ...
9
votes
2answers
497 views

Is it possible to set a timeout for LinkWrite[]?

This came up in relation to this answer Is it possible to set a timeout for LinkWrite? LinkWrite seems to block until the sent ...
16
votes
2answers
2k views

How to improve the typesetting of mathematical contents

Until I started diving into Mathematica, I was not using much computer software for symbolic computation. I did my analysis by hand on blank sheets, the calculations using Python or MATLAB, and the ...
10
votes
6answers
2k views

Producing cleaner Mathematica output

I asked this in chat and it turns out it would make for a good question make a posting for. I am writing up a handout type notebook and I'd like to have some clean output for presentation's sake. ...
10
votes
2answers
232 views

How to Write into multiple files?

Note: this is fixed in version 9. I want to put expressions into multiple files simultaneously, with the following code: ...
14
votes
2answers
693 views

How to pipe a stream to another notebook?

Can I pipe an OutputStream object created by OpenWrite (or similar) to a notebook instead of a file? I am aware that I can use <...
10
votes
2answers
397 views

MouseAppearance and cursor problems

I have to create a Graph object, which can be manipulated by the user, though I do not want to have the Graph-specific cursor (...
5
votes
2answers
332 views

How to Text justify string that includes SubScriptBox in it?

I am using Grid to document a demo I have. i.e. I am writing the documentation of the demo as a help option, which will display information when clicked on. Everything is working well. I am using the ...
8
votes
1answer
1k views

How do you get high resolution plots in applications using the Mathematica MathService?

This is for Mac users only using MathService (MathService it seems, given that it was created back in 2004, is a power pc code and requires Rosetta to run on Intel). If I type a plot command in ...
12
votes
6answers
1k views

2D Gaussian distribution of squares coordinates

I would like to imitate the structure of this great painting from Ellsworth Kelly in Mathematica. Yet with all the colored squares in Black and the beige one in white. Below is what I have wrote to ...
43
votes
5answers
4k views

Is it possible to speed up ContourPlot on multi-core machines?

It is not very difficult to face a function for which ContourPlot works too slow. And it seems natural that this function can be parallelized well. Anyway, naive <...
4
votes
2answers
306 views

Problem with EllipticE documentation

The complete elliptic integral of the second kind, EllipticE, is defined as, Integrate[Sqrt[1-m Sin[t]^2],{t,0,z}] According ...
22
votes
1answer
600 views

Is there an equivalent of FullGraphics for Graphics3D?

For 2D graphics, there exists the function FullGraphics to turn the stuff Mathematica generates automatically on Graphics (like ...
109
votes
7answers
13k views

Struct equivalent in Mathematica?

I really miss having something like a struct in Mathematica. I know of (and regularly use) a couple of programming techniques which feel like a ...
24
votes
3answers
2k views

How to find pieces of code responsible for syntax errors?

Especially: How to find the piece of code responsible for a missing parenthesis problem caused by a misplaced SuperScriptBox For last 30 minutes (and I was lucky ...
20
votes
6answers
1k views

On generalizing Partition[] (with offsets) to sublists of unequal length

The usual Partition[] function is a very handy little thing: ...
15
votes
4answers
1k views

How can I create a ColorFunction using Blend?

As shown below, I am trying to find a cool way to show some variance weighted deviation from the mean. There are 10 attributes that I compute the distance for. How can I add a color function such ...
24
votes
5answers
6k views

sprintf() or close equivalent, or re-implementation?

Is there a sprintf() command (some command that takes a printf-style format string and a list of values to insert into the ...
2
votes
4answers
11k views

Creating a data1 versus data2 plot?

I have a table of data with multiple rows and columns, and I have to make a versus data table using two of these columns. Essentially, I have to set one column of data (column 3) as the y-axis and ...
8
votes
4answers
2k views

Styling ticks, axes and other elements in a Plot of a step function

To display the effect of uniform quantization (step size Q) I would like to draw a curve as shown below I tried this using ...
12
votes
7answers
3k views

Combination and Permutation

How could I obtain the list of all the groups of 5 numbers taken from Range[12] such that the 2 lists have an empty intersection : ...
22
votes
2answers
3k 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. ...
36
votes
4answers
4k views

How to make a drop-shadow for a Graphics3D objects?

What's the best way to make a drop shadow for a 3D object? image = Graphics3D[Sphere[], Boxed -> False] I can get a blurry black outline of this: ...
9
votes
2answers
159 views

How to make TraditionalForm display the same in the Manipulate output as in a notebook?

I noticed that TraditionalForm does not display as nice in the Manipulate output as in normal notebook. Is there a way to make it look the same? Here is an example, ...
10
votes
1answer
920 views

How to import date (YYYY-MM-DD) data from a file?

I have a file with data in form {date, value}: 2010-05-19 17 2010-05-20 20 ...
49
votes
2answers
19k views

Can we use letter with a subscript as a variable in Mathematica?

I tried Subscript[a, 0] = 1 (* 1 *) Clear[Subscript[a, 0]] ...
34
votes
5answers
3k views

Are there “All” and “Any” functions in Mathematica?

In Python, there is a function all which returns true if all of its arguments are true, and any which returns true if at least ...
33
votes
3answers
1k views

How do I add new menuitems to menus?

What are some complete examples of what one would include in a FrontEnd init.m that would make use of FrontEnd`AddMenuCommands ...
17
votes
7answers
4k views

How to find rows that have maximum value?

Suppose if I have following list { {10,b,30}, {100,a,40}, {1000,b,10}, {1000,b,70}, {100,b,20}, {10,b,70} } How to find rows that have max value in ...
9
votes
3answers
2k views

Replace expressions with symbols

First of all: I'm new to Mathematica, so I would appreciate it if the answers are quite complete. I have the result of calculation that is expressed in $\sin$ and $\cos$. Now, all of these can be ...
11
votes
2answers
1k views

How to add an interpolating point to InterpolatingFunction?

Suppose I have an InterpolatingFunction object defined on $[\epsilon,1]$; let's call it f. What is the best way to construct a ...
14
votes
2answers
2k views

Representing second derivatives with a double overdot

I would like to express a second derivative with two dots above the variable. You can do this with a first derivative by saying: ...
19
votes
5answers
1k views

Using DynamicModule variables outside the DynamicModule

Take the following example for hiding/showing a notebook through a Checkbox: ...
7
votes
1answer
671 views

How to solve this iteration in the functional programming way?

I am trying to come up with a functional programming method to calculate a list of replacements, that depend on previous replacements. Since there is always a finite number of steps, I would like to ...

15 30 50 per page