# All Questions

2k views

### Once more on object orientation in Mathematica: does it have to be so hard?

Recently I came across a set of problems which would be solved most easily within an object-oriented approach. I first attempted to solve them by other means, but found the complexity of the code ...
156 views

### What is causing a type error when trying to modify Mathematica state from a function linked with LibraryLink

I've managed to reduce my problem to a very simple C program: ...
126 views

### Smooth Max and Abs

I'm trying to implement smooth approximations of Max and Abs functions. Moreover I want the functions to map element-wise on tensors. Here's my code. ...
95 views

### How do I make an EventHandler non-responsive to MouseMoved after a mouse click?

Consider the following code. After evaluating it, when I move the mouse over the output text, it prints 1, and when I click the mouse on ...
484 views

### how to associate a metric for tensor contraction operations?

I see that Version 9 now has some built in tensor support (which was missing back when previously asked How to represent and manipulate abstract indexed vector (or tensor) expressions?). The docs ...
235 views

### is it possible to modify BaseStyle of Manipulate dynamically?

I can't decide what is a best color for the background for a Manipulate I am writing. So, I thought since this is Manipulate, why not make this part configurable as well, so one can change the RGB ...
1k views

### How to find the sum all even numbers of this sequence?

I have a sequence $(u_{n})$ $$u_1= 1, \quad u_2 = 2, \quad u_3 = 3, \quad u_{n}= -u_{n-3} + 3u _{n-2} +2 u_{n-1}, \quad \forall n \geqslant 4.$$ I want to list the first $20$ terms of this sequence ...
307 views

### Pasting external PDF vector graphics without losing ability to export them

As in previous versions, Mathematica 9 on Mac OS X (10.7.5 here) still has a problem with pasted PDF graphics that were copied from external applications such as ...
301 views

### FullSimplify inconsistency

I'm pulling my hair out with this one. I have two complex functions f and g, ρ is real. ...
1k views

### How do I make an image “nearly” black and white?

Using the following code, I downloaded an image from the web and adjusted the image to obtain the "negation" of the image: ...
248 views

### What causes this strange convergent sum?

N[Sum[1/(x^2 + 1), {x, 1, Infinity}], 5] N[Sum[1/(x^2 + x + 1), {x, 1, Infinity}], 5] 1.0767 0.79815 + 0.*10^-6 I What causes the strange number?
602 views

### How can I improve my code for drawing a tree?

This code draws a tree, but it's not in the functional style. ...
4k views

### How do I extract a number from a string?

I want to extract the number from an alphanumeric string. This is what I tried: StringTake["thiru3", {6, 6}] The result I got is ...
356 views

### Quickly look-up usages, options and attributes of symbols

When I'm writing code in the front-end, I find myself very often looking up the list of options of a symbol over and over again in the documentation center. In most cases you find there a list of ...
196 views

### Preventing Grid from resizing when the item height is increased

I created a grid of size 200,200 and placed a button in it of size 200×200. ...
263 views

### How to express endogenous variables in terms of exogenous variables?

I have 11 endogenous variables (RD, NR, WR, Q, NQ, R, L, W, NU, C1, C2) and two exogenous variables (EE, K). I'm trying to find $RD = f(EE, K),\, NR = f(EE, K),\, ...,\, C2 = f(EE, K)$. Hence, I ...
146 views

### Why are some equal expressions more equal than others?

n1 = 1/3 (2 + (-Sqrt[3] + 2 Sin[(2 π)/9])/(Sqrt[3] Cos[π/9] - Sin[π/9])); n2 = 1/2 + Sin[π/18]/(3 Cos[(2 π)/9] + Sqrt[3] Sin[(2 π)/9]); n3 = 2/3 (1 - Cos[4 π/9]); ...
427 views

### How do I find the amount of free space on disk?

I know a workaround, where one calculates sizes of all files and then you subtract this from your default space, but is there any direct way to do it? Simplicity and speed are important. There's the ...
3k views

### Is there an option to change the space/distance between tick labels and axes labels for plots?

In an attempt to squeeze more plots and controls into the limited space for a demo UI, I am trying to remove any extra white spaces I see. I am not sure what options to use to reduce the amount of ...
658 views

### NDSolve problems of convergence

I have a big function that I have to maximize, so I have to evaluate some equation with thousands of different values of the parameter. But the FindMaximum returns me many errors. I have traced the ...
1k views

### Is there a “No Units” (i.e., dimensionless) unit?

I would like to be able to call the Quantity function with a null unit so that it returns the original dimensionless value. For example, ...
727 views

### Create an adaptive amount of local variables for error propagation

I intend to write a function which calculates the result and the error for any formula with any amount of variables using the Gauß Error Propagation. The error $\mathrm{d}R$ for a function $R(a,b,c)$ ...
171 views

### All values for a function with two arguments without Outer

Given two lists $l_a = \{a_1, a_2, a_3\}$, $l_b = \{b_1, b_2, b_3, b_4\}$ and some function $f$ accepting two arguments, how can I produce a list of all values $f(a, b)$ for $a\in l_a$ and $b \in l_b$ ...
204 views

### Can I redefine a list as a set of variables?

Suppose I have a list mydata = {3, 14, 15, 92, 65} and in some cases I want to manipulate it as a list, like for reading from and writing to a file, or for ...
259 views

### How to make a Tooltip display dynamic based on a parameter value?

If k=3, then I would like the following to say "Sine Curve, k=3" when you hover over the output of the Tooltip command: ...
221 views

### Transformation rule on a list of non-negative integers

I am trying to create a transformation rule that takes a list of non-negative integer values of any length, finds a non-zero entry in the list, adds 1 to all preceding numbers, subtracts 1 from the ...
1k views

### Dynamic Graph visualization

I'm working on a C++ library that will be used to construct and study certain graphs (as in a set of connected vertices, not a function plot). These graphs will be dynamic in nature (and can ...
444 views

### Problem with #1's in DSolve

I've entered the following functions into my notebook, but the solution to them contains #1's that I can't seem to make any sense of. The functions are: ...
2k views

### Creating an animation illustrating the time-evolution of a pre-computed orbit

As the title says, I would like to use Mathematica in order to create an animation depicting the time-evolution of a three-dimensional (3D) orbit. To begin with, I have an ASCII file which contains ...
411 views

### importing and manipulating data file

I have a large text file containing numeric data of 1000 groups each of 200 lines. The lines are unsorted. There is a 9 line header at the beginning of each group, i.e., 209 ⨉ 1000 lines altogether. ...
120 views

### Can Depth be used as an equivalent for MatrixQ?

Given an expression x, are the following two statements interchangable with no exceptions? Depth[x] - 1 == 2 ...
351 views

### How to Chop correctly?

I want to count degeneracies in a list called spectrum. The list contains numbers of double (~ 15digits) precision. So it makes no sense if the noise below this ...
267 views

### Mathematica: how to make Z transformation of data from CSV File

I have a discrete Signal in my CSV File and I want to transform it in Z. I import the data with Data=Import["T:/data.csv","CSV"] and I try to transform it ...
557 views

### Number format in Legend Labels

I would like to use the usual (new and nice) BarLegend[] with something like BarLegend[{"LakeColors", 1/10000 {-2, 2}}] which ...
491 views

### How to remove ticks?

I wanted to remove the Ticks in my coding but i can't. Here when i try to remove the Ticks the number also gone. I need numbers ...
95 views

### How should I make a label?

This is my code for making a label. I used a Button expression to build it. Is there a better way to make a label? My objection to doing it this way is that, when I ...
1k views

### AxesLabel in RegionPlot does not work

I simply want to add labels to the axes without using the Drawing Tools menu, I tried this without success: ...
599 views

### If-statement does not evaluate if condition is true [duplicate]

Possible Duplicate: How to avoid returning a Null if there is no “else” condition in an If contruct I know there are other ways to solve this problem. Just because I'm curious I tried: ...
163 views

### How to change FieldSize to be the same as dropdown menu width in PopupMenu?

I've tried the following code to change the FieldSize but I can't make it equal the actual value of MenuSize and I tried to ...
94 views

### An recurrence equation that can be solved in version 7 but not in version 8

A friend of mine showed me this code sample: RSolve[{a[n] == a[n - 5] + 1, Sequence @@ Table[a[i] == 1, {i, 5}]}, a[n], n] // Timing It's solved by version 7 in ...
451 views

### How can I control the behavior of a Manipulate with check boxes and radio buttons?

I've been stuck for a long time on this problem, and I really would appreciate if somebody helps me move in the right direction. I have two functions and each can take one of two forms. I am ...
656 views

### How to get a plot generated by R returned in an output cell?

It seems we'll never have built in two axis plots and list plots in Mathematica but you can make them in R. ...
1k views

### Time-series decomposition in Mathematica

I'm studying time-series in R with this book, and there is a nice command in R that creates decompositions. Inside Mathematica 9 the command can be executed as: ...
405 views

### The locations of (row-wise) minimum elements in a list

I have a list representing a 2D matrix, such as this 3 ⨉ 2 one: {{2.1, 1.01}, {0.01, 7.2}, {7.8, 2.0}} Does anyone know how to find the minimum of each row, ...
312 views

### More structure in Source Code/Notebooks

Mathematica is great for small and quick projects and has a great syntax. However as soon as a project grows I run into trouble. How do you scale and maintain projects in Mathematica? What is beyond ...
268 views

### How can I download price information for multiple stocks at once?

I have a list of stock tickers. Is it possible to download price information over a period of time all in one go, or download other types of information across multiple stocks in one go?
261 views

### Why does DominantColors keep shuffling the order of the results?

This graphic is produced by running DominantColors (new in Mathematica 9) with different values, using the Lena image as the source: Each row is a list of the ...
255 views

### How to calculate this sum?

I want to find the sum $$S=f\left(\dfrac{1}{2012} \right) +f\left(\dfrac{2}{2012} \right) +\cdots + f\left(\dfrac{2011}{2012} \right),$$ where $$f(x) = \dfrac{4^x}{4^x + 2}.$$ I tried ...