3
votes
2answers
318 views

Combinatorica: Girth[] and FindCycle[] disagreement

Warning: run the following code in a fresh Mma session, as some symbols could be shadowed (depending on your Mma version) While trying to answer this question, I fell into the following: ...
7
votes
1answer
189 views

Asking for input in an event handler

Why won't EventHandler["text", {"MouseClicked" :> (output = Input[];)}] work? When I click "text" the kernel hangs.
10
votes
1answer
272 views

Why doesn't Mathematica pack Boolean arrays?

I've been wondering about this for a while now, so I'm going to ask. This is a question about the design of Mathematica, which perhaps cannot be directly answered by anyone but the designers, however ...
6
votes
3answers
605 views

Changing background colour of a Manipulate element

Please consider the following: Manipulate[Plot[Sin[x (1 + a x)], {x, 0, 6}], {a, 0, 2}]; Now, I would like to change the background colour to yellow. I tried ...
21
votes
3answers
610 views

Computing polynomial eigenvalues in Mathematica

MATLAB offers a function polyeig for computing polynomial eigenvalues, which appear, for instance in quadratic eigenvalue problems (see here for some applications) such as: \begin{equation} ...
4
votes
1answer
338 views

pH calculations, speeding up code involving Solve

I'm trying to calculate pH values of solutions containing water and acetic acid. The relevant equations have been defined and I now want to find a solution using Mathematica. For a specific acid ...
2
votes
2answers
103 views

What is the best way for an application to provide customisation options for the user?

Suppose that an application needs to be configured specifically for a user's system. e.g. the application needs to be told the location of certain data directories. What is the best way to provide ...
9
votes
5answers
348 views

Finding first instance of a relationship between elements in two lists

Suppose I have two lists, say: A = {1,5,10,200,50,7} B = {4,3,19,78} For each element in A, I would like to find the index of the first element in B which ...
6
votes
3answers
387 views

How to properly remove the CUDAResources paclet?

I have Mathematica 8.0.0.0 installed on my Mac, and while I tried to see what it could do with CUDA, it downloaded a large directory (~1 GB) named ...
14
votes
3answers
944 views

How can I tell mathematica to generate an histogram from nominal data?

If I write: Histogram[{1, 1, 1, 2, 2, 2}] I get a nice histogram chart but if I write ...
2
votes
1answer
80 views

Why do syntax errors make a 8.` run through $PreRead in a TagBox?

Modified code from the help file on $Pre: ...
5
votes
2answers
144 views

How do I mimic the functionality of “<>”?

The Cell expression for: <> is Cell[BoxData["<>"], "Input"] However similar expressions are parsed into ...
28
votes
12answers
1k views

Map a function across a list conditionally

It seems that this is a really basic question, and I feel that the answer should be obvious to me. However, I am not seeing. Can you please help me? Thanks. Suppose I have a list of data ...
2
votes
2answers
778 views

Manipulate a Differential Equation result

I want to Manipulate the result of Differential Equation like : ...
1
vote
1answer
86 views

MousePosition Scaling over a cell

I'm trying to have the button follow the mouse while within the output text cell. The scaling does not exactly work as intended (fails to follow mouse correctly). ...
9
votes
2answers
849 views

Determine whether some expression contains a given symbol

Given a symbol t and an expression expr, how can I determine whether or not the symbol t ...
9
votes
3answers
211 views

Problem with UpdateInterval

I want to monitor current results with Dynamic ...
8
votes
2answers
311 views

Differentiating an unknown solution to a PDE

Sorry if this question is too basic -- I'm not very familiar with Mathematica. I am interested in a way to systematically address the following sort of problem: Suppose that $u=u(x,y)$ is a function ...
10
votes
2answers
2k views

FindFit returns worse result when putting constraints on parameters

I want to fit some data to a model of exponential decay using the FindFit function: ...
21
votes
1answer
508 views

A palette of accumulated expertise

I've been trying to put together a palette of useful functionality garnered from this site. There is useful stuff scattered all over the place, for example: Post an image Copy code Duplicate a ...
3
votes
3answers
467 views

How to simplify the following trigonometry expression such that the number of used characters is minimal?

How to simplify the following trigonometry expression such that the number of used characters is minimal? (13*Cos[t] - 5*Cos[2*t] - 2*Cos[3*t] - Cos[4*t])/4 The ...
4
votes
2answers
221 views

Odd behavior of GridGraph and DirectedEdges

For some reason the option DirectedEdges->True, albeit working internally with grid graph, does not appear in the visualisation for 1D and 2D graphs. It also ...
7
votes
2answers
182 views

Keywords to find documentation for this syntax

Mathematica allows this syntax, but I cannot find any documentation (or books) that discuss the various uses/advantages of it ...
2
votes
1answer
2k views

Solving a system of equations in two variables

I have a system of two equations in two variables $x$ and $y$. $$\begin{align} F_1(a,b,c,d,e)x+F_2(a,b,c,d,e)y+F_3(a,b,c,d,e)&=0\\ G_1(a,b,c,d,e)x+G_2(a,b,c,d,e)y+G_3(a,b,c,d,e)&=0 ...
15
votes
1answer
397 views

Find elements in a decay chain using IsotopeData

I am trying to write a program using the Mathematica function IsotopeData, but am finding the code troublesome. Due to my (relative) familiarity with Python, I am ...
4
votes
3answers
418 views

How to obtain a fixed number of solutions to $x+y=1$?

How to obtain a fixed number of solutions to $x+y=1$? For example, I want 4 solutions: $(1,0),(2,-1),(3,-2),(-2,3)$ I want to do this also on bigger equations such as $x+y+...=1$ and then I want to ...
19
votes
1answer
350 views

How can I interrupt Speak?

I want to use an event handler to stop speaking: Speak[ExampleData[{"Text", "DonQuixoteISpanish"}]] The only way I can stop this is by restarting mathematica!
4
votes
1answer
1k views

Efficient implementation of cubic equation of state

...In this case the Peng Robinson Equation of State. Equations of state are empirical equations with parameters derived from experimental data. They are used to predict pure component and mixture ...
5
votes
5answers
2k views

Replace values which obey certain criteria

I'd like to replace all values in a list which obey one or more criteria with another value. Example: Replace all values>30 by 30. data={{3,35},{2,7}} ...
9
votes
1answer
233 views

Arranging elements in a Grid by drag&drop

I have some elements in a Grid. I want to change their positions within that Grid. Can I swap their positions just by dragging ...
1
vote
1answer
117 views

How to explain the results of the following integrals?

Why does the following program lead to different results of a21 and a211? ...
2
votes
1answer
121 views

Using EdgeList on a once empty Graph crashes the kernel

Note: this is fixed in version 9. Calling EdgeList on a non-empty graph which was previously empty causes the math kernel to crash. For example, ...
4
votes
2answers
131 views

Problems with setting style options

Consider the following: FirstOutput=Style["Test", FontSize -> 20] SetOptions[Style, FontSize -> 20]; SecondOutput=Style["Test"] I would like the string ...
3
votes
1answer
341 views

Creating multicolored meshed plots (connected scatter plots) using ListPlot

I would like to make colored scatter plots where the dots are connected by lines. I have tried the following, using Joined->True to connect the dots and ...
22
votes
3answers
844 views

Emulating R data frame getters with UpValues

What's the best way to emulate R's data frames functionality? This includes the ability to select rows and columns in a 2-dimensional table by the string identifiers positioned typically in the first ...
3
votes
2answers
469 views

Defining a function using Series? [duplicate]

Possible Duplicate: General::ivar is not a valid variable when plotting - what actually causes this and how to avoid it? I need to define a function using the output of series, i.e. ...
2
votes
0answers
372 views

Simple contour integral with a parameter gone wrong

I run into the following problem, I tried to evaluate a very simple integral: Assuming[ a > 0 , Integrate[Sin[a*s]/(s - I)^2, {s, -Infinity, Infinity}]] ...
2
votes
1answer
181 views

Multi-Selection dynamic menus

I'm looking to create dynamic menus with multiple options, and would allow multiple selections. For example, mousing over an object (let's say a black circle of rad 1), a menu would popup at ...
6
votes
2answers
632 views

Implicit Equality and RegionPlot

I have the following problem: I would like to do a RegionPlot like RegionPlot[F[x,z,y]<1,{x,0,1},{y,0,1}] The problem is that the variable z is an implicit ...
11
votes
5answers
5k views

Filling between boundaries

I would like to visualize what it graphically means to integrate between two boundary values. Therefor I'd like to make a Filling between these two values. Is there a way to get this done?
7
votes
2answers
280 views

How to simplify the integration result of the following program?

In the following program, the fec[x] is a function depending on $x$ while q3[t] and q5[t] ...
4
votes
3answers
1k views

How do I make a log plot where the plot is logarithmic in the distance from the X-Axis (including negative values)?

For example, if I were to do a plot of Sin[x], I would get what looks like a Log plot of Sin[x], with another log plot of ...
2
votes
1answer
143 views

semantics of `ContinuousAction` on a slider. Mouse release

I needed to make 2 slider inter-dependent. Slider b in this example can't be larger than slider a. When I move slider ...
2
votes
3answers
381 views

How can `SquareWave` be used as the input in `OutputResponse`?

I'd like to compute the response of a TransferFunctionModel when driven by a SquareWave. Here's a simple example, ...
23
votes
4answers
1k views

What is the fastest way to count square-free words?

Background A word is a string of letters in an alphabet. A square-free word has no adjacent repeating substring. For example, (in the ternary alphabet of {0,1,2}) the words 00, 012121, and 0212012021 ...
4
votes
2answers
255 views

How can I emit a sound only during a mouseover?

Emitting a constant sound or note (no interruptions) for a fixed duration is easy, but a dynamic duration, not so easy.
2
votes
4answers
381 views

Building a list recursive with one or more arguments

Consider the following: data={a,b,c,d}; res={{a,b,c,d},{b,c,d,e},{c,d,e,f},{d,e,f,g}}; The idea is to define a function ...
3
votes
2answers
611 views

Getting consistent Ticks lengths and TickLabels positioning

From the Documentation, Tick mark lengths are given as a fraction of the distance across the whole plot. I wish to have identical tick mark lengths for both horizontal and vertical ticks and I ...
2
votes
2answers
818 views

Interpreting the interpolating function and saving data to plot with external program

So far I have been solving non-linear pdes with NDSolve and then plotting the result with the in-built Plot3D and ...
14
votes
6answers
2k views

Counting negative values in list

I would like to count the negative values of a list. My approach was Count[data, -_] which doesn't work. How can I tell Mathematica to count all numbers with ...

15 30 50 per page