All Questions

1k views

How to distribute proprietary Mathematica code

If I want to make package-code completely unreadable, in a way that the end-user can only call my functions, but has no way to re-engineer my definitions, how would I do that? I know I can use ...
611 views

FORTRAN code can be called using MathLink or .NET/Link (see the link for a worked examples). But as mentioned in a talk by T.Gayley and J.Klein in Wolfram Technology Conference 2011, LibraryLink, ...
1k views

How to read data file quickly?

I have a tab separated value file with 10 million rows each of which has three tab separated values. The first value is a string, the second an integer, and the third another string. How to read ...
2k views

Are there any cases when For[] loops are reasonable?

To my mind the only reason for the existence of For[] loops in Mathematica is to allow new users with some experience in procedural programming languages to write ...
388 views

Are there guidelines for avoiding the unpacking of a packed array?

Packed arrays are very useful because they save memory and generally allow speedier and more efficient calculation times. If a list of data currently stored as a packed array is unpacked, it can slow ...
708 views

How to efficiently find positions of duplicates?

Is there an efficient way to find the positions of the duplicates in a list? I would like the positions grouped according to duplicated elements. For instance, given ...
1k views

Extract current viewing parameters from a 3D view?

Is there a way to find out the current viewing parameters of a 3D view? What often happens is that I create a view, for example: ...
675 views

What is the complete list of valid Front End Tokens?

What is the complete list of valid Front End Tokens? Preferably, by version number.
1k views

How to make a drop-shadow for 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: ...
765 views

“Covering up” text in Graphics

Consider the following code: ...
921 views

Efficiently determining if 3D points are within a surface composed of polygons

This is the 2nd part of a previous question which I edited to make into 2 separate questions: Extracting polygons from 3D contour plot surface As an extension of my earlier question involving simple ...
734 views

Scale Insetted Characters to Plot

I am trying to place a curly brace within a plot such that the top/bottom of the curly brace line up with two horizontal lines in the plot: I have not been able to find a way to make the curly ...
893 views

Faster alternatives for DayOfWeek

It has been noticed on several occasions that DayOfWeek function is rather slow when applied to a large list of dates, e.g. in this recent question. What faster ...
832 views

Sort lists according to the order of another

I have three parallel lists (i.e. the elements in position i of each list are related). I want to sort the first list using the function Sort and make the same changes to the other lists so that I ...
1k views

Insert $+$, $-$, $\times$, $/$, $($, $)$ into $123456789$ to make it equal to $100$

Looks like a question for pupils, right? In fact if the available math symbol is limited to $+$, $-$, $\times$, $/$ then it's easy to solve: ...
3k views

How to calculate scalar curvature Ricci tensor and Christoffel symbols in Mathematica?

I am seeking a convenient and effective way to calculate such geometric quantities. I've used packages like TensoriaCalc, but they don't work at all time. ...
2k views

Changing the background color of a framed plot

I frequently generate framed plots like this: Plot[Sin[x], {x, 0, 2 \[Pi]}, Frame -> True] Is there an easy way to change the background color of the framed ...
2k views

Plotting a set of trajectories (not a vector field) in 3D

Consider a set of trajectories in 3D space, that possibly converge. By visualizing trajectories as arrows the result will look crowded as each arrowhead will be placed where the attractor is. In 2D, ...
1k views

Fastest way to calculate matrix of pairwise distances

It is a very common problem that given a distance function $d(p_1,p_2)$ and a set of points pts, we need to construct a matrix ...
403 views

Implementing a safe ValueQ that does not evaluate its argument

Mathematica has a built-in function ValueQ. Quoting the docs, ValueQ[expr] gives True if ...
680 views

How to collect result continuously (interruptible calculation) when running parallel calculations?

This is the most common pattern to compute a table of results: Table[function[p], {p, parameters}] (regardless of how it's implemented, it could be a ...
615 views

Extracting the coordinate of a particular point of interest from a ListPlot

Is there a way to obtain the coordinate of a point of interest in a ListPlot? As an example, I have a list containing many sets of 2D coordinates and the plot ...
492 views

Question about designing a particular data structure

Background: I store polygons with a color assigned at the face level. In some occasions I want to use vertex colors but I want to store data efficiently, i.e. don't want to duplicate data to the ...
2k views

Is it possible to prerender animation in Wolfram Mathematica?

I have a DensityPlot which is evaluated for a long time. I wish to use it with animation, but it is absolutely inapropriate. Is it possible to render animation ...
943 views

Assigning values to a list of variable names

As part of a calculation I need to do something like this Evaluate[{aaa, bbb, ccc}[[ index]]] = {1, 2, 3, 4, 5} so if index is ...
1k views

Point Renderings Slightly Off in Mathematica

The Mathematica code ...
606 views

Transpose uneven lists

Is there a quick method to transpose uneven lists without conditionals? With: Drop[Table[q, {10}], #] & /@ Range[10] Thus the first list would have the ...
415 views

How do I obtain an intersection of two or more list of lists conditioned on the first element of each sub-list?

Given two lists like list1 = {{1, 1}, {2, 4}, {3, 9}, {4, 16}}; list2 = {{2, 6}, {3, 9}, {4, 12}, {5, 15}}; I would like to produce an output like ...
289 views

Custom functions by delegating options in a specific way and using core functions

I'd like to create a custom function that does essentially the same as a core function of mathematica but uses different default settings. Example: I want a Plot function that uses Mathematica's core ...
450 views

Sort+Union on a list

Probably this is too trivial question for this forum but for some reason I am not getting it on my Mathematica 7 so far. I have a list ...
337 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 ...
962 views

607 views

Create complicated text formulas in graphics

I want to put somewhat complicated, or at least non-standardly formatted, text on some of my graphics. For example, I'd like to be able to use f^[4](x) (where the ...
373 views

How can I speed up image importing? [closed]

The following examples show how slow it is to load a simple GIF. Can anything be done to make it faster? System #1: Mathematica 8.0.1.0, HP notebook, Win7 64Bit, 2 x 2.4Ghz Intel Core i5, 2GB RAM, w/ ...