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

learn more… | top users | synonyms

1
vote
1answer
83 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 ...
10
votes
5answers
9k views

Calling Correct Function for Plotting DiracDelta

I am wondering what is the correct function in Mathematica to plot the true impulse function, better known as the DiracDelta[] function. When using this inside of a ...
-2
votes
2answers
139 views

Plotting self-made functions [closed]

EDITED AS SUGGESTED I have defined a function, which takes two values and returns a function n(x), like so ...
1
vote
1answer
96 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 ...
2
votes
1answer
53 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
89 views

Defining a Function

I've been reading about functions in Mathematica and playing with this for hours, but I'm clearly missing something. The following code correctly calculates "fail", the number of failed scenarios. I ...
0
votes
1answer
33 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
120 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
57 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 ...
0
votes
3answers
267 views

Defining a function as a sum of several Gaussians

I have a function that is a summation of several Gaussians. Working with a 1D Gaussian here, there are 3 variables for each Gaussian: A, ...
3
votes
2answers
65 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
0answers
54 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 ...
0
votes
1answer
58 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,...
18
votes
0answers
316 views

More Ticks::ticks errors in AbsoluteOptions in v10

Bug introduced in 7.0 or earlier and persisting through 10.3 or later While the specific bug affecting Plot described in AbsoluteOptions prints error messages in ...
6
votes
1answer
105 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
76 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] ...
3
votes
1answer
63 views

LineScaledCoordinate problem for exact coordinates

Edit: Confirmed bug. CASE:2326540. Still the case in V 10.3. Solution: Wait and use N meanwhile. I've faced this problem ...
1
vote
3answers
150 views

repeating a special type of square wave over time [duplicate]

I want to repeat the square wave shown in the picture over time after t=0.4 s, so the time period will be 0.4 s. And I want to repeat the same pattern over certain period of time, say 100 s. Anyone ...
9
votes
2answers
218 views
6
votes
0answers
64 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 ...
1
vote
2answers
77 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 ...
0
votes
1answer
41 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 ...
7
votes
3answers
189 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 ...
6
votes
1answer
125 views
2
votes
1answer
86 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
503 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
121 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 ...
1
vote
2answers
183 views

Restrict domain of a function?

I have a function f[x,y,...,z] and I want to restrict its range to positive numbers only, f > 0. ...
2
votes
1answer
52 views

How does RootLocusPlot handle TransferFunctionModel

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

Getting error Clip::ncompl from my trigonometric expression

In my Mathematica code has used Clip in NDSolve, but I'm getting with this error: Clip::ncompl: Symbolic or noncomplex ...
19
votes
2answers
281 views

How does Rescale[] handle infinities?

Rescale appears to be a simple function. It just does a simple linear $y = a x + b$ type rescaling of the values: ...
2
votes
1answer
71 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
3answers
61 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
88 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 ...
2
votes
2answers
138 views

How to correctly scale the x axis?

I am not absolutely sure how to formulate my question but here is my first attempt: I have 25 rods with lengths in cm ...
0
votes
2answers
170 views

Approximate UnitStep for use in Enterprise CDF

The following Manipulate code displays the VectorPlot for all functions. (This code is a subset of a more extensive notebook which is based on the structure you see below. Consequently, I need to ...
1
vote
1answer
66 views

Defining function from table [closed]

I have a table of values of the form Table[{i1,j1}, {i2,j2}...] and I want to define a function like f[i] to take the values ...
6
votes
0answers
102 views

What is the difference between GenerateDocument and TemplateApply[NotebookTemplate[

Edit 5. X 2015 I don't see any reason why that cell is evaluated. And I don't see how my opinion may change with small update of docs like suggested by support: I have not heard back from the ...
5
votes
5answers
483 views

Defining indefinitely many functions

Is it possible to define a class of indefinitely many functions f1, f2, f3, ... such that ...
5
votes
1answer
111 views

Newton's Method Converges in Mathematica for non-convergent functions

In mathematica I set f[x_] := Sign[x] Sqrt[Abs[x]] and then I solved it in a root finding for Newton's method by doing ...
2
votes
1answer
89 views

How does this code work to substract a set A from a set B?

In an answer to a question (as given here: code), the proposed function was to to subtract a set B from a Set A: ...
1
vote
2answers
52 views

Find function to relate two lists of values

I know Mathematica has the FindFit function to determine the parameters of a known function that fits a sequence of points, but what if you do not know the relationship (linear, log, quadratic, etc)? ...
4
votes
2answers
178 views

How do Reap and Sow work in this context

I have a list of points in 3D and I need to count how many times each point is repeated. For a similar problem with a list of characters many different solutions have been proposed in this post: ...
0
votes
3answers
83 views

How to Change Vertex List in a Grid Graph

I would like to actually change the vertices in a grid graph instead of simply changing the label. Ultimately, I want the vertices to be points on a plane. So if given a simple grid graph ...
2
votes
1answer
75 views

Issue plotting/re-creating 3d function

I am trying to re-create images created in Mathematica using the equations in the photos attached. I was able to somewhat plot the Equation 6 (Cartesian coordinates) Figure 4 using this code ...
0
votes
1answer
45 views

Problem with Apply [duplicate]

I have am trying to obtain the average of the distance from the mean radius for each shot in a group of shots at a target. I am having problems with the very last line. The output of the last line ...
11
votes
1answer
176 views

Why is this evaluation halved when adding units?

Why does this strange behavior occur when dealing with units and quantities? ...
4
votes
0answers
79 views

Why does FromDigits transpose its argument (sometimes)?

FromDigits /@ Transpose@{{1, 2}, {3, 4}, {5, 6}} == FromDigits @ {{1, 2}, {3, 4}, {5, 6}} (* True *) The only "strange" syntax I've found in the docs is ...
1
vote
3answers
138 views

An argument pattern that my function can treat as Times[constant, variable]

I want to define a function of two variables, func[f_, g_], such that when it sees a general constant multiplying one of the variables, say ...