Questions about the use of built-in Mathematica functions, including pure functions.

learn more… | top users | synonyms

3
votes
2answers
253 views

How to create a function like in Python

I want to call a function that would perform a function rather than assigning an expression to them. I.e. ...
0
votes
0answers
26 views

Autocorrelation issue

I am analysing time series and want to know if it is autocorrelated. I use AutocorrelationTest[data, 1] and get The data contains ...
0
votes
0answers
26 views

Plotting function with small values in Mathematica [on hold]

I've got an issue in Mathematica, just can't figure it out, I've looked on any reference I have available. I am doing something basic, need to plot two functions together. However, my plot shows ...
5
votes
1answer
171 views

Why doesn't this pattern work? [on hold]

I want the in-built function Count to count the elements in a list which are greater than a value. Example: Count[{1, 1, 2, 3}, (# > 1.5) &] Why doesn't ...
0
votes
2answers
53 views

How do I get a Do function to create a list?

I have a Do function which gives me a column of expressions. How can I get the Do function to give me these expressions in a list. i.e The do function gives me this: a b c d I would like it do give ...
0
votes
2answers
63 views

Problem in downloading “ToMatLab” package [duplicate]

Iam trying to download "ToMatLab" Package from http://library.wolfram.com/infocenter/MathSource/577/ but it is showing me an error message by showing a big question mark and "File could not be ...
0
votes
1answer
63 views

Functions in functions

I have three functions f(x,y) , g(t) , and h(t) and somehow I have to find (d/dt)f(g(t),h(t)) where t = 0. How would I go about writing this in Mathematica? In this equation g(t) is taking place of x ...
0
votes
2answers
147 views

Time value of Money Functions combined

I am trying to combine multiple functions into one. I have defined following functions: (PV refers to Present value, FV refers to Future value, i or IPER refers to interest per period, pmt refers to ...
2
votes
3answers
128 views

Extracting coefficients from a power series

I have a function defined explicitly as a power series: $$\sum_{n=0}^\infty{T_n}\frac{x^n}{n!}=\frac{\frac{x^3}{3!}}{e^x-1-x-\frac{x^2}{2!}}$$ and I would like to extract the coefficients $T_k$ as ...
12
votes
5answers
428 views

How can I evaluate only a single step of a recursive function?

Let's say have a simple recursive function for the Fibonacci sequence f[0] := 1 f[1] := 1 f[n_] := f[n - 1] + f[n - 2] but I want to see how it will expand in a ...
0
votes
2answers
93 views

Collapsing summation

I am trying to write a command to collapse the sum of terms into an expression with summation. Something like ...
5
votes
3answers
95 views

How to deal with the condition $u_i=u_{i+1}$ in B-Spline basis function?

The defintion of B-Spline basis function as shown below: Let $\vec{U}=\{u_0,u_1,\ldots,u_m\}$ a nondecreasing sequence of real numbers,i.e, $u_i\leq u_{i+1}\quad i=0,1,2\ldots m-1$ $$N_{i,0}(u)= ...
4
votes
2answers
197 views

Cleaning up InverseLaplaceTransforms in Mathematica

I am attempting to use Mathematica to model an electrical circuit in the s domain. The circuit contains capacitances and and inductances. I've written a series of equations using Kirchoff's laws to ...
2
votes
3answers
59 views

Conditional replace of a column

Im trying to replace the value in the Nth column of a list if a condition is true, returning the modified list. I've tried modifying the answer from 61219 and been through most of related questions ...
0
votes
1answer
51 views

What does this Append expression do? [closed]

I have to understand some code. A part of it is written below. Can someone explain to me what it does: ...
-4
votes
0answers
26 views

How does the Round function work? [duplicate]

I should use the Round function in my code. I am interested in functions like Round[#]. For example how does ...
1
vote
2answers
97 views

function of derivative of a function

I know a similar question is answered somewhere, but it doesn't work for my case for some reason. I have the following problem in Mathematica. I want to compute f[h[x]]= x^2 + D[h[x],x]. Here, h[x] ...
1
vote
2answers
92 views

How to explain NDSolve that functions must be positive only?

I have a simple system of differential equations to solve but both functions should be positive: x[t] > 0 and y[t] > 0 for all t. I was not able to explain NDSolve this fact so it goes x[t] < 0 ...
0
votes
1answer
34 views

Rigging a function to output a distinct value every nth call

There's some fixed script I am unable to alter (keeping things simple: Table[f[i], {i, 1, 10}]), , however, I can alter a function that the script calls (again, ...
0
votes
1answer
29 views

Trouble definining a function to use only certain heads

I'm trying to write a function that accepts only a particular Head (for example, prints only Symbols) using pattern matching. However, the following code has me a bit of confused. ...
4
votes
4answers
489 views

Generate random points in a region with higher probability in a sub-region

I am trying to generate random samples of points in the unit square in such a way that points inside a given circle are twice as likely to be selected as points outside of that circle. I tried to ...
4
votes
4answers
84 views

CoefficientRules for negative powers

CoefficientRules acts like the following. ...
4
votes
1answer
219 views

Mathematica doesn't simplify a simple expression

The question is simple as that. I have: ...
0
votes
0answers
39 views

How can I mix // with a function of two arguments? [duplicate]

I often find myself using // when playing around with expressions, but it is always cumbersome to have to switch to the full notation just to apply a function of ...
1
vote
2answers
68 views

How to define a function that counts the exponents

I want to define a function $F$ described as follows: The input of $F$ is a polynomial such as m*u*x^4*y + n*v*x^2*y^3 where $m$ and $n$ are constants, and ...
1
vote
0answers
33 views

Analog of GeneratingFunction for Newton series [duplicate]

GeneratingFunction gives the generating function for Maclauren series. I wonder if there a similar function for Newton series. If $$g(x)=\sum_{k=0}^{\infty}\frac{x^k}{k!}f(k)$$ Then g(x) is ...
0
votes
1answer
417 views

Computing the fundamental matrix and its monodromy matrix

Assume $\dot x(t)=v(x,t)$ is a $T$-periodic, with respect to $t$ dynamical system. That is: $x\in\mathbb R^n,\quad t\in\mathbb R,\qquad v(x,t+T)=v(x,t)$. Let $x_0$ be a smooth periodic solution in ...
1
vote
1answer
22 views

Expand Expression with Nested Special Functions [closed]

I am trying to study the following sequence for $a=1$, $n \ge 1$: $$\alpha_n=(1-aq^{2n})\sum_{j=0}^{n}\frac{(aq;q)_{n+j-1}(-1)^{n-j}q^{\binom{n-j}{2}}}{(q;q)_{n-j}(q;q)_j^3}$$ using Mathematica, where ...
73
votes
8answers
6k views

List of compilable functions

Is there somewhere a list on the functions that Compile can compile, or the cases in which a particular function can be compiled that I haven't found? I'd be glad ...
1
vote
0answers
28 views

Central binomial coefficient [closed]

I am tasked with creating a recursive definition of the binomial coefficients that stores previously calculated values. this is what I have: ...
0
votes
1answer
58 views

Applying natural log to a table of values [closed]

I know this is a simple question, but I am new to Mathematica. How do I go about natural log to a table of values? I tried this: ...
19
votes
3answers
900 views

Visualisation of a recursive function

Is there a way to nicely visualize recursive functions? (diagrams/plots) More specifically I'm looking for a way to make contrast (visually) between e.g. the cosine function which if continuously ...
8
votes
2answers
174 views

Is there a way to revert to the built-in function after overwritting it using Unprotect

When using Unprotect, we can overwrite a functions definition: Unprotect[Sqrt] Sqrt[x_]="blahblah" Protect[Sqrt] Once this is done, can we revert to the built-in ...
13
votes
3answers
564 views

Fitting ellipse to 5 given points on the plane

Five points are required to define a unique ellipse. An ellipse has five degrees of freedom: the $x$ and $y$ coordinates of each focus, and the sum of the distance from each focus to a point on the ...
4
votes
5answers
217 views

Replacing columns of a matrix with zeros

I am to create a function that replaces columns 'm' through till 'n' with zeros. Here is what I have so far: ...
2
votes
2answers
277 views
0
votes
1answer
47 views

How to use “Compile” function when argument is array of size 500? [closed]

How to use "Compile" function when argument is array of size 500? The examples in the Mathematica help is just with one argument belonging to the real numbers. Any help would be appreciated. ;)
3
votes
1answer
114 views

How do I format Compile[] correctly?

My Mathematica skill is still rusty, so kindly bear with me. I'm having problem formatting expression to compile the function correctly: $\sum _{g=1}^G \sum ...
2
votes
3answers
105 views

Function to Expand exponentials

Is there a function similar to PowerExpand which expand exponentials? This would, for example, take Exp[5(a + b)] and ...
6
votes
5answers
369 views

Find function inverse

I'm trying to find the inverse of a function: (30*x^2 (1 - x)^2) (* where 0<x<1 *) I tried all the following options: 1. ...
6
votes
2answers
99 views

Modifying parameters: Set::setps in the part assignment is not a symbol [duplicate]

Ok, this will probably be a silly question, but I can't get my head around it. I'm making a simple module that, given a list and two integers, will swap the position of the elements in the ...
2
votes
1answer
62 views

JordanDecomposition in Mathematica

I'm trying to find the Jordan Decomposition in Mathematica for $$ A=\left( \begin{matrix} 2& -5& 8&-12\\ 1& -2& 4&-8\\ 0&0&2&-5\\ 0&0&1&-2 \end{matrix} ...
-1
votes
1answer
80 views

Similarity of two plot to each other [closed]

I want get the similarity of two different plot by Percent ... I have many plots for comparison like below : y : ...
5
votes
1answer
119 views
5
votes
2answers
136 views

Biot-Savart Law/Magnetostatics Solution

I am working on solving the Biot-Savart Law equation for the magnetic field around a charged ring of uniform current density. The expression that Mathematica gives is rather nasty, as expected. Notice ...
56
votes
2answers
2k views

Flatten command: matrix as second argument

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...
1
vote
1answer
105 views

StreamPlot in Mathematica

A $2\times 2$ linear ODE system can be visualized by StreamPlot in Mathematica. For example: ...
2
votes
1answer
97 views

Ted's explanation for the 3rd argument of ListCorrelate doesn't apply to the {1, -1} case?

I was reading Ted Ersek's explanation for the usage of ListCorrelate(.nb version can be found here) and noticed something confusing. It's the third example of ...
-1
votes
1answer
21 views

Iterator bounds error when defining function [closed]

It's been a while since I've done any multi-line functions in Mathematica, so maybe I'm just missing something. I've created the following function, and I immediately get an Iterator bounds error when ...
1
vote
2answers
100 views