# All Questions

195 views

### How can we ensure the result of Mathematica is exactly correct?

This is an example, I plot a function and find it has a defect when x approximates 400. Plot[Cos[.3 x] Exp[-0.01 x], {x, 0, 1000}, PlotRange -> All] Another ...
416 views

### How does Mathematica interpret a expression?

I'm a beginner to Mathematica. I'd read several document. But I still have a problem. For example, every expression in Mathematica are of the form ...
108 views

### How can I define a function that takes a list of reals?

I'm trying to define a function f which takes a list of reals. My purpose is to build a function which I can give a list of reals, integers or strings and have it ...
122 views

### Matrix operations performed with column-vectors

We have 3 matrices: m1, m2 and b. We want to apply matrix operations (dot or sum) in a ...
295 views

### How can I create a class of matrices programmatically?

I am trying to figure out how to create a function that can create the matrix pattern below, where: f[1] returns {{1}} ...
3k views

### What is the relationship between Mathematica and Wolfram Desktop?

I'm confused about the differences among various Wolfram products. In particular what is the relationship among Mathematica, Mathematica Online, Wolfram Programming Cloud, and Wolfram Desktop? Are ...
199 views

### Why the Mouse dragging response not as smooth as Locator

I am experimenting to use MouseDragged eventhandler to change the vertices positions of a triangle, it works, but not as smooth as using Locators. Is this the ...
1k views

### Export high resolution figure causes missing ticks

I understand that Mathematica has a bug when exporting images. The ticks are scaled not correctly when exporting at high resolution. For example: when you do: ...
220 views

### Using FortranForm

I need to use in Fortran, matrices that I create in Mathematica, therefore, I need to format them, so that Fortan can understand them. I focus on the simplest example: Let's say I have tha matrix A ...
104 views

### Historical Prices via FinancialData

I downloaded the historical stock prices for some stocks in the period 1990-2013 via FinancialData some months ago and computed the financial returns. Now I downloaded the data again for the same ...
261 views

### Measures of association, Concordant and Discordant

I want to calculate concordant and discordant pairs on nx2 tables. ...
291 views

### Defining a function as a sum of several Gaussians

I have a function that is a summation of several Gaussians. Working with a 1D Gaussian here, there are 3 variables for each Gaussian: A, ...
464 views

### Plot has red 'film', no error message

I am encountering really strange behavior: I wrote a function that plots values some data. After executing the code the resulting plot has the red 'error' colour, but only momentarily (maybe 0.1 sec). ...
148 views

### Creating nested matrix using random integers

How do i create 15x2 matrix with 2x2 random integer elements? My code only returned identical 2x2 elements:
145 views

### how to find iso-cost contours on a 2d plot efficiently

Consider a 2D plot in which dimension 1 and 2 represent quantity 1 and 2 respectively ranging over 0 to 100. Each point in the space corresponding to (x,y) represent cost of choosing quantity 1 as x ...
208 views

### Choosing a branch of the square root when performing a series expansion

I have the following problem. Consider expression f=Sqrt[(x-2y)^2] There is an obvious ambiguity in the definition of f ...
663 views

### HarmonicNumber problem

I am looking for all the roots of HarmonicNumber, in the domain [-30, 1] and [0, 6000] for the real and imaginary parts, respectively, and where the parameter ...
147 views

### The algorithm of ListGraphs[n,m]

I'm not sure if this is a Mathematica problem, math problem or a CS problem, so if this is off-topic please transfer it. In the package Combinatorica there is a ...
823 views

### How can I get the exact real solution of this equation?

I want to solve the equation Sqrt[x] + Sqrt[1 - x^2] == Sqrt[2 - 3 x - 4 x^2] with real solutions (in the real domain). I tried ...
240 views

### Extract what symbol is set by SetDelayed, Set, TagSet, UpSet, SetAttributes, etc

One of the recent features of the Mathematica Plugin for IntelliJ IDEA (www.mathematicaplugin.halirutan.de) is a Structure View which let's you see information about several definitions that are done ...
87 views

### Numerical integration with purely numerical integrand

I'm trying to perform a numerical integral with an integrand that should not be manipulated with any symbolic preprocessing whatsoever. Consider the following simple test : ...
126 views

### Multi-legend issue in ChartLegends?

Been fiddling around with the legends and trying to place one in each corner and I bumped into an issue: ...
815 views

### Write any positive integer as a sum of squares

With n = 17 I would like to get {4, 1} and with n = 999 {31, 6, 1, 1} so that, for example, ...
492 views

### Finding the eigenfunctions of one and two dimensional Harmonic Oscillator

(Edited) For finding the ground state wave function of: $H\psi(x) = (-1/2)d^2\psi(x)/dx^2 + (1/2)x^2\psi(x) = E \psi(x)$ I have written: ...
83 views

### Compiling function with predefined expression

I'm using the Compile function in Mathematica to compute say the following : f=Compile[{x,_Real},Cos[x]] Then I can compute f[x] for x taking any real value. Ok, ...
312 views

### How to highlight the whole selected cell

Is there any way to highlight the whole selected cell? some times if I want to delete a certain cell and if the code is long and cells are without output, it is hard to know which cell that you are ...
76 views

### Defining a function (but not explicitly)

I have a question that must have a simple answer, but googling and searching this website did not produce an answer, so I'm asking it here. I'm working with three variables $x, y, \theta$, and I want ...
108 views

### Change Default Font Color of Commands [duplicate]

I encountered to two problems with Mathematica: one: How can I change the default font color of commands and functions in Mathematica (which is black) to another color, so that whenever I wanted to ...
384 views

### Loop until convergence of two variables

I have the following program which i need to repeat steps until until two variables converge and I want this to be printed with the number of iterations: What I have : Input variables: ...
126 views

### How to eliminate (hide) output numbers in a slide show

I am creating a slide show with several imbedded Manipulate objects. I can hide the Manipulate command by clicking on the ...
79 views

### Calculating the recursion at the Fourier domain

I would like to calculate the following recursion with mathematica $$f_n(x)=\int_{B}^{A}f_{n-1}(x-\omega)f(\omega)\mbox{d}\omega\quad\quad f_1(w):=f(w)$$ This is simply the convolution of $f$ with ...
199 views

### How to include constraints in NMaximize

I am trying to find maximum likelihood estimates of parameters for a fairly complicated multivariate distribution. The support of the distribution depends on its parameters so I need to include some ...
264 views

### Solve set of non-linear equations with least-squares-fitting - constrain results?

I'm trying to solve a set of functions to determine the material properties from a set of measurement values. (To set up this method I just want to fit my model with some already calculated data). My ...
147 views

### Vertex Names of Subgraph in Order of Connectivity

I extract path subgraphs $P_4$ of an undirected graph $G$. And want to list the VertexNames of the subgraphs in the same order as they are connected. Here is an example: ...
1k views

### NIntegrate: integrand has evaluated to non numerical values

I have pasted a code that has been giving me some trouble and errors when I try to compute. ERROR: "The integrand 1435.1232 E^(-6.4703566*10^6 s^2) deEntrance[s,phi]^2 has evaluated to ...
122 views

### What is the 'Mathematica-way' to test a variable transform?

Hello Mathematica experts. I would like to play around with a simple variable transformation, to test some claims about it. I wonder if there is a Mathematica-like way to do this. The specific case ...
399 views

### Absolute value and argument of a complex expression

I would like to find the absolute value and the argument of the expression: $x + \sqrt { x^2 + y^2 }$ under the assumption that the absolute values of $x$ and $y$ are equal. I have written: ...
118 views

### Integrating a function forcing parameters to be real and positive

I'd like to integrate the function $f(x)=x^{a-1}e^{-b x}$ over the interval $[0,\infty)$. f[x_] := x^(a - 1)*Exp[-b*x] Then: ...
649 views

### Tracking iterations of a function

I'm learning MMA with Wagner's book. On page 41, he uses this to display the iterative steps of a FindRoot. However, I can't seem to replicate this (code at end), perhaps due to the difference in MMA ...
2k views

### Longest path in 0/1 matrix

I have a matrix of 0's and 1's forming a number of disjoint paths:   I would like to find the lengths of the paths, and from that "spectrum," the longest length (in the above example: 27, ...
359 views

### Map of all graphs obtainable with GraphData?

I've been trying to put together an answer to another question, but I am stuck, so I decided to post this question instead. Mathematica contains (among its curated data) information on definition, ...
160 views

### Generating EventHandler using Table

I would like to change the edge color of a graph when double clicking on it, the following code works: ...
310 views

### NIntegrate (multi-dimensional integral)

I am interested in the numerical evaluation of the following integral: $\int \prod_{i=1}^n dx_i \delta(\sum_{i=1}^n x_i) \prod_{i=1}^n f_i(x_i)$ where $f(x)$ is a complicated function. Unfortunately ...
413 views

### Making a flag with six vertical stripes

A flag is to be made with six vertical stripes by using colours yellow, blue, green and red in such a way that no two adjacent stripes should have the same colour. In how many ways is this possible? ...
326 views

### Integration and Fourier transform

I would like to calculate the distribution function from the characteristic function. There is a formula given as F_X(x)=\frac{1}{2}+\frac{1}{2\pi}\int_{0}^\infty \frac{e^{i w x}\phi(-w)-e^{-i w ...
2k views

### Calculating the area under a curve, but above a certain threshold value

so here I am with a time series of data (hours (t) and corresponding measurements (a)). ...
337 views

### How to improve visualisation of trajectories in 3D space

I have a list of trajectories from a bunch of photons that travel inside a scattering medium. Each trajectory is a list of $(x,y,z)$ pairs. I'd like to visualise them in 3D space. I came up with the ...
141 views

### Real and imaginary parts of a complex number

I would like to find the real and imaginary parts of $x + y$ in terms of polar coordinates. Here is code: ...