2
votes
0answers
467 views

Solar system simulation (n-body physics) with OpenCL

I would like to simulate a n-body solar system in Mathematica. I have found the following example: ...
17
votes
9answers
918 views

How to replace an element in a list based on the value of the next element?

I use Mathematica a little bit. I try to understand it, but it is hard I have a list of 5 numbers selected randomly from 0 and -1. I have to replace a 0 with a 1 when the 0 is followed by -1. My ...
3
votes
3answers
200 views

Prime factor counting function

Is there any way I can speed up this prime factor counting function? (I am looking for all numbers in a range with 3 prime factors (counted with multiplicity).) ...
0
votes
1answer
148 views

Does Mathematica know if an integral is convergent or not?

Consider the following integrals that I asked Mathematica to do, ...
9
votes
3answers
513 views

Different results for integration using Mathematica and MATLAB

I have the following integration: $$\text{y}=2 \sqrt{\frac{1}{\pi }} \int_0^{\infty } \frac{e^{-z} \left(1-e^{-\frac{z}{b}} \left(\frac{a}{a+c z}\right)^L\right)}{\sqrt{z}} \, dz$$ I get different ...
0
votes
2answers
135 views

How to calculate expected return, row by row in matrix? [closed]

Please help me, I'm writing my project and dont know how to solve this big matrix: I have to compute return row by row: 1st row: (18.32-17.14)/17.14 ; (19.17-18.32)/18.32 .... ...
4
votes
1answer
144 views

Efficient ways to rotate a ListPlot?

I have a numerical solution from a differential equation that is in the form of a list, in $(x,z)$-plane. I would like to rotate the 2D ListPlot around the $z$-axis ...
6
votes
3answers
244 views

Finding the square root of a squared number?

Taking the square root of the square of a number Variable set to a real value I'm wondering why these examples a = -4.3; Sqrt@a² Sqrt@(a^2) Sqrt[a^2] Sqrt[a²] ...
14
votes
4answers
230 views

Unexpected dots from Line

I have noticed cases where Line produces dots in a graphics object when I think it shouldn't. The first of these is: ...
0
votes
0answers
90 views

Reading Eigenvalue / Eigenfunction result from Reduce

I am trying to find the eigenvalue/eigenfunction solution to: $$\tag 1 y''+3y + \lambda y=0 ; y'(0)=0, y'(\pi)=0$$ I used DSolve and Reduce and they seem to converge, however (embarrassingly) I am ...
4
votes
2answers
64 views

Pattern-rewriting Pattern triggers error?

I am trying to rewrite patterns. For example, I'd like to rewrite the pattern jFoo_Integer which has FullForm ...
3
votes
1answer
81 views

Assign clipboard object in mathematica when print screen is pressed (windows)

Mathematica runs behind, while another window is selected. When I press print screen, I want mathematica too detect this and call a function with the picture as argument. ...
2
votes
2answers
153 views

Pulling out common terms when simplifying complicated equations

I have a complicated expression where common terms are apparent but Simplify[] and FullSimplify[] don't appear able, even with plenty of assumptions added, to reduce down to a simpler form with common ...
4
votes
1answer
207 views

Summation with jump indices like 1,4,6,9?

I is easy to enter $ \sum_{s=1}^{n}k(s) $ But how can I enter $ \sum_{s=1,3}k(s) $ ? When I try it, Mathematica says ...
5
votes
0answers
105 views

Manipulating the pitch of a sound

After reading Manipulating a continuous stream of sounds I have to ask about controlling the frequency of a Sin sound in a continuous manner, with a ...
4
votes
1answer
135 views

Ordinary differential equation invloving the function composition

I want to solve the following function: DSolve[(A1*Exp[B1*f[x]] + A2*Exp[B2*f[x]])*f'[x] == A1*Exp[B1*x] + A2*Exp[B2*x], f[x], x] And this is what I get as an ...
0
votes
0answers
92 views

Assigning the answer of Solve to a variable [duplicate]

If I enter Solve[(x-2)(x+2)==0,x] then the answer comes up as {{x -> 2}, {x -> -2}} I want to make two variables ...
4
votes
3answers
161 views

PlotStyle with Table

I want to create a plot style with a table and manipulate the variables in the plot style. ...
3
votes
1answer
117 views

Simplify doesn't simplify HypergeometricPFQ with exact arguments

Consider a series: $$\sum_{t=0}^\infty \frac{8^{-11-2t}(22+4t)!}{t!(11+t)!(11+2t)!(32+t)}$$ ...
3
votes
0answers
152 views

How to get vertices of a polytope given by equalities and inequalities?

I have a polytope given by some equalities and inequalities, how can I get all the vertices of the polytope? If there's a way to deal with the one given by inequalities only, how can I reduce the ...
3
votes
1answer
92 views

How to start Mathematica kernel without loading init.m?

Is it possible to start Mathematica kernel from UNIX command line without having the init.m loaded, but not by simply deleting or commenting out it before hand? If this is a Mathematica script, is it ...
0
votes
0answers
86 views

Problem with strings imported from PDFs

I am currently working with a list containing around 20 strings which contain around 30,000 characters each. The strings are imported from PDFs and the list containing all the strings is assigned to a ...
4
votes
1answer
150 views

How to create a plot of the volume between three surfaces

I need help creating a plot that I can manipulate the variables for the volume between three surfaces. I am trying to make it look like this example here: ...
14
votes
1answer
288 views

How to constrain memory usage on HPC?

I found the performance of built-in function MemoryConstrained is very poor. It stops the evaluation after the memory limit has already been exceeded greatly than ...
0
votes
0answers
64 views

Fitting data set with series expansion

I have a function given in a form of a list: ScalarField={{$\epsilon$,$y_1$},..{1,$y_{3000}$}} It is defined in the range $(\epsilon,1)$ (spacing between grid points is homogeneous), where ...
1
vote
1answer
82 views

Transpose a ragged triangular matrix and display as columns rather than rows

I have a triangular list of lists as follows: ...
0
votes
0answers
67 views

Widget - GUI help

I was wondering if someone could explain me the code written below (example File Dialog from mathematica). Especially the part with returnValueand ...
1
vote
3answers
160 views

Pure function inside another pure function

I have the following working expression: In[15]:= Length[Select[IntegerPartitions[10],First[#1]==5&]] Out[15]= 7 But, instead of using the constant 5 I want ...
0
votes
3answers
322 views

How to get back name of the number from Max function? [duplicate]

So I have this question, using a toy example: a={1,"this"}; b={2,"that"}; result=Max[0,a[[1]],b[[1]]] the result will be 2. However what I want to obtain is ...
4
votes
0answers
63 views

Rearrange cells without cut-paste

When working in a Mathematica notebook, I often want to reorder cells. Most of the time, I am adding cells at the bottom of the notebook, until I realize it may be better to insert this calculation at ...
4
votes
1answer
103 views

NDSolve`ImplicitRungeKuttaGaussCoefficients doesn't work

I am using Mathematica 9.0 on Ubuntu. I tried the first example from this documentation page, but it returns unevaluated: ...
3
votes
1answer
90 views

Is there really a bug in the following code, taken from the reference documentation for PetersenGraph?

PetersenGraph[5, 2, EdgeLabels -> {8 \[UndirectedEdge] 9 -> "hello"}] appears to evaluate perfectly, as expected, but in my version 9.0.1.0, the option ...
5
votes
1answer
457 views

How to map an image to get an illusion of 3D

I would like to distort or map a given jpg so it looks 3D as in the following youtube video: http://www.youtube.com/watch?v=IfCCUd8mFtg. I usually use conformal mapping (a complex function) to do my ...
10
votes
1answer
102 views

Aborting from inside a ScheduledTask

If you have an Abort[] inside a ScheduledTask expression, what does it abort? The scheduled task evaluation, or any main kernel ...
0
votes
1answer
70 views

Trouble avoiding computation in DynamicModule when input field is not defined [duplicate]

I'm having trouble detecting when my InputForm supplied String variable has a value. After looking at: How to compute values only if input fields are filled? I tried a StringQ test: ...
2
votes
1answer
147 views

Run kernel script in cygwin without window popping up

I'm calling mathematica scripts running kernels through a cygwin terminal, which are again executed from c++ code. When I do this a window pops up, prints warnings and errors if there are any, and ...
1
vote
1answer
94 views

Manual CellGrouping option causes crash at cell evaluation

Update: Try to reproduce this behaviour with CellGrouping set to manual. To do that: either evaluate ...
0
votes
2answers
125 views

NIntegrate using Boole doesn't work

This doesn't want to work for me - I don't know why not. It usually gives me 0, but sometimes also a different number. I know it should be a small, non-zero number. ...
1
vote
1answer
125 views

Solve returns a wrong answer

I'm afraid the following is rather localized questions, but I don't know how to simplify and generalize it. I have the following two points (in the real plane): ...
4
votes
2answers
126 views

Can one use Map during Expand?

Can one Map a simplifying function to the summands of an Expand before fully expanding the expression in question first? ...
3
votes
3answers
250 views

How can I calculate a combination of limit and sum?

How can I solve the above problem? I enter it as: Limit[Sum[Sqrt[1 + i^2/n^2]/n, {i, n}], n -> Infinity] but this is not working:
0
votes
1answer
202 views

How to graph in Cylindrical coordinates in 3D

I need help figuring out how to plot in cylindrical coordinates. I read that CylindricalPlot3D was replaced with ...
6
votes
1answer
166 views

Custom image as plot marker

Is there a quick and easy way with Graphics to replace the standard data points in a plot with a custom image?
3
votes
2answers
125 views

Arrowhead as MeshStyle or PlotMarkers for ListLinePlot

Is it possible to use the Meshstyle option of the PlotMarkers option in ListLinePlot to have ...
2
votes
1answer
101 views

Shortcut to insert plaintext?

Oftentimes I would find it useful to insert plaintext, to not be evaluated as input, right next to my input code. Is there a shortcut key to insert such a plaintext input box? I have relied on ...
0
votes
1answer
78 views

How to find coordinates of an abstract vector relative to a basis

Let's say I have a degree 3 homogeneous polynomial over variables $x0, x1, x2.$ There are then 10 distinct monic monomials, forming a basis of the vector space of polynomials of degree 3. If I have ...
6
votes
1answer
231 views

How to type binomial coefficient $\binom{n}{k}$

I know how to type a fraction as you would write a fraction in Mathematica (9). How do you type Binomial[n,k] as $\binom{n}{k}$ in Mathematica? Is there a single ...
2
votes
2answers
112 views

Plot with sum and binomial command

A few days ago I asked about a problem with plotting a sum. You advise me to use Evaluate option, and that helped me very. But now I have a very similar problem, but i can't find the mistake. I have a ...
3
votes
0answers
36 views

up arrow works in math version 9, fails in math version 8 ^[[A [duplicate]

I have strange up-arrow behavior on command line Mathematica 8 versus Mathematica 9. Version 9 gives me history, where version 8 fails with escape codes. Any way to make them both work on the same ...
11
votes
10answers
512 views

How to pick increasing numbers from the list

How to pick increasing numbers from the list. lst = {5, 3, 6, 2, 7, 4, 8}; out: {5,6,7,8} So many interesting ...

15 30 50 per page