12
votes
5answers
871 views

Connecting to and disconnecting from a continuously running kernel, on demand

I realized that there are lots of advantages to driving C/C++/FORTRAN code directly from Mathematica as LibraryLink functions (instead of running them from the command line or a shell script, as I ...
7
votes
1answer
248 views

Is the communication protocol underlying MathLink user-customizable?

MathLink supports two communication protocols on all platforms: TCPIP or shared memory. There are additional protocols supported on some systems only ("FileMap" and "Pipes" according to the docs). I ...
14
votes
3answers
3k views

How to generate random directed acyclic graphs?

How to programmatically build random directed acyclic graphs (DAG)? I know about the AcyclicGraphQ predicate and the ...
10
votes
1answer
182 views

Future-proofing access to packed array tools

Most of the Mathematica users beyond beginner level will be aware of the phenomenon of Packed Arrays. The user-accessible functions related to packed arrays live in the ...
18
votes
4answers
733 views

Why does Mathematica claim there is no even prime?

I wonder if this is a bug, or if I'm misunderstanding something: Exists[n, EvenQ[n] && PrimeQ[n]] // Resolve (* ==> False *) So if I interpret this ...
7
votes
5answers
328 views

Why is FindInstance finding non-instances?

Consider this example: FindInstance[Exists[{x, y}, x > 1 && y > 1 && x > Sqrt[x + y]], {x, y}] which finds values of $x$ and $y$ such ...
13
votes
1answer
381 views

Is it possible to use Begin and End inside a Manipulate?

May be someone can explain why I can't use Begin["context`"] and End[] inside a Manipulate ...
18
votes
4answers
394 views

Function that caches when it returns unevaluated

How would you go about implementing a function that caches not the result but the fact that it didn't match a pattern? So that it doesn't waste time recomputing a complex time-consuming pattern ...
6
votes
6answers
589 views

How can you give a Module a context and have its local variables and Modules belong to that context?

What would be the best way to give a module its own context and have its local variables and Modules belong to that context?
15
votes
2answers
402 views

Distributing PlusMinus consistently

I would like to give the built-in function PlusMinus, which is undefined by default, the intuitive meaning: considering all possible combinations of $+$ and $-$. ...
8
votes
3answers
1k views

Why don't * and ^ work as I expected on matrices?

For example, this input... {{1, 2}, {3, 4}}*{{1, 2}, {3, 4}} produces this output... {{1, 4}, {9, 16}} and this input... ...
9
votes
2answers
9k views

Figuring when the minute and hour hand coincide on a clock

I would like to list all possible times in a 12-hour period, where the hour hand overlaps the minute hand completely. This is really a question about three distinct things - to be done in Mathematica ...
10
votes
2answers
181 views

How can I set a fixed cell height?

I did this often in previous versions of the Mathematica notebook front end. I would have a cell with lots of raw data, e.g. a very long list. The list might go on for pages. I would set the cell ...
14
votes
3answers
471 views

Undocumented syntax of FilledCurve [duplicate]

Possible Duplicate: Undocumented form for FilledCurve[] A nice trick to get the outline paths of letters is to use the PDF exporter/importer ...
101
votes
7answers
4k views

What are the use cases for different scoping constructs?

Mathematica includes three functions that I know of which can be used to effectively (if not actually) define a variable and give it a value within a local scope: ...
12
votes
7answers
3k views

How do I replace a variable in a polynomial?

How do I substitue z^2->x in the following polynomial z^4+z^2+4? z^4+z^2+4 /. z^2->x ...
17
votes
5answers
2k views

Plotting an implicit polar equation

Mathematica can use ContourPlot to draw implicit Cartesian equations, but doesn't seem to have a similar function to plot an implicit polar equation, for example ...
13
votes
2answers
323 views

Interfacing Mathematica with MINE using JLink

In last December's Science David N. Reshef, et al. proposed an interesting method to detect associations in data (Detecting Novel Associations in Large Data Sets, Science 334, 1518, 2011). Contrary to ...
23
votes
1answer
662 views

How do you set attributes on SubValues?

SubValues, as discussed in a previous question, are declared as follows ...
7
votes
4answers
296 views

Unexpected behavior from GatherBy in version 7

I have come across what appears to be a bug in GatherBy. It appears similar to the problem of using Table[Random[], {1000}] in ...
35
votes
5answers
683 views

Placement of Condition /; expressions

It is my practice to place Condition expressions on the left side of := and :> in almost ...
38
votes
7answers
4k views

Intersecting graphics

Does the Mathematica graphics system have any concept of intersecting graphics? I've not found much in the documents so far. For example, if I want to show the intersection of two shapes: ...
9
votes
3answers
882 views

Is it possible to import dates and times directly as AbsoluteTime and by pass DateLists?

Date and time calculations are quite slow so I am exploring ways to minimize the number of calculations performed. As an example: ...
10
votes
2answers
219 views

What's a robust way to insert another extension into a filename?

I'd like to add an extension to a filename before the file extension, otherwise leaving the given filename the same. In particular, absolute filenames should stay absolute, and relative filenames ...
14
votes
1answer
720 views

Is it possible to use C# LINQ from Mathematica using .NET/Link?

Using Mathematica's .NET/Link (NETLink`) package, is it possible to call out to .NET's LINQ facilities for list manipulation and other operations?
16
votes
1answer
680 views

How can I share objects with dynamic content with non-Mathematica users?

Often when I construct some cool Manipulate[] function, I would like to share it with others—non-Mathematica users. Some software, notably Cinderella, ...
6
votes
1answer
322 views

Operations on online files via public URL access

I need Mathematica to access an online public directory via some URL (fake in this case) http://example.com/images and perform operations similar to those Mathematica can do on OS directories and ...
12
votes
2answers
313 views

What determines the value of $MaxNumber?

What determines the value of $MaxNumber? $MaxNumber 1.233433712981650*10^323228458 ...
13
votes
3answers
854 views

Strategies to avoid LessEqual::nord in NMinimize?

When using NMinimize on functions with complex intermediate expressions (but a real end result), quite often one gets the error ...
22
votes
2answers
504 views

Programmatically copy code so that all output is commented out

UPDATE: The final palette has a new home here! Please test and provide feedback (usability, suggestions, bugs) A note to the readers and voters: This is intended for community use, so please test the ...
24
votes
4answers
1k views

How to use NDSolve to track equilibrium?

I am looking for an extension of NDSolve where integration runs until certain variables are settled at an equilibrium. Now I have a working solution in my sleeves ...
34
votes
1answer
1k views

Generating a table of contents

This is my oldest question on SO. It still hasn't generated a useful answer there, so I thought I'd give it a try here. The question was: I don't seem to be able to find the method to generate the ...
14
votes
4answers
397 views

How can we implement “Sleep Sort”?

Inspired by Implement Sleep Sort: Sleep Sort is an integer sorting algorithm I found on the Internet. It opens an output stream, and for each input numbers in parallel, delay for the number ...
12
votes
2answers
851 views

How to export to HTML and not lose Grid Frame in the generated HTML?

This is a known issue for me with Mathematica. When I export a notebook to HTML, Mathematica loses some decorations such as Grid Frame lines (in grid and like objects). For example, creating this ...
14
votes
4answers
1k views

Converting a large floating-point number to a single-line string

When I feed a large (or small) enough floating-point number to ToString, it produces a two-line string, with the first line containing only the exponent of 10: ...
11
votes
1answer
180 views

Inspecting non-variable state from a breakpoint in Workbench

Suppose I'm stopped at a breakpoint in Workbench, say at one of the y = ... lines in: ...
28
votes
3answers
1k views

Saving a notebook as PDF, preserving syntax highlighting

Currently, one may save notebooks as PDFs from the menu by Save As... and then selecting PDF (on a Mac, I imagine it is similar on other OSs). However, the ...
13
votes
1answer
487 views

How to guarantee that NDSolve correctly detects abrupt changes in parameters?

When using NDSolve, I often have parameters that, in most of their domain, have a constant or null variation, but that suffer from abrupt variations on a very small ...
13
votes
5answers
1k views

Fastest square number test

What is the fastest possible square number test in Mathematica 7, both for machine size and big integers? I presume in version 8 the fastest will be a dedicated C LibraryLink function.
28
votes
2answers
901 views

Can a Trie be implemented efficiently?

What is the most space and time efficient way to implement a Trie in Mathematica? Will it be practically faster than what is natively available in appropriate cases?
13
votes
1answer
14k views

How to express trigonometric equation in terms of of given trigonometric function?

How can I express a trigonometric equation / identity in terms of a given trigonometric function? using following trigonometric identities ...
7
votes
2answers
225 views

How to generate Intervals from a given list?

If I have a list list={3,7,4,5,1} how to get the List of Intervals /Ranges result = {{1,3},{3,4},{4,5},{5,7}}
10
votes
9answers
545 views

How to find range in which a number falls, from given list of numbers?

How can one find the range in which a number falls, from given list of numbers? ...
7
votes
2answers
280 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 ...
22
votes
1answer
761 views

Visualizing Rubik's Graph

After the August 2010 discovery that the diameter of the Rubik graph is 20, I wanted to make a way to visualize Rubik's graph. Since there are about $4.3 \times 10^{19}$ vertices in this graph, it is ...
11
votes
2answers
532 views

Correct way to handle mysterious NaN` result from MathLink function

I have a Mathematica expression that is mapped onto an external C function via MathLink. The external function passes a ...
5
votes
2answers
251 views

Why is Neptune missing from AstronomicalData?

An old notebook I've recently started working with has a strange error: Prior to version 8, a figure I generated using Drop[AstronomicalData["Planet"],-1] to ...
16
votes
2answers
392 views

Are later versions of the Front-End compatible with older Kernels?

At my graduate school, all of the clusters still use version-6, and I only have version-7 and version-8 installed on my computer. I would like to use those machines remotely. Are either of the ...
8
votes
1answer
171 views

Using GraphHighlight interactively

I want to build a small GUI, where the user can select either a single edge or a single node of a graph. I got to this point: ...
6
votes
1answer
160 views

Inconsistent GraphicsRow behaviour

During the debugging of my previous question (somewhat related), I encountered this strange behaviour: when the global option Antialiasing is set to ...

15 30 50 per page