4
votes
2answers
195 views

About auto-compiling and performance between Do and Fold

I was investigating how Fold could improve performance vs Do. I tested the code ...
6
votes
0answers
201 views

Poor CUDALink performance, when calling a kernel multiple times

When working on a project of mine I noticed that CUDALink shows very poor performance when calling CUDA kernels multiple times in a loop-construct. To demonstrate this I put together this little ...
3
votes
1answer
263 views

Simulating a quick return mechanism

Last time, I got a satisfying answer for simulating a toggle mechanism, just as expected. NDSolve is great. I tried playing with it (as a matter of fact, @MichaelE2 ...
5
votes
0answers
98 views

Is it possible to embed a cdf file into a GitHub Page

At the bottom of my page, I've added a piece of CDF js code, but it doesn't evoke the Wolfram CDF Player or Mathematica, so I can't play with it. And I wonder whether it's possible, since I know ...
0
votes
2answers
75 views

How do I use a passed-in symbol as a tag to define UpValues?

ClearAll@foo; foo[tag_] := ( tag /: tag[i_] := tag[[i]] ); a = {7, 8, 9}; foo[a]; a[2] I wanted the above to output 8, ...
2
votes
2answers
187 views

Solving Inequalities with Gamma Function

I am wondering why Mathematica outputs that the following system "cannot be solved with the methods available to Reduce". $\frac{\Gamma(\frac{1}{2}+n)}{n-1}<\frac{\Gamma(\frac{1}{2}+k)}{k-1}$ ...
3
votes
1answer
139 views

Mathematica Library

I created a Mathematica packagr and then I used the Needs function to add the library to my .nb file, but when use a function in my .nb file and the function is built in my library it comes up with ...
11
votes
1answer
278 views

Is there a guideline about when to end expressions with semicolons?

Whether for nested Ifs or within scoping constructs like Module and Block, I never know ...
-2
votes
1answer
69 views

I need to calculate sin[x] series summation for sin[A] where A is a 3X3 matrix

I am evaluating $\sin(A)$ where $A$ is a $3\times 3$ matrix. I have calculated it but now I want to check this with a Taylor series expansion of Sin[x]. What I am ...
3
votes
0answers
173 views

Sparse Principal Component Analysis

I'd like to run sparse PCA on some economic data. There appear to be several R functions available including elasticnet and PMA but I wanted to check if anyone had something coded up directly in MMA ...
1
vote
1answer
59 views

How do I extend (prepend or append to) an existing TagSetDelayed rule? [duplicate]

I have a TagSetDelayed rule associated with, say, tag: ...
10
votes
1answer
204 views

Cancellation of common terms

Can someone explain why the term A in case 2 does not get canceled out when case 1 does? I use "9.0 for Microsoft Windows (64-bit) (January 25, 2013)" ...
0
votes
0answers
26 views

Math cell symbols not in italics [duplicate]

If I type $y(x)=ax+b$ in a math cell, y, x, and b are italicized, but a and x are not. How do I make them italicized? I tried adding an \[InvisibleSpace] or a \[VeryThinSpace] in between, and it ...
0
votes
0answers
41 views

How to construct a list in a For Loop nested in a Parallel Loop [duplicate]

I've the following problem I cannot solve. I allocate an empty matrix, v, of size n x m. Then I want to do a Parallel loop (ex. ParallelDo), and do some operations (described by a function ...
1
vote
1answer
69 views

formatting an InputField with Dynamic [closed]

I have the following code Style["(" InputField[Dynamic[t], Number, ImageSize -> 30] ")=" PDF[NormalDistribution[μ, σ], t], 16] which doesn't result ...
3
votes
2answers
156 views

Extracting argument sequences from function expressions

Why is it that fun[x, y] /. fun[z__] :> z leads to Sequence[x,y] but ...
2
votes
2answers
58 views

Avoiding RandomVariate update with use of Locator

I am preparing an activity that simulates the response from a noisy spectrometer. The function I use to generate the data has the form: ...
0
votes
1answer
93 views

Problem with Plot of Solution for NDSolve [closed]

I'm trying to plot the solution of an equation using NDSolve. For some reason nothing shows up in the plot. I checked the output of the interpolating function and it doesn't look like there is ...
4
votes
2answers
376 views

Labelling objects in a picture with numbers

I need help processing a biology bacteria picture. I just started learning Mathematica and I hope you guys can use a simple method to help me solve the problem, please do not use super complicated ...
0
votes
1answer
336 views

How to properly substitute values into variables?

I have an array of functions in terms of a[0] through a[n] and I wish to replace the a[]'s with previously calculated values p[0] through p[n], as in below: ...
3
votes
0answers
123 views

Discriminant of Characteristic Polynomial

I'm doing a calculation which finds the characteristic polynomial of a matrix with rather complex entries and then determines the discriminant of that polynomial. For smaller matrices up to around 7x7 ...
4
votes
2answers
168 views

Exporting strings without the quotes

I'm trying to export the following string "sep = ," to a CSV-file, as to be able to define the separation symbol. However, when using the following command: ...
2
votes
3answers
306 views

find connectivity

Imagine a chain of 20 rings, labeled by 1-20 sequentially. We want to make random size sets of numbers randomly chosen from these 1-20 rings. No duplicate numbers are allowed. Example of a set: ...
1
vote
1answer
123 views

Help to solve exponential equation over positive integers

I am trying to solve the equation $\frac{4}{9} = \big( \frac{1}{3} \big) ^n + \big( \frac{1}{3} \big) ^m $ with $n$ and $m$ both positive integers. I type into Mathematica the following In:= ...
0
votes
1answer
134 views

Graphics with shapefiles using tooltip

I'm trying to write a code that displays an entire shapefile color-coded by one variable, and then as the mouse is moving it shows the local regional area of interest with all its data Got a working ...
0
votes
1answer
203 views

Normalization of eigenvectors

I am trying to normalize the following vector in Mathematica with the Normalize command. $$(-1+2\cot[x]\csc[x]+2\csc[x]^2,\;2^\frac{1}{2} (1+\cos[x])\csc[x],\; ...
1
vote
2answers
100 views

Solving a linear system

When I tried to solve the equation below, I got the $4$ errors. Since I am pretty new on Mathematica, I don't know what I did wrong. $24x_1+20x_2+16x_3=4$ $20x_1+20x_2+19x_3=36$ ...
2
votes
3answers
239 views

Differential equation of a physical property which can not be below zero

A simple question but maybe also interesting for others. I have the simple differential equation: a'[t] == -r The quantity a has a physical meaning and can not ...
0
votes
1answer
185 views

spherical polar plot of radial function [closed]

Can you please tell me how to plot $\sqrt{r}$ in 3d sph polar plot? In the spherical plot 3d there is no option I can put variable r. So how should I proceed.
1
vote
3answers
148 views

How to have a special grid as background of a plot?

I want to have a grid background for the function (2/5)*x+3/5 but with one small detail. I want the coordinates of the points to be in the centres of the background ...
6
votes
2answers
950 views

How to reverse the direction of the y axes

I have a similar question to this one. Unfortunately, the answers there didn't help me. I would like to plot a simple function with the normal Plot function. ...
0
votes
0answers
185 views

Non linear model fit mathematica

I want to fit experimental data (temp,alpha) to the following equation for calculating k and Ea -Log[alpha]^n = function(k,Ea,temp) However i do not know ...
1
vote
1answer
111 views

need help rotating an object about the z-axis using animation

This should be an easy question for anyone familiar with 3D animations. I have a 2D shape denoted by the equation ((x-1)^2+y^2) ((x+1)^2+y^2)==1 and I ...
1
vote
1answer
366 views

ListPointPlot3D with connected points?

With the command ListPlot[data,Joined -> True] I can visually connect adjacent data points in the array with lines. However, this option appears to be missing ...
0
votes
2answers
101 views

Specifying an array that may have an unknown number of entries [duplicate]

Say I'm running some process of unknown duration, and during the process, I need to periodically record the state of some variable. If we knew exactly how long the process took, we could simply ...
0
votes
0answers
51 views

Problem with equation solving using Solve

I understand that these kinds of questions may be a bit overdone but I can't for the life of me figure out what's wrong with this piece of code. ...
2
votes
1answer
139 views

How can I get dotted boundaries on a RegionPlot?

How do I plot something like $$\{(x,y): 1 \leq x^2 + y^2 < 9\}?$$ I want to be able to make the boundary $x^2 + y^2 = 9$ dotted line and the unit circle filled and coloured region in between? I ...
4
votes
3answers
338 views

Fast method for combining two lists

I have two lists, v1 and v2. Each element of the lists may be positive or negative. I want to create a list ...
5
votes
2answers
108 views

Best way to represent a joint distribution

The motivation for this question is producing a distribution that produces the gender and age of an individual when the distribution of ages depends on gender. Suppose I want a distribution which, ...
0
votes
0answers
58 views

How to stop a ParametricPlot3D from autorotating [duplicate]

The 3d graphic functions like ParametricPlot3D and ContourPlot3D always give me a rotating plot. Sometimes, I even can't stop it ...
2
votes
7answers
295 views

How to replace plus sign by comma

I want to replace plus by comma and the order of numbers in the list should be in increasing order. Example: a1 + a10 + a11 + a13 + a2 + a27 + a28 In this ...
0
votes
0answers
109 views

Solve system of non commutative operators

I'd like to use mathematica to solve systems of linear equations, where the entries are non commutative matrices. I just tried the NC package but it doesn't help so far. For example I can solve: ...
1
vote
1answer
55 views

Evaluating the tensor product many times for a given list

I need to evaluate the tensor product 10 times in a given list( {g,e,r}) Here I have evaluated for 3 times... ...
9
votes
0answers
217 views

How is the mysterious Raw function used?

I have never seen an example use for the mysterious Raw function: Raw[h, "hexstring"] constructs a raw data object with head h, and with contents ...
0
votes
0answers
93 views

Save open Mathematica Notebook from command line or second Notebook to avoid data loss

I was executing a long Mathematica Notebook over night. The Mathematica instance is running on a Linux workstation (in a vnc server session to be precise). Now I cannot access this session anymore, ...
0
votes
1answer
396 views

How to calculate the distance between UTM-projected coordinates?

My coordinates are projected using the following projection: proj= {"UTMZone32", {"GridOrigin" -> {500000, 0}, "CentralScaleFactor" -> 0.9996}}; Now I wish ...
4
votes
3answers
187 views

Reading binary strings from file as strings

I have a file that contains binary strings like 01011 00101 01011 I want to import the file to Mathematica as a list of strings, but ...
1
vote
1answer
833 views

How can I insert text into a relative position in a plot?

I use the following code to draw a parametric plot, with Epilog to add a point, and text using Graphics. ...
2
votes
1answer
84 views

FindRoot: Minimum Execution Time

Is there a minimum execution time for the command FindRoot? If so, can I get rid of it? For example, if I compute the time to solve the fundtion x=0, it takes around 0.27ms per evaluation: ...
0
votes
1answer
126 views

Piecewise of different functions

You know, NDsolve coupled with Piecewise can be used to solve a series of discontinuous differential equations. But what if one of the function is different? For example: ...

15 30 50 per page