41
votes
9answers
2k views

Levels: how do they work?

I cannot understand how Mathematica manages levels, and so it's always a painful try-and-fail to use Flatten. Can someone please give me a very clear definition? ...
0
votes
1answer
48 views

Diff eqs can be solved?

I'm trying to solve a pair of coupled differential equations, but am having trouble making DSolve evaluate my equations. ...
4
votes
2answers
70 views

Filtering of an unwanted frequency through a Fourier Transform

I have a data set with evenly spaced data points. The plot is frequency vs. intensity. The overall shape of the plot is an upwards curve into a plateau, this cannot be seen in the data as this is an ...
-2
votes
0answers
35 views

Mathematica's steps towards the result of a definite integral

I am interested in this definite integral: $$ \eqalign{\int_0^\infty {x^2 \log(1-e^{-x})}\; dx\cr } $$ That is: ...
1
vote
2answers
20 views

How to write a function that returns the combined output of several built-in functions

I am trying to make a module that takes a Boolean function, and prints the following: the function's truth table the function's NOR epxression the function's minimal Disjunctive normal form So far ...
1
vote
0answers
8 views

Manipulate - 3 sliders for a list of 3 elements

I'm trying to create a slider for a list of 3 elements. I know that I can create a 2D slider for a list of 2 elements and it's impossible to create a 3D slider for a list of 3 elements. So, I just ...
0
votes
0answers
10 views

FindDistributionParameters fails to find a mixture of user defined sinh-arcsinh distributions

I have some data (1593 values). I first binned it using the Knuth rule and fitted a function that is a linear combination of two sinh-arcsinh functions. I then ...
1
vote
0answers
13 views

How to hide and show graphics within Show[] function (in Manipulate wrapper)

There is a well documented way to "Dynamically Hide and Show Plots" (link). In the example 'Opacity' option is effectively used. Is there an efficient way to make the same functionality with "Show"? I ...
8
votes
1answer
101 views

Does Mathematica have an equivalent of C's nextafter?

In C (and many other programming languages), there is a function double nextafter(double x, double y) which takes two (IEEE 754) floating-point numbers and ...
12
votes
0answers
436 views
+50

Import an SPSS, SAS, or STATA file into Mathematica

I would like to import the World Value Survey data file into Mathematica, but it's only given in spss, sas or stata formats, which are statistical analysis softwares format I think. I can't get to ...
0
votes
1answer
47 views

nonlinear differential equation

For such a equation $$-y''(x) + x^2\cdot y(x) - |y(x)|^2\cdot y(x) = 0$$ with initial conditions: $y(-500) = 0$ and $y(500) = 0$. I write in mathematica ...
1
vote
1answer
44 views

Map with multiple arguments

I have a function f[m,n] and a list of arguments args = {{m1,n1},{m2,n2},{m3,n3},{m4,n4}, ...} that I want to apply to it. I ...
0
votes
0answers
39 views

Eigenvalues of the nonlinear Schrödinger equation

As an exercise I have to deal with a nonlinear time independent Schrodinger equation eigenvalues and eigenfunction, ...
-3
votes
0answers
80 views

Swing of the pendulum [duplicate]

I would like to visualize a swing of the pendulum. I want to write a function springmass[z, nzigzag], which will draw the spring (line) and the swinging weight ...
-2
votes
0answers
24 views

Goldbach Conjecture …Every even integer > 2 is the sum of two prime numbers.Find a program in mathematica to solve this problem [on hold]

Every even integer > 2 is the sum of two prime numbers and Each odd integer > 5 is the sum of three prime numbers USING THE SIEVE OF ERATOSTHENES....
1
vote
0answers
23 views

ANOVA test on dataset

I have a dataset with 3 groups and two variables. I want to do ANOVA test on the three groups for each variable. Does anyone know how to do this? ...
10
votes
1answer
273 views

Drop selection of columns from a ragged array

I have an application where I need to drop some arbitrary list of columns from a ragged array (where of course the shortest array rows have at least all the specified columns). E.g., given a ragged ...
4
votes
2answers
127 views
0
votes
0answers
14 views

Recurrent equations [duplicate]

I want to make a relation to show the first 7 elements that don't have the number 7 in it. So far i know how to make it to show the first 7 elements with RecurrenceTable[{a[n + 1] == 7 a[n] + a[n], ...
9
votes
2answers
153 views

Build an InterpolatingFunction with ElementMeshInterpolation

Suppose you have a function f[t_, x_, y_] := t (1 - x^2 - y^2) defined for {x,y} in ...
1
vote
2answers
109 views

Expressions containing globally undefined symbols inside a function where they are defined

Consider the following code. f[a_,b_]:=x; Clear[a,b]; x=a+b; f[1,2] It returns a+b. However, from a certain viewpoint, one ...
26
votes
1answer
786 views

How do you set attributes on SubValues?

SubValues, as discussed in a previous question, are declared as follows ...
8
votes
3answers
326 views

How to write a function-defining function which stores the function arguments in a stack?

I have a function-defining function SetAttributes[DefFn, HoldAll]; DefFn[f_[args___], body_] := f[args] := body; I am trying to modify this function to record ...
2
votes
1answer
59 views

Evaluate recursive funtion as a whole before computing a recursive step

I'll try to make a basic example of my problem with $n$ being an array of elements, ex. $\{1,2,2,3,3,3\}$: If i have a sum which needs a computed value i would like to compute it beforehand and store ...
7
votes
2answers
67 views

Undo history cleared after removing comments - bug?

If I've written some code followed by a comment, like this: x(*y*) and I remove the comment by first removing the right delimiter and then the left, my undo ...
-3
votes
0answers
73 views

Creating truth tables

Hello guys i need help about this problems: I should write module in mathematica which receive function f. Module should write on screen: -Truth table of function f -Boolean expression which contains ...
11
votes
5answers
365 views

How can I generate and randomly assign color to annular sectors?

How can I generate such an image and fill every annular sector with a random colour?
8
votes
1answer
87 views

How can I make FilledCurve smoother?

In How can I generate and randomly assign color to annular sectors? J.M. showed an interesting way to create a sector graphic using FilledCurve. Unfortunately it ...
1
vote
1answer
54 views
0
votes
0answers
19 views
1
vote
0answers
134 views

How to write my own interpolation method

I was comparing results of spline interpolation in Mathematica and C++/gsl-library Results of interpolation are different if I use ...
9
votes
2answers
180 views

Does Mathematica have an equivalent of Python's float.as_integer_ratio?

The Python programming language has a float.as_integer_ratio(x) function which exactly converts an IEEE 754 floating-point number into a numerator/denominator pair ...
13
votes
5answers
365 views

No response to an infinite limit

Trying to compute this limit, things seem to get frozen, even for hours. What would you recommend to fastly compute it? ...
3
votes
4answers
168 views

Evaluating Erf[x] in arbitrary precision

Is it possible to evaluate Erf[200] with arbitrary precision? I only get 1. as result but I would like to know if a arbitrary ...
3
votes
3answers
169 views

What is the best way to write a polynomial in the Bernstein basis?

The Bernstein basis of polynomials of degree $n$ is the set of polynomials of the form $$\binom{n}{k} t^{n-k}(1-t)^k$$ where $0 \leq k \leq n$. What is the best way to transform a given polynomial ...
-3
votes
0answers
19 views

physics - swing of the pendulum [duplicate]

I should visualize a swing of the pendulum. I should write a function springmass[z, nzigzag], which visualize the spring (line) and the swinging weight (rectangle) ...
0
votes
0answers
86 views

How can I make a pretzel shape using bezier curves?

I am trying to make a pretzel shape,but I cannot seem to get the loops even. Eventually, I need to make the pretzel shape loop in 3D so I need to nail the 2D concept first. Here's what I have so far. ...
2
votes
1answer
43 views

Forcing a locator button to remain on the surface of a sphere

This question may or may not be possible and might be a hard one to answer. Suppose that I have a sphere centered at the point (1,2,-1) with radius 3. Is it possible to place a locator button on the ...
12
votes
3answers
381 views

Arbitrary precision spline interpolation

Current implementation of Interpolation does not allow arbitrary precision spline interpolation. Yu-Sung Chang say here that "it is not hard to implement it ...
8
votes
2answers
514 views

Is there any fast way to solve a quadratic matrix equation in Mathematica approximately?

Let the square nonsingular matrix $M$ is a given convergent matrix. What are the best scalar values for $\alpha$ and $\beta$ (in the real numbers domain), at which the following quadratic matrix ...
1
vote
1answer
60 views

Changing from Dashed to Solid

I have: Graphics[{ Blue, Thick, Arrow[{{0, 0}, f1}], Arrow[{{0, 0}, f2}], Red, Arrow[{{0, 0}, f1 + f2}], Dashed, Blue, Line[{{-9, 0}, {12, 0}}] }] ...
8
votes
1answer
281 views

What algorithm does Plot use to determine abscissas?

(I'm hoping this question is not hopelessly naive...) My understanding is that Plot's strategy is to generate a list of abscissas, evaluate the argument expression ...
12
votes
2answers
212 views
+50

Transform an expression to remove the singularity

I have the expression Sin[c x]/c. Clearly it is undefined at $c=0$, but that is merely a removable singularity, since $$\frac{\sin(cx)}c=x\frac{\sin(cx)}{cx}= ...
2
votes
2answers
136 views

Gradient in a plotstyle

I'm trying to replicate the figure below. Now a nice first approach to do this is by using Mathematica, by making some kind of contourplot with circles and just add a gradient to the contourstyle. Now ...
11
votes
1answer
138 views

Regime Change Stochastic Process

I would like to simulate an Ito process in which the drift and diffusion terms change after hitting a boundary for the first time. For example, a Geometric Brownian Motion X which has 0 drift and ...
0
votes
1answer
33 views

How to reduce trigonometric expressions under special conditions

For the following problems I used "FullSimplify" and "TrigReduce" but I manage to reduce more ...
2
votes
1answer
43 views

Transformation syntax with shortcuts to a more explicit syntax for an equation

I would like to write the following code line without the signs @#%^&*?! Sequence @@ (XMLNote[#1, m] &) /@ attributes I have made this code but it seems ...

15 30 50 per page