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

learn more… | top users | synonyms

3
votes
3answers
123 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
70 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
75 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
75 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
56 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
383 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
191 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
349 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
248 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
44 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
84 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
140 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
516 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
57 views

How does RootLocusPlot handle TransferFunctionModel

I'd like to analyze the poles (denominator-roots) of a TransferFunctionModel, that was generated from a ...
7
votes
3answers
193 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
65 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
73 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
94 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 ...
1
vote
1answer
80 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 ...
5
votes
1answer
119 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 ...
6
votes
5answers
501 views

Defining indefinitely many functions

Is it possible to define a class of indefinitely many functions f1, f2, f3, ... such that ...
1
vote
2answers
55 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)? ...
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: ...
4
votes
2answers
234 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: ...
2
votes
1answer
78 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
3answers
109 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 ...
0
votes
1answer
47 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 ...
0
votes
2answers
181 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 ...
4
votes
0answers
93 views

Why does FromDigits transpose its argument (sometimes)?

a = {{1, 2}, {3, 4}, {5, 6}} ; FromDigits /@ Transpose@ a == FromDigits @ a (* True *) The only "strange" syntax I've found in the docs is But it doesn't ...
1
vote
0answers
59 views

Why can't I use OmegaPrime to find the Limit of Prime[n]? [duplicate]

I've looked at these links already; What are the limits of the Prime-functions? What is so special about Prime? which gave an answer for earlier versions of Mathematica. Yet when I try to input ...
2
votes
2answers
148 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 ...
1
vote
0answers
94 views

what is the means of (0 -> 1) of series expansion [closed]

I use mathematica 8 to take a taylor expansion.In the Output, the expression (0->1) appears in the second term and all higher order term, and this expression is multiplied with other coefficient and ...
7
votes
1answer
141 views

How would one return from a place of a pure function's body using Return?

From previous answers, replies and discussions it is known, while not formally documented (even in the most recent Wolfram Language Documentation Center), that Return can be used in a two-argument ...
1
vote
2answers
206 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. ...
4
votes
3answers
183 views

Convert `FullForm` to XML Structure and back

How might I create a function that converts between FullForm and a XML structuce? Ultimately I'm ideally looking to use CSS and JS to edited the XML structure. ...
7
votes
1answer
145 views

What kind of creature is h[c] for definition h[c_][x_] := (* function of x and c *)

To implement "Hero's Method" for approximating $\sqrt{c}$, one iterates the function (x + c/x)/2 for a given number c (e.g., ...
4
votes
0answers
92 views

Optimization of recursive functions by using the //. operator [duplicate]

In some cases, recursion in Mathematica (without storing values) is not very efficient. For example, the recursive implementation of Fibonacci numbers (version which doesn't store the values) : ...
14
votes
1answer
426 views

Why is an Identity function needed?

Today I came across the function Identity[x] in Mathematica (documentation). The example given in the documentation uses it in ...
1
vote
1answer
182 views

How to create a vertical (smooth) Histogram on the y-axis of a function graph for an uncertain x?

This is my first time posting a question in StackExchange. I have encountered a certain problem and I can't seem too find a solution. Just a word of caution, I am kind of an amateur when it comes to ...
2
votes
1answer
64 views

RootReduce-Part of Solve

I have given the following expression in $M$ and $z$: \begin{equation} a = \frac{-4 M^2+M (-3 z-5)+\frac{1.1875 z}{\sqrt{\frac{0.015625 z}{M+1}-1.5625} \sqrt{\frac{0.765625 ...
9
votes
2answers
237 views

Pattern and Orderless function

I'm a Mathematica beginner. I am exploring the use of patterns and (only for fun) am trying to implement a permutations function. My (dirty) code is: ...
12
votes
4answers
219 views

Distributing function arguments with function compositions. How to compute $(f + g^2)(x) = f(x) + g(x)^2$?

Suppose I have two functions f and g. To compute $f + g$ evaluated at a point $x$, I know that one can use ...
3
votes
1answer
77 views

Table generation with SetDelayed function [closed]

I would like to understand why the following two outputs differ: Let us define the following data set: ...
3
votes
2answers
103 views

Working with CDF Deployment

I've been working with FreeCDFs in Mathematica 10 and it has been going fine as long as I do not pull from a database or access local files. I recently purchased the Mathematica 10.2 Enterprise ...
0
votes
1answer
79 views

Working with functionals [closed]

I am trying to work with functionals in Mathematica, this means that I want to define a function of a function. I defined my function of a function as: ...
20
votes
1answer
216 views

Strange behavior with Cases and Position with SetDelayed

I feel like I must be missing something simple and obvious here, but this has me scratching my head. This works as expected: ...