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

learn more… | top users | synonyms

1
vote
3answers
112 views

how to find circles that intersect a square

I use the following (based on ideas and functions I got as ansers in [1], [2] by, repsectively, @ybeltukov and @J.M.) in order to find random circles with centers inside a unit square that intersect ...
4
votes
3answers
186 views

Make own rule for multiplication

I'm new to mathematica, so I still cannot use it properly. I want to do symbolic programming. My question is : is there any way to define our own multiplication. Suppose $a,b$ are arbitrary ...
7
votes
6answers
1k views
0
votes
1answer
67 views

Need help in writing loop to assign value and calculate the called function [closed]

First of all sorry if my question is very simple as I am beginner in Mathematica. I want to add a loop at the beginning of the code to assign different values for ...
1
vote
1answer
40 views

Apply Grad and Mod to Matrix

Let f:=x^3+y*x*z+z^3; Let mat = {{2, 2, 2}, {3, 1, 7}, {1, 6, 3},{4, 5, 1},{0,4,9}}; be a list of points . I want to compute ...
2
votes
1answer
78 views

How to put the result of NDSolve in a function?

I have solved an ODE with NDSolve, and put the result in S: S = NDSolve[{y'[x]==(y[x]^4+y[x]+1)^(1/2),y[0]==0}, y, {x, 0, 100}] But i don't want to plot y[x] ...
3
votes
1answer
54 views

Automatically discover the class of an arbitrary matrix

In Wolfram|Alpha it is possible to discover some specific classes to which a matrix belongs. For instance, typing this in Wolfram|Alpha ...
0
votes
2answers
64 views

List of points of an increasing sine function

I'm trying to obtain a list of the points of an amplitude-increasing sine function. I would like to give a certain value for input, e.g. 0.5. Sine will start increasing and decreasing from this point, ...
0
votes
1answer
75 views

Calculate overlap coefficient between two functions

I have two functions and I want to calculate the overlap coefficients between those two functions. A similar question has been answered for Python and R, however, I couldn't find an answer for ...
22
votes
3answers
296 views

How to create a dynamic expanding DisplayForm's styled like the ones in v10?

The display forms for objects like ClassifierFunction are nice clickable boxes I like this, and now I'm trying to create my a custom version of this for my ...
48
votes
2answers
4k views

What is so special about Prime?

When we try to evaluate Prime on big numbers (e.g. 10^13) we encounter the following issue: ...
8
votes
1answer
115 views

What's wrong with MovingMap + Apply[Rule] etc.?

I don't why this happens, I don't know if those two examples are related. I don't have time to investigate, but maybe someone can solve this? ...
1
vote
1answer
40 views

FindRoot::Istol error

I recently tried to find a root with FindRoot in Mathematica. I know that the problem has a solution, but when using FindRoot, this error appears : ...
1
vote
1answer
59 views

Assigning solutions to a variable [duplicate]

If I do Solve[x+1==0, x] then I get {{x -> -1}} But I want to assign the solution -1 directly before seeing the result, ...
3
votes
1answer
73 views

InverseFunction: how can I extract the function inside?

This is probably a trivial question. But I could not find an answer. Given the explicit expression for ft in te assignment ...
0
votes
0answers
56 views

Workaround of non-integer indexed objects? [duplicate]

When using indexed object, I found the behavior of value 0.7 as the index quite strange, then did the following test. The first output cell was executed directly as the second input cell. Have not ...
6
votes
1answer
87 views

Can Mathematica return the order of an element in $S_n$

I want to input an element like Cycles[{{1, 2}, {3, 4, 5}}] and I want Mathematica to return 6, the order of this element in $S_5$.
0
votes
2answers
62 views

How to evaluate function in the grid?

I have a function f[a_, b_]: = b^a + a b. a takes values {1,2,3,4}, and ...
6
votes
0answers
49 views

KeyIntersection fails (?) when an association is empty

I think I found a bug in KeyIntersection (Mma 10.2). To illustrate, input the following: ...
0
votes
1answer
34 views

Why this throw Null^2 Return[e1]? [closed]

I am amazed by the difficulty of Mathematica, due to my OOP background. Why does the following code not return the output I am expecting? ...
2
votes
1answer
53 views

If I want a function only applies to the elements of a specific list, how should I define the function? [closed]

If I define a list: list={1,2,3,4}; and I want a function f to apply only to the elements in the list (for here it is ...
4
votes
4answers
158 views

Numeric range: present or not

There is a formula to test whether a number is included in a range? For example, if 3 is between -2 and 6.
1
vote
1answer
54 views

Simplify the following transformed equation [closed]

y=7f(-1/6(x-1))+1 The base function is f(x)=x^2. I just don't understand where the ^2 went and how to simplify this. Any help is much appreciated, thanks.
4
votes
1answer
48 views

apply a constraint to summation limits

I have a list as list={{-0.5, 5}, {-0.25, 2}, {0, 3}, {0.25, 2}, {0.5, 5}} and I want to use of Esc+sum+Esc symbol for ...
0
votes
2answers
38 views

How to use With on previously defined expressions [duplicate]

The command With[{x = 1}, x] outputs 1. The command t = x; With[{x = 1}, t] outputs ...
0
votes
1answer
75 views

How do I create a function to rotate a rectangle about its origin? [closed]

I am new to Mathematica and was trying some new things. I wanted to rotate a rectangle using a rotation matrix by any angle theta from say o to 2pi. I could do it using predefined Mathematica ...
6
votes
2answers
612 views

How does one clear the memory of a recursive function

I want to implement the recursive function v[n_] := v[n] = v[n-1] + f[n-1] + Random[NormalDistribution[0,s]] to get ...
1
vote
1answer
271 views

Is there a function for falling factorial in Mathematica

If I had to construct a function for falling factorial in mathematica I'd do something like that (hope I'm not mistaken): fallfact[x_,k_]:=$\prod_{j=0}^{k-1}(x-j)$ But is there a built-in ...
7
votes
1answer
669 views

Demonstrating Ackermann's Function

The Ackermann function is an extremely fast growing function. There are some slightly different versions of the function, but the one that I am looking for can be defined as: $$ A_0(x)=x+1 \\ ...
-4
votes
3answers
84 views

x² function (0-3) to solve the Riemann integrate [closed]

x² function (0-3) to solve the Riemann integrate the range What is it that Mathematica code? Please show me the steps
-1
votes
2answers
74 views

The prime numbers between 1 and 100 [closed]

I'm new on this and the help seems not as helpful on this particular subject The prime numbers between 1 and 100 mathematica show steps
2
votes
2answers
129 views

Can Mathematica return the first few terms of a sequence given the first few terms of a Dirichlet Generating Function?

For example: a=Sum[1/n^s,{n,1,6}]; Expand[a^2] returns a big mess. I want to see something like: 1/1^s + 2/2^s + 2/3^s + 3/4^s + 2/5^s + 4/6^s + ... + 1/36^s.
2
votes
1answer
70 views

Interpreting Mathematica's expression for a function domain

When I study the domain my function f: f[x_] := 2/(Cos[x]^2) + 1/Log[Sin[x]] FunctionDomain[f[x], x, Reals] I receive the ...
5
votes
1answer
72 views

What does the Combinatorica function: NumberOfPermutationsByType return?

I am using Mathematica 9. If I input: NumberOfPermutationsByType[{2, 2, 1, 1}] Mathematica returns 1/8. I was expecting ...
14
votes
3answers
385 views

Clever use of DownValues, or failure to understand the “Mathematica Way.”

I needed to look at the changes in the values of about 4000 items from one year to the next. I have a table with identifiers and values for each year. Not all of the items are in each list. The ...
2
votes
1answer
94 views

Domain definition of a function

I study the following equation: f[x_] := (Exp[2*x] - Log[E + x])/(x^3 + Sin[x]*Cos[x]) Plot[f[x], {x, -10, 2}] When I observe the plot of this function, It ...
13
votes
6answers
1k views

Building a continued fraction

I've completed a problem that involves approximating $e$ by a continued fraction: $$\frac{N_1}{D_1+\frac{N_2}{D_2+\frac{N_3}{\ddots+\frac{N_k}{D_k}}}}$$ with the $N_i$ being the list ...
18
votes
1answer
350 views

DumpSave 10.2 style from 10.3

Szabolcs has asked WRI support about mx files, in particular: Can we expect that MX files written by Mathematica 10.0.0 will be readable by future point released such as 10.0.1 or 10.0.2? ...
0
votes
1answer
60 views

Is there any way to plot function from other function?

For example, I have a function W[L_, m_] := 1 + 3 L + 2 L^2 - 6 m - 6 Lm + 6 m^2 I also have r = m/L What is the easiest ...
7
votes
3answers
366 views

How to rename a built-in function?

I want a built-in function renamed without loss of any properties, I want the shorter name to appear in all results and to be recognized as input. Is it possible?
4
votes
1answer
75 views

issue with `Nearest` with mixed type input

Bug introduced in 10.0.2 and fixed in 10.2 See if anyone else can reproduce this error: ...
28
votes
3answers
955 views

DeleteDuplicatesBy is not performing as I'd hoped. Am I missing something?

Déjà vu: a new-in-v10 function should provide a better solution to an old problem, but my enthusiasm is curbed when I run timings. This time the function is ...
4
votes
1answer
34 views
2
votes
1answer
106 views

How to properly define this function of function

I encountered real problem at first, and here is the toy example variable argument stored some expression that is generated from other parts of the program. I ...
12
votes
1answer
362 views

solve ODE with divergencies

The solutions of the second order differential equation $$\frac{1}{\eta}\frac{d}{d\eta}\left(\eta \frac{df}{d\eta}\right)+\left(1-\frac{s^2}{\eta^2}\right)f-f^3=0$$ is shown in Fig. 5.2 below, for ...
7
votes
4answers
225 views

Iteration of functions

I'm trying to define a function f, such that f[a_]:=a; f[f[a__]]:=f[a]; Then, I tried to evaluate f[x,y]. Since ...
1
vote
1answer
52 views

A bijection between a list of $n$ elements and the canonical basis of $\mathbb{R}^n$

I have some lists omega[i], i=0,1,...,15. And, e.g., omega[0] has four elements. I would like to define a function that maps omega[0][[i]] into $e_i$, where $e_1=\{1,0,0,0\}$, $e_2=\{0,1,0,0\}$... ...
5
votes
3answers
356 views

A simple list question

If I have list1={x^a, x^b, x^c} and list2={1,2,3}, how do I substitute one into the other to get ...
21
votes
1answer
288 views

Default behaviour of Hash[expr] and hashing in different versions of Mathematica

In different versions of Mathematica, Wolfram silently changed the behaviour of Hash when the algorithm is not specified explicitly ...