4
votes
2answers
402 views

Can SetDelayed (:=) be compiled?

Is it possible to put an If statement as below within a compile (see below)? I received a warning about SetDelayed. ...
4
votes
1answer
1k views

Embed CDF into an Apple iBook?

Edit From the comments I received and verifying the information about CDF at wolfram.com, it appears that it is presently impossible to embed CDF into iBooks. WRI does not appear to be happy with this ...
4
votes
2answers
202 views

Setting a lower limit on calculation time

Sometimes it can come in handy to set a lower limit for a calculation. Consider for example an animation that is generated by some infinite loop, which would run way too fast to display properly for ...
4
votes
1answer
926 views

MaxSteps and Computing time issue for Solving Differential equation in Mathematica

When we solve differential equation numerically using NDSolve then sometimes we get error like NDSolve::mxst: Maximum steps reached According to Mathematica docs ...
3
votes
1answer
88 views

Separating exponential terms

Suppose I have a lot of expressions multiplied by factors such as: $$e^{-i\theta[1]-i\theta[2] - i\theta[3]-i\theta[4]-i\theta[5]}$$ I would like to separate this into a product of exponentials of ...
3
votes
2answers
132 views
3
votes
1answer
192 views

Can't run bash scripts from within Mathematica 10.1

I am working on Debian 8 and Mathematica 10.1 (64-bit) Home Edition. I have created a script named curl_fetch.sh It contains the line : curl www.google.com > html.txt Running ./curl_fetch.sh on a ...
3
votes
2answers
69 views

Faster use of Condition for a large array (see the example)

Here is the example/problem. I have a array of $n$ random number. n = 2000; p = RandomReal[{0, 9}, n]; I have to create a $n\times n$ sparse matrix with ...
3
votes
3answers
161 views

How to assign symbols to functions

Several functions work with symbols in MMA: Take for example Part: l1=l2=Range[4]; l1[[3]] (*3*) l2[[4]] (*4*) I want to make ...
3
votes
1answer
174 views

Adding noise to nonlinear ODE system

I have a problem with adding a noise to 3d order ODE nonlinear system. I solved the system numericaly and got the periodic solution and now I need to add random pertubations. Due to the lack of ...
3
votes
2answers
105 views

How to simplify exponents of the form $\exp\left(i\frac{2\pi}{N}(N+1)\right)$ inside a function

I'm really annoyed with Mathematica and I need your help. I defined a discrete Fourier-Transformation(I use II instead of N, because Mathematica wont let me-.-): ...
3
votes
1answer
135 views

Evaluation of Derivative in a Module

Can someone help me understand the evaluation procedure in the following two pieces of code? ...
3
votes
1answer
91 views

Why is the Spherical Bessel Function acting strangely at this point?

I'm doing some computation that requires the use of Spherical Bessel Functions of the 1st kind, at high orders and values. So, I managed to find this, while running it over a wide range of values. I ...
3
votes
2answers
76 views

Make a time IntervalSlider

I want to make a time interval slider with an initial setting of (10:00:00 Mar. 8 2015, 12:30:00 Mar. 8 2015) and which varies from 00:00:00 Mar. 8 2015 to 22:30:00 Mar. 8 2015 with a granularity of ...
3
votes
2answers
157 views

Dynamic arrays and lists with compile (Append, Linked lists etc.)

I have a code that I need to compile. The code contains a loop in which I need to gather data into a list. The question is how to best gather data so that the code works inside Compile. The following ...
3
votes
1answer
243 views

Approximate $h$ in $F(\theta)=\sin \theta \int_{-L}^{+L}h(z)e^{-ikz\cos \theta} \,dz$

Consider $$F(\theta)=\sin \theta \int_{-L}^{+L}h(z)e^{-ikz\cos \theta} \,dz$$ $$|z|\le L$$ $$0 \le \theta \le \pi$$ By having knowledge of $F(\theta)$, how can one approximate $h(z)$? In ...
3
votes
2answers
305 views

Fullsimplify does not simplify Abs'[1.-a]

I have to simplyfy an expression involving Abs' This works: FullSimplify[Abs'[1 - a], a ∈ Reals] Sign[1 - a] but this ...
3
votes
3answers
504 views

Import data from first/last 100 rows of a file

If one wants import data from the first three rows of a file "myfile.data", one can use the command Import["myfile.data",{"Data",{1,2,3},All}]; However, if I ...
3
votes
2answers
169 views

Different between two graph in the Polar Plane

How can I plot $\theta=\cos r$ in polar plane? Of course I know that is different with $r=\cos \theta.$
3
votes
2answers
125 views

Eigenvectors of large symbolic matrix

I have large symbolic matrix of order 32 x 32 given as ...
3
votes
4answers
197 views

Trouble with Position[] [duplicate]

I am in trouble with Position, Although my example works as expected it throws a warning. Position[{{a,b},{a,c},{a,b}}, _?(#[[2]]==b&), {1}] During ...
3
votes
3answers
224 views

Exporting of Animated gif from polar plot

I want to export an animation(gif type) for polar plot $r=\cos 2\theta$ like to the following gif. how can I do it?
3
votes
3answers
242 views

Plotting a plane using intercepts

I have a plane 2x + 5y + z = 10. I have determined that its intercepts are: x = 5, y = 2, z = 10 I need to use ...
3
votes
1answer
408 views

How to load a custom mathematica package from a .m file?

I would like to load the package groebner50.m which is available through the website of David A. Cox. It's supposed to contain some useful tools for commutative algebra, but I haven't been able to get ...
3
votes
1answer
134 views

How to remove recursion, and write it functional and efficient way?

I wish to implement the following recursion efficiently. ...
3
votes
2answers
202 views

Difference between double quotes

I have a notebook and I enter something like PlotLabel->"my label with dynamic number "<>ToString[strange] and I get errors like However, the double ...
3
votes
4answers
287 views
3
votes
1answer
73 views

Computing kernels of a matrix in distinct cases

I have the following matrix: ...
3
votes
2answers
138 views

Change font of formula number in DisplayFormulaNumbered

I am trying to change the font of the formula number in a cell which has style DisplayFormulaNumbered. I can easily change the font of the formula I enter by selecting it and using the format menu. ...
3
votes
0answers
142 views

Generating function for Newton series?

The function GeneratingFunction gives generating function for Taylor series. Is there a similar function for Newton's series? $$f(x) = \sum_{k=0}^\infty \binom{x}k \Delta^k [f]\left (0\right)$$
3
votes
2answers
149 views

Expectation of a composite Markov-Gamma distribution

In a model I have a discrete two-state first order Markov process, defined by a (2x2) transition matrix with two free parameters. If the first state occurs then the process outputs zero for that ...
3
votes
5answers
370 views

How to add periodicity to condition?

Is it possible to set the following function f[a], where a can be any real number? $$ f(\alpha) = \begin{cases} 1 ...
3
votes
3answers
96 views

Replacing a sum of expressions

I have an equation which Mathematica solves but gives a huge output. However I notice in this output that the same expression occurs many times. Namely: $E=864 a^6 - 432 a^4 b^2 + 54 a^2 b^4 - b^6 + ...
3
votes
1answer
197 views

How to smoothly change the radius of a circle by dragging its circumference?

I am attempting to set an EventHandler to change the radius of a circle by dragging on its circumference. But the response to the dragging is terribly slow. What is ...
3
votes
1answer
94 views

Registering/detecting an importer by file name extension

I've developed an importer and exporter for FreeSurfer's MGH/MGZ file format; the specific format isn't important, but I was ...
3
votes
1answer
436 views

Solution given by Wolfram Alpha but not _Mathematica_

Why will Mathematica not give a soluion to Solve[Log[x] == Log[j, Log[j, x]], j], but Wolfram Alpha will?
3
votes
1answer
890 views

Plot a function based on Derivative - Gradient field

I'm trying to plot the gradient field of a function in such a way that is possible to change it easily, only editing the function. Consider the code: ...
3
votes
1answer
147 views

Is it possible to get AltGr key to work in Math.exe?

For some reason when you run Math.exe form windows command line, Mathematica disables the AltGr key. This is a bit annoying since my keyboard locale has the keys [, ], {, }, @, $, \, | located under ...
3
votes
1answer
810 views

Select row from a table by column value [duplicate]

I have the following: animals = {{dog, black, 200}, {cat, white, 100}, {moose, brown, 500}, {zebra,black,100}} If this came from a SQL table called animals, ...
3
votes
2answers
891 views

Intersection of surface with parallel planes

Consider the code (adapted from here) ...
3
votes
4answers
562 views

More elegant way

I read ReplaceOrRemoveInvalidOrMissingData Mathematica documentation, and I tried to apply the same approach to my dataset. I've got two problems, but one is only a style problem! There is one more ...
3
votes
1answer
554 views

ReadList with header and foot lines

I want to do some large data analysis, and i want to be able to import files in a fast way. I tried Import, but it is quite slow; ReadList takes half the time. This is the code I was using: ...
3
votes
3answers
169 views

Performance on Multinomial Deviate is slow

Most of the time in my program is spent on this single line of code: out = RandomVariate[MultinomialDistribution[nt, tmp]]; ...
3
votes
1answer
221 views

Simplify equations with pattern assumptions

When simplifying an expression using Simplify[expr, assumptions], the assumptions has to be explicit. Is it possible to simplify an expression with pattern ...
3
votes
3answers
331 views

How to do Cases with multiple related patterns?

I would like to write a function similar to Cases, but can search for a group of related patterns together. For example, ...
3
votes
1answer
193 views

Prevent Mathematica from “romanizing” a string of letters?

When I'm authoring in text style (Alt-7), I'll often include inline math. Whenever I enter two or more consecutive letters (e.g., $ax^2$), Mathematica will automatically "romanize" (or "un-italicize") ...
3
votes
3answers
432 views

Animation is jerky, but slider is not

When I do the following simple animation (from the book Mathematica Navigator, p. 316) the slider control changes the image smoothly, but when I play the animation it is jerky. Is there anything that ...
3
votes
2answers
363 views

Assigning an analytical approximation to the error function erf(x)

Working with some iterative integral equations, I have Gaussian density functions involved therein. Integrating the Gaussian function I obtain the error function. When I take the second integration, ...
3
votes
7answers
381 views

Concise way to generate multiset lists

I wrote the following to generate a multiset with the same number of items over a fixed range: ConstantArray[#, 3]& /@ Range[9] // Flatten ...
3
votes
4answers
724 views

Recursive function for calculating the arithmetic mean of a vector

I want to write recursive function for calculating the arithmetic mean of a vector. For $X(n)=\{1,2,3,\ldots, n\}$, the formula is ${\rm Mean}(X(n))=((n-1)\, {\rm Mean}((X(n-1))+X_n)/n$. My ...

15 30 50 per page