33
votes
7answers
4k views

How do you convert a string containing a number in C scientific notation to a Mathematica number?

Suppose I have a string containing the C-representation of a floating point number, for example s = "1.23e-5" and I want to convert this to a Mathematica number. ...
41
votes
3answers
2k views

Plot draws list of curves in same color when not using Evaluate

This example comes from the Mathematica documentation for Plot under Basic Examples. Can someone please explain why these are each plotted as a different color in ...
11
votes
2answers
2k views

How do I export to Excel in multiple, named worksheets?

If I have two lists: list1 = {{1, 2}, {3, 4}}; list2 = {{5, 6}, {7, 8}}; I want to export these two lists to an Excel file and have ...
11
votes
3answers
377 views

Does AbsoluteTiming slow the evaluation time?

I've started using AbsoluteTiming to discriminate between similar function constructs, but I sometimes feel like it takes substantially more time to evaluate a ...
3
votes
4answers
261 views

What is the most efficient way to save a big graphic?

I want to generate a graphic using DiscretePlot[primePercent[x], {x, 10^10}, ImageSize -> Full, Filling -> None, Joined -> True] where ...
2
votes
1answer
168 views

Seeing the whole financial chart

I display a financial chart which I display with InteractiveTradingChart[]. My problem is that when my financial is displayed, even though I ask for 6 months of ...
16
votes
4answers
3k views

Numerical Fourier transform of a complicated function

Say I have a function $f(x)$ that is given explicitly in its functional form, and I want to find its Fourier transform[1]. If $f$ is too complicated to have an analytic expression for $\hat f(k)$, how ...
8
votes
1answer
301 views

I want to update a financial chart when I select a new stock from a popup menu

I have the following code: Read all the DOW jones financial instruments instruments = FinancialData["^DJI", "Members"] Then I create a dynamic variable called ...
1
vote
1answer
155 views

Differentiation w/o assiging concrete values

v = Subscript[v, 0]*Sin[(Pi*S)/Subscript[S, 0]]; a = dv/ds v; a = D[v, s] returns ...
8
votes
4answers
918 views

Automatically counting the number of lines of code in a set of notebooks

How can I automatically count the number of lines of code "Input" existing inside all the notebook files contained in a specified folder? I know there is the issue of considering or not the automatic ...
7
votes
2answers
2k views

Series of piecewise functions

Let $f_{0}(x):[0,1]\to[0,1]$ be defined by $$f_{0}(x):=\begin{cases} 3x, & \text{if } x\in [0,\frac{1}{3}] \\ \\ -3x+2, & \text{if } x\in (\frac{1}{3}, \frac{2}{3}] \\ \\ 3x+2, & ...
22
votes
1answer
433 views

Why doesn't PatternTest work with Composition?

While playing around with the solutions to this question, I've found some very strange behaviour: ...
13
votes
2answers
889 views

Symmetrical image transformation for a kaleidoscope-type image

I've been trying to write a little kaleidoscope-type manipulate, using images rather than graphics, and using ImageTransformation as a way in. However, I'm starting ...
15
votes
5answers
456 views

Alternative ways to implement a triangular recursion

Triangular recursions are a class of algorithms that frequently turn up in computational mathematics. These recursions are expressible in the general form ...
9
votes
1answer
174 views

How can I make CurrentValue for font characteristics pick up the font of the output not the input cell?

The command CurrentValue (documentation) allows you to access various properties of fonts, such as x-height, line height, and various measures of width such as ...
9
votes
2answers
321 views

Dimensions of the results of Text[] within Graphics[]

Is there a way to get the dimensions that the results of a Text[] will occupy within a Graphics[]? Specifically, if I run ...
8
votes
1answer
4k views

Adding a point to an already existing graphic

This is just a follow-up of this post: Beginner 2D animation with maths equations Part of the code is: ...
8
votes
2answers
706 views

Table function with Part[] call misbehaving, but only after initial startup of Mathematica

I am getting errors like: Part::partd: Part specification standardBasis[[1]] is longer than depth of object. with the following Manipulate expression: ...
13
votes
6answers
822 views

Efficient conditional Mean[] on a large data set

Consider a list, AK6, that has 382 sublists of length varying from 2500 to 3000. Each "subsublist" is as such : ...
8
votes
2answers
527 views

How to define a new copula distribution family

The function CopulaDistribution can be used with the most well known kernels. I was wondering how I can add a new family of kernels in a way that it works in the ...
22
votes
2answers
1k views

What is a “Paclet”?

I often see references to "paclets", for example the PacletManager` context, the PacletInfo.m file in some packages and next to ...
6
votes
3answers
797 views

Quickly editing the stylesheet and saving it

I have a private stylesheet I'm using. I edit it by going to the menu Edit->Edit Stylesheet and then clicking on the private stylesheet cell. I can modify whatever I want but it never gets saved. The ...
9
votes
1answer
741 views

Changing default window appearance

Since every single time I start Mathematica, my first action is aligning the windows properly (Notebook on the left for $2/3$ of the screen, help on the right for the other $1/3$), I was wondering ...
12
votes
9answers
446 views

Generating a matrix using sublists A and B n times

I want to write a function that generates a square matrix from sublists. My sublists are a = Range[0, x, 0.5]; b = Range[0.25, x + 0.25, 0.5]; Suppose x=2, then I ...
6
votes
1answer
158 views

Changing the MouseAppearance on the entire notebook front end

Using MouseAppearance one can change the cursor image when passing over an expression. Is it possible to change the cursor image for the entire notebook front end ...
2
votes
4answers
1k views

How can I extract the data from an image and process it pixel by pixel?

For example, to change the color of each pixel to the mean color of the three channels, I tried i = ExampleData[{"TestImage", "Lena"}]; Mean[i] but it just ...
4
votes
1answer
766 views

Evaluation of a Variable Coefficient PDE

I am trying to render the solution of the following partial differential equation: $$ u = u(x,y)~;\quad \frac1{x^{2/3}}\partial_xu + x^3\partial_yu + \partial_y^2u + \partial_x^3u = 0 $$ ...
6
votes
3answers
328 views

Replacement rule only matches part of expression

I have the result of a calculation (which is too long to mention here) and it gives ...
14
votes
1answer
2k views

Parallelizing Numerical Integration in Mathematica

I have an ugly, six dimensional function that I need to integrate numerically. It works, but it currently take twelve hours to complete the calculation. Is there any good way to parallelize the ...
7
votes
1answer
296 views

How make AddMenuCommands work in an init.m

I want to add some items to the Mathematica 8.0.4 Help menu (under Mac OS X). In [$UserBaseDirectory]/Autoload/FrontEnd/init.m I have the following cell: ...
20
votes
4answers
726 views

Resource management in Mathematica

I am using a library that has functions like createSomeObject[] and deleteSomeObject[obj]. It is an interface to a C language ...
3
votes
1answer
1k views

Embed CDF into an Apple iBook?

Edit From the comments I received and verifying the information about CDF at wolfram.com, it appears that it is presently impossible to embed CDF into iBooks. WRI does not appear to be happy with this ...
6
votes
2answers
967 views

Animating a rotating disk

I have a system with 3 degrees of freedom that I want to know if it is possible to visualise with Mathematica in the two-dimensional $X-Y$ plane. I have a plane ...
6
votes
1answer
327 views

How to determine edgeweights from width of skeleton using MorphologicalGraph (or workaround)?

Background I'm trying to create a workaround for what seems to be a bug in MMA's graph functions related to edge weights: SO: How to Label Graph Edges with their weights According to MMA's ...
0
votes
1answer
430 views

Question about $\LaTeX$ generated by Mathematica

I saved a Mathematica Notebook as a *.tex file. When compiling in TeXnicCenter I get the an error on the following generated code. ...
4
votes
1answer
168 views

Replace rule does not match

I have the following expression -3 I Ez Re[Ex] + 3 I Ex Re[Ez] And I wish to write this in the form ...
15
votes
3answers
634 views

How to convert between various ItemSize/ImageSize units?

How can one convert between the implicit units used by Grid (ems and line height for horizontal and vertical dimensions) and printers points (in ...
7
votes
1answer
556 views

Mathematica: Retrieving PlotRange from Histogram

I know that one can retrieve PlotRange of a plot by using AbsoluteOptions[plot,PlotRange] but that won't work on Histogram. Here an example: ...
35
votes
3answers
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 ...
38
votes
6answers
2k views

How can I create a function with optional arguments and options?

Is it possible to create a function with optional arguments that also takes options? Here is a simple example. I have a function f with option "g". It also has ...
3
votes
2answers
235 views

How can Magnify be forced to ignore the notebook's window width?

In a new notebook, I can illustrate how the action of Magnify is cut off by the window width: ...
4
votes
2answers
191 views

Setting a lower limit on calculation time

Sometimes it can come in handy to set a lower limit for a calculation. Consider for example an animation that is generated by some infinite loop, which would run way too fast to display properly for ...
13
votes
4answers
685 views

Is there a more elegant and efficient way to write brainf*** style loops in Mathematica?

I'm having some fun writing a brainf*** interpreter in Mathematica. See this wiki article for more info. It works nicely but I'd like to find an elegant, preferably functional, way to handle the ...
7
votes
1answer
910 views

Mathematica: Label specific vertices in GraphPlot

How can I label particular vertices in GraphPlot? And have the arrows space out accordingly, for the width of the label? I have Mathematica 7, but I think this question applies to all versions. ...
3
votes
3answers
2k views

How to change step size of ListPlot

The command ListPlot will plot lists with a unit step. Is there any way to change the step size of this?
6
votes
1answer
334 views

PrintTemporary in ParallelTable

I thought of a possible answer to Monitor doesn't work with ParallelTable but it doesn't work as I hoped it would. This accumulates print cells instead of deleting them as intended. Can it be ...
17
votes
3answers
1k views

Monitor doesn't work with ParallelTable

I can't monitor ParallelTable: Monitor[ParallelTable[Pause[3]; i, {i, 1, 10}], i] just displays i until it is finished. Do ...
61
votes
6answers
10k views

Exporting graphics to PDF - huge file

I want to draw some basic surfaces, export them to PDF and include them in a LaTeX file. I create a simple 3D graphics object, for instance with ...
8
votes
2answers
187 views

Checking from a preemptive evaluation whether a main evaluation is ongoing

How can I programmatically check from a preemptive evaluation whether a main evaluation is currently ongoing? I need a function mainEvaluationOngoingQ[] so that ...
2
votes
2answers
532 views

Solution Curves and Order of Evaluation Question

I'm new to Mathematica, so I thought I'd try to exercise some solution curves. Consider a simple first order ODE: $y'(x)=\cos(x)$. We know the solution will be of the form $y = \sin(x)+c$ I ...

15 30 50 per page