All Questions

482 views

How do I create a package from an existing notebook?

I have a notebook containing some functions, for example: f[x_] := 2*x g[x_] := x^2 Now I would like to convert this notebook to a package, ...
73 views

Why is a function I defined in a package not visible when I load the package? [duplicate]

I made a package containing some functions in the following way. ...
125 views

Is it possible to verify the accuracy of a file downloaded using URLFetch

Objective: I am trying to save a HTML file using the URLFetch function (native to Mathematica 9 onward). Sometimes the file is huge. Question: Is there a way to check/verify (using the headers or ...
72 views

Incorrect information displayed when slider is moved (intermittent)

All, the following code graphs 10 different solutions for a first order ODE and allows the user to modify certain equation parameters to see how the graph is affected: ...
104 views

Strange NSum behavior

If I do: NSum[(i + 1)/(i + 2) LegendreP[i, 0] LegendreP[i, 0], {i, 0, Infinity}] I get: 1.25216 If I do: ...
1k views

Solving functional equations in Mathematica

I am trying to solve functional equations in Mathematica, but got nowhere. Just a simple example: $$f(x+y)^2=f(x)^2+f(y)^2$$ for all $x,y \in R$, assuming f is a real-valued function. How should I ...
538 views

DSOLVE for tenth order boundary value problem

I am currently using Mathematica 9 to find solutions for higher order ordinary differential equations. The following was my input for a tenth order boundary value problem (BVP): ...
99 views

Exporting summation of interpolating functions to excel

I search the forum and found a question about exporting interpolating functions to excel. Unfortunately, I can't use it to export the results to excel. This is the equation : ...
232 views

Import image using InputField and Button

I've got a pretty basic problem, which is probably easily solved, but for all my efforts I haven't found a solution yet: I want to make an Image importer of the following form: An ...
121 views

ParametricPlot Question

I want to graph more than two, lets say 5 different ParametricPlot-s all in terms of different time variables. Is there any way to do this, such that they all show ...
857 views

How can I efficiently “remap” an image?

Many image processing libraries like OpenCV, Intel Performance Primitives or Octave have a useful function called "remap", that takes an image, an array with X coordinates and an array with Y ...
201 views

Is the CompiledFunctionCall WVM opcode efficient?

There is example in Mathematica documentation about Compile ...
352 views

Is there a “precedence table” for the canonical Sort ordering?

This answer in which I wrote about the Operator Precedence Table was unexpectedly popular. That got me thinking about similar things, and I am wondering: Does an "ordering table" exist for the ...
2k views

How to create a wind rose with Mathematica?

I am trying to plot wind rose in Mathematica, but have no idea how to do this. Any suggestions ?
176 views

Why is building a table of function values so much slower than just plotting the function?

Here is a function that take some time to evaluate: n = 1000; coeffs = RandomVariate[NormalDistribution[], n]; f[x_] := Sum[coeffs[[k]] Sin[k x]/k, {k, 1, n}]; ...
200 views

Setting non-standard ImageResolution for EMF export as default

Mathematica has a bug in that BarCharts and ListPlots with Filling will export as a ...
51 views

Draw Vector Tangent to Point on Parameterized Curve [duplicate]

I define the vector function $\vec{r}(t)$ by r[t_] = {t, Cos[t], Sin[t]} The command r'[t] gives the vector tangent to the ...
194 views

Markov Chain for combined events?

I was wondering how to apply Markov steady-state chains to a simple case in genetics, eye colour. Assuming the probabilities of being brown, green or blue eyed, given your parents were a certain ...
35 views

How to divide all rows of a matrix by their row sums [duplicate]

I've got a general matrix K that I would like to divide it's row's by the row sums of the matrix. I could get this going by doing ...
2k views

How do I calculate the area of a polygon given its coordinates?

I have a polygon: Polygon[{{0, 200 }, {200, 100}, {500, 300}, {100, 700}}] How can I figure out its area? The docs page does not have any example. So far I've ...
472 views

How to combine elements of two matrices?

Given two matrices m1 and m2, e.g.: m1 = {{a1, b1}, {c1, d1}} m2 = {{a2, b2}, {c2, d2}} How can one obtain the following? ...
160 views

Keeping vertexcoordinates after adding a new vertex

I want to add a new vertex to a graph, with fixed VertexCoordinates but when I use VertexAdd, the new graph does not have the VertexCoordinates of the previous one. ...
134 views

I have setup a remote kernel on my Mac, which connects to a more powerful Linux 64Bit Desktop. Mathematica is setup fine on the Linux machine. CUDA is also working fine and ...
133 views

List manipulation - End loop

Given are two matrices (a & b). I want to end the For-loop if all values in the matrix (a minus b) are smaller than 7, in contrast to any value in the matrix (a minus b) is smaller than 7. Can ...
676 views

How do I plot a histogram with hatched shading?

I can plot an ordinary histogram with blue shading and black borders like this: T = RandomVariate[NormalDistribution[0, 1], 10000]; Histogram[T, 30] And I can ...
95 views

How can I run MUnit tests outside of Workbench under Linux?

I would like to run MUnit tests from the command line. On Mac OS, I can do this: ...
134 views

How do I emulate DiscreteUniformDistribution in Mathematica?

How do I define a function from scratch that emulates DiscreteUniformDistribution? As shown below, attempting to use ...
145 views

Time ColorFunction

I have the following data ...
218 views

Not FullDefinition for Save. MachineID not Protected?

Is there a way to set what symbols's definitions I do not want to store? Consider the following code: ...
115 views

Reuse local variable in declaration within With [duplicate]

Considering the richness of Mathematica.SE, I am quite surprised I could not find my answer... I am very sorry if it is a duplicate. Consider the following example: ...
103 views

Whether NIntegrate evaluation is multithreaded or not?

About MultiThread evaluation I am talking about here, see this post I am NIntegrate the function grarm[e, 3, dimension, 1, 1, 0.005]. There is matrix operation in ...
374 views

Extracting a range of data from a table

I have text file with data in 2 columns. I have imported it using the following line c = Import["ab", "Table"]; This text file has a large amount of data, and I ...
141 views

how to Compile user-defined function like this

the following function can be compiled successfully ...
317 views

How can I get Mathematica to recognize equality of symbolic matrix expressions?

I have two matrix expressions: X.Transpose[T].Transpose[X] and X.T.Transpose[X] I want Mathematica to recognize that ...
331 views

Cropping a Voronoi diagram

Someone know how can I get the correct crop of this Voronoi image using RegionFunction? As you can see, there is a lot of undesired white regions inside the left ...
121 views

Trouble carrying out symbolic operations on matrixes

I have some problems. First of all, I declare matrices like below ...
199 views

How to annotate a Grid?

I have the following grid, which is a partial table for the linear function f[x]: ...
111 views

Pattern Matching with Indexed Object

If I have a list of rules associated with indexed variables like: solution = {a[1] -> 1, a[2] -> 10, a[3] -> 100} I would like to be able to extract all ...
266 views

Compile recursive function modifying global variables

How to compile recursive formula when it relies on more than a few global variables (global to the topmost compiled function)? It is unreasonable to pass on all such variables to each recursive ...
434 views

Failing to import an .eps file

I have an .eps file which was created using GLE. There is nothing wrong with the file, GS View can read it correctly. However, when I use Mathematica to read it using ...
245 views

Resolution problem of ContourPlot

I met a tricky problem with ContourPlot, which is when I change the range of my variable, I get a totally new figure. For example: ...
540 views

How to generate 2D FEM mesh in Mathematica?

To generate 3D mesh TetGen can be easily used. Are there similar functions (or a way to use TetGen) to generate 2d mesh? I know that such functionality can be easily implemented but I would like to ...
191 views

Collect and simplify both the coefficents and the matched patterns

(This is a far tighter version of a previous question I asked) The problem with Collect is that while Collect[exp, pattern, Simplify] will simplify the ...
209 views

What's wrong with my code for finding primes?

From here I found a fast method to make prime list, the python version works well, but my Mathematica version does not. Obviously ,169 is not a prime number. What's ...
337 views

Changing the background color of one element in a Grid

Consider the following code: Grid[Table[x, {4}, {7}], Background -> {4 -> LightRed}] This highlights column 4: ...
374 views

Finding central point in a ContourPlot

I am using ContourPlot for defining a 2-parameter space feasibility of a function. This function simply returns 1 if everything is ...
44 views

Running PlotLegends in Mathematica 8 [duplicate]

I will like to get a density plot (in Mathematica 8) as in: Make legend same height as plot. However, anytime I run ...
323 views

SinglePredictionBands versus MeanPredictionBands from NonlinearModelFit

From my Statistics lectures I know the term confidence and prediction interval, whereas the confidence interval is smaller than the prediction interval. If I plot the mean and single prediction bands ...
261 views

Simplifying expressions involving Sum

I am trying to use Mathematica to simplify a symbolic expression involving Sum. Particularly, I define a sum via ...
214 views

How do I interpolate a set of points with colour varying along the curve?

I have a table with 3 columns - x position, y-position and colour. I'd like to plot these points and join them with line segments, where the colour of the line segment is determined by 3rd variable. ...

15 30 50 per page