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

learn more… | top users | synonyms

1
vote
1answer
135 views

Passing a joined list of symbols for Module or Block to treat as its own local symbols

The Question I'd like to write a function which itself takes a list of symbols, e.g. Foo[{x, y, z}] to pass to Module ...
5
votes
1answer
318 views

How to express an expression with only ArcTan and ArcTanh?

I have an expression which is simply (j/k) x^(j/k) LerchPhi[x,1,j/k)] where 0 < j < k. Manually I have been able ...
6
votes
1answer
160 views

The third argument of the Root function

Consider the roots of an arbitrary indecomposable polynomial: sol = Solve[x^5 + 2 x + 1 == 0, x] The returned expression is ...
0
votes
1answer
88 views

Is there any automatic method for rating function arguments importance?

If I have a function: y = 2a + 5b + c It can be easily seen that b is the most important parameter, next ...
0
votes
1answer
69 views

Stop function evaluating input at time of definition [duplicate]

I would like to create a function that acts on whether the input is even or odd, e.g.: In[644]:= f[a_] = If[EvenQ[a], 2 a, 3 a]; f[2] Out[645]= 6 I've ...
2
votes
2answers
175 views

Generation function of recurrence sequence

I'm trying to find generation function of recurrence sequence ...
6
votes
1answer
114 views

Strange behaviour of Internal`InheritedBlock

I was going to post an answer for fast way to replace all zeros in the matrix. I was even quite happy because timings were the same order of magnitude as others. The idea was to overwrite ...
5
votes
2answers
229 views

Random Matrix with integer coefficients and inverse also having integer coefficients

I'm trying to build a function that gives me matrices such that each: Has integer coefficients. Is non singular. Has inverse which also has integer coefficients. I have some code that one of my ...
-2
votes
1answer
271 views

Gamma Incomplete Function representation in Mathematica and Matlab

I am confused about Gamma Incomplete function calculation in Mathematica and MatLab: For example, in Mathematica: Gamma[5,3] = 19.56 But in MatLab: ...
4
votes
2answers
602 views

ArcTan[z] and ArcTan[x,y], Restriction and Conversion

In Mathematica there are two different forms for the arctangent (inverse tangent), namely ArcTan[x,y] which gives the arc tangent of $y/x$, taking into account ...
1
vote
0answers
32 views

Pattern matching list elements in pure functions [duplicate]

Pattern matching here is a functional programming term, but it might be called differently in Mathematica, I'm not sure. It is possible to match the elements of the list in a regular function ...
5
votes
0answers
196 views

Is everything in Mathematica ultimately stored as a rule?

My current understanding about Mathematica is that everything, at the lowest level, ends up as replacement rules. First question: is this true? Second question: does Mathematica "gloss over" these ...
5
votes
2answers
152 views

Strange Behavior when making Equal Listable in Pick

While trying to make this problem more efficient I tried different methods and dabbled with making Greater and Equal ...
1
vote
1answer
113 views

Defining a function of a distribution

I have a discrete- time and space markov process that I want to evolve given an initial distribution. To that, I defined ...
1
vote
1answer
189 views

Split Lingustic(IPA) at Words Unique Sounds

How might I split a word at each IPA of each unique sound. For example {"pray", "wade"} (* {{"p","r","ˈeɪ"}, {"w","ˈeɪ","d"}} *) ssch answered a question here ...
11
votes
4answers
309 views

Using With to scope over pure functions

Consider this example: given an option for a function func as "x" :> (a&), how can one assign different values to ...
1
vote
0answers
132 views

parameter NDSolve

the question I need to solve is: t x'[t] == -x[t] + y[t], t y'[t] == -5 t^2/x[t]^2 + x[t] - y[t], x[1] == 4, x[b] == 1 in order to solve the coupled ...
2
votes
2answers
584 views

Q-Function representation in Mathematica

I observed that there is no Q-function representation in Mathematica. The definition of Q-Function is: \begin{align} Q(x) &= \frac{1}{\sqrt{2\pi}} \int_x^\infty e^{-\frac{u^2}{2}}du \\ ...
3
votes
3answers
188 views

What is the formula for this numerical series?

I'm developing a questions game. My goal is that the score for each correct answer will increase as the user answers more questions. Initially there are 15 points for each correct answer. Every 4 ...
9
votes
1answer
201 views

Limit of sequence of functions behaving strange

I'm trying to determine the limit of the sequence of functions $$f_n(x)=\left(\frac{1}{\pi}\arctan(n x) + 1/2\right)^n. $$ I define ...
2
votes
2answers
168 views

Write 199319989756262759279209 = 5x + y, where x and y are integers

$\frac{199319989756262759279209}{5} $ = $ 3.9864\times 10^{22}$ according to Mathematica, but I would like to see this number exactly in decimal form (not in scientific notation). I'm attempting to ...
6
votes
2answers
112 views

Why is ToRadicals[] not able to handle all cases? Is there a workaround?

The documentation for the function ToRadicals says: ♦ There are some cases in which expressions involving radicals can in principle be given, but ...
1
vote
2answers
242 views

Heron's formula for area of a triangle [closed]

Use the first form of Heron's formula to give a function areah, which gives the area of a triangle. Test your answer on the isosceles triangle ...
5
votes
0answers
84 views

Is there something like MaxProcessorUsed?

For standard procedures it is easy to test if the implementation is better or worse than other by using Timing etc. It does not help us with creating ...
14
votes
1answer
339 views

How to represent a continuous monotonic phase of Airy functions?

Note: In this question I am concerned only with real-valued variables and functions. DLMF, §9.8 Airy Functions, Modulus and Phase, formula $9.8.4$ defines the phase of Airy functions: ...
0
votes
4answers
62 views

Don't understand why Do-loop index is not evaluated in Play expression

So here is some weird behavior: When I create a list inside a loop whose elements are Play functions, with arguments that depend on the counter, it is as if the counter is being stored symbolically, ...
0
votes
1answer
219 views

How to combine two usages of # into one and speed up the code?

I have a function num with two variables, matf and matg. How can I combine the last two lines of code below into one? The code is aimed to find out the maxiaml count bel when we give each $i3 = ...
1
vote
1answer
201 views

function returning 0

Why is my function returning 0? ...
1
vote
1answer
87 views

Issues with creating functions [duplicate]

Sometimes when I try to create a function inside a function, Mathematica gives me a hard time. I usually just have to play around with the syntax until it gets something it "likes" but I really have ...
3
votes
1answer
73 views

What is the syntax to combine conditions and options? [duplicate]

How can a condition and an option be written on the RHS of a function? I.e. ...
6
votes
0answers
147 views

Finding hidden treasure (aka finding undocumented functions) [duplicate]

I was searching for a way to determine if a point is within a polygon and stumbled upon rm -rf's answer. (actually, I really wanted to find a point within a ...
5
votes
2answers
715 views

How to find the non-differentiable point(s) of a given continuous function?

For example, the non-differentiable point of the function $f(x)=|x|$ is at $x=0$. How to find the non-differentiable points of a continuous function that is defined numerically?
8
votes
3answers
417 views

Create sine function with random increase in phase

I am trying to simulate a signal that randomly increases its phase, so far I have tried two thing but neither worked. I usually use matlab but I want to learn some Mathematica so I thought I would try ...
0
votes
2answers
105 views

Summation limits [closed]

The Sum is a built-in function in Mathematica, so the summation limits must be assigned. What I need to know is how to use a value computed in a separate ...
1
vote
2answers
194 views

How to apply function f for each time value t, to each pixel from image, resulting in t images

I have a 2D array of complex values and I want to apply a function to every entry of the array, for every timepoint t in a list. I know how to apply my function to one entry for every time t in a ...
4
votes
1answer
209 views

Creating a function to simplify WolframAlpha query

When I can't remember an integral I usually just query wolfram and have it show steps. This was my naive attempt at trying to make a simpler function. ...
3
votes
0answers
90 views

Gather dependency on list order?

I get intrigued about Gather behavior on this post. I thought that Gather was invariant under list order? Here is the result I ...
2
votes
1answer
105 views

How to define a function of z[bar], etc

Using Displaying index as subscript on output: e.g. C[i] -> C_i with Notation[...] or Interpretation[..]? I have often ended up wanting to define functions of annotated variables to better match my ...
1
vote
2answers
442 views
5
votes
1answer
157 views

Why does MapIndexed return the index in a list?

MapIndex returns the index in a list instead of as shown in my revised example. I can work with it (or work around it), but what's the design concept? It seems ...
4
votes
1answer
139 views

How hide symbolic definition of a function?

How can the actual definition of a function be hidden from a user? I want the user of a notebook to be able to evaluate a real-valued function f of a real variable at any particular numeric input yet ...
4
votes
4answers
332 views

How to find the maximum of a function on a set of discrete points?

How to find the maximum of a function on a set of discrete points? For example, what is the best way to find the maximum of ...
4
votes
1answer
182 views

Simplifying polynomials in non-commutative variables

I would like to be able to simplify a polynomial in two non commuting variables, the desired result being that in every term one variable occurs to the left of the other variable. An example would be ...
6
votes
2answers
378 views

Obtaining the name of a variable as a string [duplicate]

Suppose that I have an arbitrary variable myVariable. Is there some function fun -- either built-in or one that I can define -- ...
0
votes
1answer
105 views

Nested function problem [closed]

I have trouble defining the following function in Mathematica sp[M_, u_] := 1/Sum[u^k M!/(M - k)!, {k, 0, M}] After defining it Mathematica displays an error. ...
15
votes
8answers
393 views

Is it possible to use RandomChoice to choose without other choices being evaluated?

I'm trying to do this: i1 = 1; i2 = 1; RandomChoice[{ (i1 = i1 + 1), (i1 = i1 - 1), (i2 = i1 + 1), (i2 = i2 - 1)}] In order to chose randomly which ...
0
votes
1answer
77 views

Log is not being evaluated inside Grid [closed]

My command is: Grid[{{N, logN!, N log N - N}, {10, Log[10!], 10 Log[10] - 10}}, Frame -> All] In the second row of the grid, the function ...
2
votes
2answers
836 views

How to enter an equation into FindFit?

I have the equation ...
0
votes
2answers
219 views

Apply a function to a matrix of vectors [closed]

I have a matrix containing on each position a pair of numbers $(a,b)$. I would like to compute the norm of each vector $(a,b)$ and keep the result in form of a matrix. So basically, I need to apply ...