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

learn more… | top users | synonyms

0
votes
2answers
108 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
52 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
40 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? ...
4
votes
4answers
166 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.
2
votes
1answer
55 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 1,2,3,4)...
1
vote
1answer
61 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
52 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
41 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
99 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 ...
0
votes
2answers
65 views

Function input syntax [closed]

My functions are ...
6
votes
2answers
653 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 ...
-4
votes
3answers
86 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
108 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
5
votes
1answer
75 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 <...
2
votes
1answer
75 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 ...
2
votes
1answer
103 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 ...
0
votes
1answer
64 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 ...
5
votes
1answer
53 views

How to evaluate following inputs only after finishing CreateDialog

I have a code which starts with the following Cell: ...
4
votes
1answer
78 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: ...
2
votes
1answer
121 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 ...
7
votes
4answers
237 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
55 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
360 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 ...
1
vote
0answers
67 views

DiracDelta of a function

If I have, for instance, FunctionExpand[DiracDelta[x^2+x-3]] it evaluates to ...
1
vote
1answer
93 views

How can I produce a function with maxima at given locations

At the first I ask a general question and after that I bring out the special problem. If we have some functions such as f1[x], f2[x], f3[x] and f4[x] and they have shared intersections points. Is ...
2
votes
1answer
57 views

Issue with plotting function

I can't seem to work out why nothing is showing when I try to plot h[t] in the example below: ...
1
vote
1answer
97 views

Extracting the 'critical point'

I have a discrete function (or list of ordered pairs) with respect to a discrete integer n, f[n]. In the format ...
0
votes
1answer
36 views

PermutationReplace does not seem to work when Combinatorica is open. Is there a function that is equivalent.?

I want a permutation to act on a set. For example: I want the permutation {2,1,3,5,4} to act on the set {2,3,4} by returning {1,3,5}. I need to do this in the same code that has functions that need ...
3
votes
3answers
125 views

Greater operator should give greater element

4>3 gives True. What is the "greater_operator" to obtain the result 4? For lists accordingly: ...
0
votes
1answer
74 views

Defining a function to use in another function dependent on similar parameters [closed]

I want to define a variable dependent function which can be used to define another function which depends on the same variable and other variables. For example, I have a system where I define ...
3
votes
2answers
80 views

FindRoot, How to Return Null After x Number of Iterations

I am using FindRoot to find the root of a function, say f(x), and going through a loop for different values of ...
0
votes
1answer
77 views

How to implement the for loop to replace text strings or texts?

I wonder define a bunch variables named like $X_1$, $X_2$, $...$, $X_n$. Is there some smart way to declare them instead of by pure typing. One trick I can image is to use the for loop,...
0
votes
0answers
58 views

Cannot assign one element of an multi-output function (a list of outputs) to a new function

My aim is to define two functions by writing only one time the actual definition. The first one gives me a matrix and the second one is one of the elements of the matrix. Moreover, as I want to ...
19
votes
1answer
397 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? ...
6
votes
1answer
107 views

Relevant help page for: Sum`?

When I type Sum into Mathematica, it also offers Sum` in the autocomplete dropdown, but when I click the little menu button next ...
0
votes
1answer
232 views

Defining Function With Two Variables [closed]

I need to define some functions with more than one variable, but the examples only list one variable cases, so I tried this: f[x_, y_] = (y/x) + xy f[1, 2] ...
16
votes
1answer
364 views

What has changed in the Template system in 10.3?

Bug introduced in 10.3 and persisting through 10.4.1 There are couple of issues that are breaking my code after upgrading to 10.3. I wasn't able to narrow all of them down but this is what I've ...
11
votes
2answers
252 views

Vertex descendants subgraph

Keywords: vertex, ancestors, descendants, subgraph, directed graph, flow subtree So let's say we have a TreeGraph: ...
6
votes
0answers
74 views

How to instruct MatrixLog to work with singular matrices?

How to instruct MatrixLog to work with singular matrices by ignoring the zero eigenvalues (thus only acting on a subspace orthogonal to the matrix kernel)? I'm ...
0
votes
1answer
46 views

How can evaluate this function [duplicate]

Suppose this function F[c_, n_, s_] := Module[{}, Abs[s - 1 + (-1 + c)^n]] I calculate its second derivative on c ...
1
vote
2answers
86 views

Composing multiple functions [closed]

I am trying to compose three functions in the following manner: Adx[z_] = (z[x + dx, t] + z[x, t])/2 Ddt[z_] = (z[x, t + dt] - z[x, t])/dt Ddt[Adx[z]] I get the ...
3
votes
1answer
158 views

Why `Chop` does not make the real part of machine complex numbers an exact zero? [duplicate]

The documentation says Chop does not make the real part of machine complex numbers an exact zero: In[2]:= Chop[10.^-12 + 2. I] Out[2]= 0. + 2. I Why does ...
12
votes
3answers
522 views

Map a function of several arguments

I have three lists, e.g. list1 = {{a,b,...}}; list2 = {{1,2},{3,4},...}; list3 = {{x,y},{z,w},...}; and a function ...
7
votes
2answers
124 views

Recursive function activity

We had the following question on an activity for our students: Let $f_0(x)=x+|x-100|-|x+100|$, and for $n\geq 1$, let $f_n(x)=|f_{n-1}(x)|-1$. For how many values of $x$ is $f_{100}(x)=0$? When I ...
2
votes
1answer
59 views

How does RootLocusPlot handle TransferFunctionModel

I'd like to analyze the poles (denominator-roots) of a TransferFunctionModel, that was generated from a NonLinearStateSpaceModel....
7
votes
3answers
197 views

Through does not work with Subtract

Through[(Max - Min)[#]] & @ {1, 2, 3, 4, 5} gives 5 + (-Min)[{1, 2, 3, 4, 5}] Of course I can work around by ...
2
votes
3answers
66 views

Having a function check a column and perform a task every time an entry satisfies a condition

So I have a matrix (technically a table) points = Table[{x, f[x]}, {x, Range[0, 2, .1]}]; Which gives something like this in matrixform \begin{array}{cc} ...
2
votes
1answer
75 views

Plot a function with respect to two parameters that are not explicitly function parameters

$$function = |\delta|\frac{I_1(\kappa)}{I_0(\kappa)}$$ where $I_0(\kappa)$ and $I_1(\kappa)$ are the modified bessel functions of the first kind of order $0$ and $1$ I want to plot the function in ...
2
votes
1answer
98 views

How to prevent a definition from overwriting my input

I developed the following manipulate code to be a limited knockoff of Polking's dfield. I export the code to Enterprise CDF so that one may type a first-order ODE into the input box and create a slope ...