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

learn more… | top users | synonyms

3
votes
1answer
39 views

Apply matrix of function to a list and get matrix of lists [duplicate]

Say I have table in the shape of a matrix of the form: f[x_] = {{1, 1/4 + x/4}, {0, 1/4 + x/4}} and a list of numbers ...
1
vote
1answer
29 views

Plotting doesn't work for expression using ToExpression and StringReplace

I have a very complicated code. I've narrowed down the problem to following structure in the code: ...
4
votes
1answer
64 views

Domain of a composite function

Consider the built-in function FunctionDomain to find a domain of a composite function f(f(x)) where f(x)=1/x. ...
0
votes
0answers
67 views

Function of function in two dimensions [on hold]

I have two functions, $u[x,y]$ and $v[x,y]$. Can I create a new generic function $z[x,y]=f[u,v]$. For example $z=K(u-v)$. Thanks in advance
0
votes
0answers
26 views

Merged cells are not getting evaluated! [on hold]

So I am trying to write a mathematica function with 3 parameters as inputs. My plan is to open a separate mathematica notebook and run this function file with required inputs. I initially wrote it as ...
2
votes
0answers
58 views

PlotLegends disappearing with list of functions

Why is it that: Plot[{x^2}, {x, 0, 1}, PlotLegends -> {"a"}] does fine, but: ...
4
votes
3answers
283 views

Python's “pop” equivalent in Mathematica

I will like to know if there is an equivalent to python's pop method, here is how it's done in Python: ...
6
votes
1answer
75 views

Unexpected behavior from CoordinateBoundingBoxArray with Into[1] and 0.41

I want to get the four corners of a Cuboid. This usually works: CoordinateBoundingBoxArray[{-{1., 1.}, {1., 1.}}, Into@1] gives ...
3
votes
1answer
49 views

Approch a function given some points and its maximum

For example, I know that a function goes through the points (2.01, 96), (4, 160), (8.1, 257) and (13.1, 321), and that its maximum is 397. Is it possible to approach the function with this data?
0
votes
2answers
68 views

Using recursion to find the trace of gamma matrices

All you need to know about the gamma matrices for this problem is that there are four of them, $\gamma_{\mu}$ with $\mu = 0, 1, 2, 3$, and that the trace of the product of n gamma matrices (n even) ...
0
votes
0answers
16 views

Automatically generate file name [duplicate]

Greeting to all, Im using The Export command to export some data generated in a specific naming pattern such as A_B_C.txt for example: ...
3
votes
1answer
72 views

Sum of squared digits returns incorrect result

For the sake of practicing writing code, I've given myself an exercise in writing a script that checks whether a given positive integer is happy, i.e. take the digits of a number, square them, and add ...
2
votes
2answers
62 views

Same function but in different variables [closed]

I am trying to define free fall velocity as a function of time and a function of distance i.e. $$v(t) = v_0-gt$$ and $$v(y) = \sqrt {v_0^2-2g(y-y_0)}$$ These are essentially the same function ...
1
vote
1answer
54 views

Help with Function of Do or Nested For Loop [closed]

I'm trying to define a function that calculates a variable 'prob'. Here's the function in Octave: ...
0
votes
2answers
110 views

Finding interpolation function [closed]

i have a problem with finding interpolation function. I have a date like this: ...
1
vote
1answer
88 views

Find all pairs $(x,y)$ for which two functions are equal within a given range [closed]

Suppose I have two functions $p(x,y)$ and $q(x,y)$. I would like to check if there is any pair $(x,y)$ within a range $(0,0)$ to $(\hat{x},\hat{y})$ for which $p(x,y)=q(x,y)$. And if such pair exists, ...
6
votes
2answers
55 views

Use SemanticImport on column with UnixTime in miliseconds

When I use SemanticImport on a csv file with the following data I get a DateObject with the year value in the 40 thousands, e.g. ...
0
votes
0answers
41 views

A complicated integrand with hyperbolic functions

I have tried to solve the following integration with respect to $s$ using Mathematica and it returned no result. Is there any way to solve such types of problem? ...
4
votes
0answers
46 views

How to specify halting states when using function TuringMachine?

The function TuringMachine generates a list that represents the evolution of a Turing Machine given a rule that specifies its behaviour (i.e. set of instructions). For example, the following rule ...
1
vote
1answer
64 views

Recursive function

I'm trying to define a function that takes in a list (a1,a2,a3,...,an) and spits out (a1^1, a2^2, a3^3,...,an^n) using recursion. So far I've tried a lot of different things that don't work, and I ...
1
vote
1answer
52 views

Animation of two plots

I have some problems with animation of two functions. I want to add another function to this code: ...
3
votes
1answer
102 views

Colorcode mesh tiles

I have a polygon and 3 lists of points (H, M, L) inside this polygon. I would like to create a mesh inside this polygon and to colorcode each tile of the mesh depending on how many H, M and L there ...
4
votes
0answers
71 views

When does Root have a third argument

In Mathematica "11.0.1 for Microsoft Windows (64-bit) (September 20, 2016)", Root[#^4 + 1 &, 2]; actually has three arguments, as can be seen from ...
8
votes
2answers
266 views

Evaluate trigonometric function

Can anyone help me to evaluate the trigonometric function below? Please look that the picture for more details. Here is the code to evaluate: ...
2
votes
3answers
221 views

How to use a function definition in another function

For example (not what I really need but will fur sure answer my question) f[x_]:=Sin[x]; der[x_]:=D[f[x],x] At least this was my idea, but it does not work at ...
3
votes
1answer
57 views

NotebookImport ignoring multiple style cells

Bug reproduced in V11 [...] I have filed a report to the development team, raising the issue to them. [...] CASE:3802659 ...
1
vote
2answers
46 views

Calculating probability of piecewise function

I want to calculate the probability of a discrete random variable. First I defined the function: pw = Piecewise[{{1/8, x == 1}, {2/8, x == 2}, {5/8, x == 3}}, 0]; ...
0
votes
0answers
27 views

How to determine a formal root of a polynomial in power series over finite field? [migrated]

I am looking for whether there is an easy way to define $y=\sqrt{-1}$ in $A_v$, where $A_v$ is the local ring with $A$ is the power series ring $\mathbb{F}_q[[x]]$ and $v$ is a prime ideal generated ...
-1
votes
2answers
79 views

Plotting a continuous function in discontinuously

I have a function called $s$ which is a very complicated function of two variables x and y. I want to plot a 2d graph with axes representing x and y parameters and colored points show sign of function ...
1
vote
0answers
53 views

Implementing the ∞-norm [closed]

To write a program in Mathematica, I need to define $\|\cdot\|_{\infty}$ of an expression in a closed interval. Can you help me? For example $\qquad \|(\pi.Sin[x]+\pi . Cos[y]+\pi.Sin[x]. Cos[y.\pi]...
0
votes
1answer
37 views

Integrating interpolated function in polar coordinates

I have a set of data that I wish to express in polar coordinates. The data represents the function $f(k_x,k_y)$ in the integral below $ \int_{-\infty}^{\infty} \int_{-\infty}^{\infty} dk_x dk_y f(k_x,...
0
votes
0answers
6 views

How does this follow from the definition of an odd function [migrated]

Wolfram has this example of Fourier series representation. I understand the even/odd and orthogonality argument. I font understand how they say that f(x) is odd because f(x) = (2L-x). The normal ...
1
vote
1answer
39 views

Variable assignment to a function

I am trying to do a seemingly simple thing: f[x_, y_] := x + 3 y /. {x -> -x y} the output for $x=1$ and $y=2$ is 7, so it doesn't make a substitution. How ...
0
votes
0answers
16 views

Figure to show how G'(x) affects convergence of an iteration [duplicate]

I have an equation x^3-3x+1=0 and I find the rearrangement x=G(x) to create a recurrence relation to find the roots of the equation. I need to create a figure to show how G'(x) will affect the ...
0
votes
0answers
56 views

Iterative methods to show effects of convergence

I have have been given a task to: Use simple iterative methods (finding a rearrangement of the equation, x = G(x)) to solve an equation. The result should be a figure illustrating how G'(x) affect ...
1
vote
3answers
75 views

How to scale a plot to show that equations are not constant? [duplicate]

I am plotting three equation Plot[{x/100, x/80, (5 (400 + x))/10000}, {x, 0, 1}] for $0\leq x\leq 1$ The problem is that the plot shows these equation as if ...
1
vote
1answer
56 views

Developing a Function Which Can Compute Any Linear Combinations of a Given Set of Equations

I usually work a lot with equations and their linear combinations. So I thought that I may develop a function which take a given set of equations and compute a desired linear combinations of those ...
1
vote
1answer
47 views

How can I pass an expression to a function while identifying variables in the expression with local variables of the function? [closed]

I am very new to Mathematica, so I apologize if the answer is obvious. I could not find other similar question answered elsewhere. Basically I have written the following ...
2
votes
1answer
27 views

FindInstance[PrimeQ[f[x]] && x > 70, x, Integers, 1] not working

Why does f[k_] := k (2^127 - 1) - 1; FindInstance[PrimeQ[f[x]] && x > 70, x, Integers, 1] not work? It should find a x for which x*(2^127-1)-1 is ...
0
votes
0answers
41 views

Unset Built-in Functions (Times, Dot, etc)

Yes, I know, I should never actually do this in a package or something. But I'm curious - how could I undefine Times or Plus or the like? I tried Unprotect and Clear, but that didn't seem to work.
2
votes
1answer
51 views

Keyboard shortcut for transfer function model symbol

I am wondering if there is any keyboard shortcut to type transfer function model symbol as in the picture below. I would like to plot root locus of that function but I can't figure out how to type ...
1
vote
0answers
64 views

Circular membrane vibration [duplicate]

I'm having a problem in a mathematica code I made to observe the normal modes of a vibrating circular membrane. This is a function I made When d==2, I show a 2D graph of the normal mode. After the ...
3
votes
3answers
161 views

Draw line and point into a BodePlot

From the BodePlot function, I would like to plot the vertical line at horizontal axis equal to 10 as in the magnitude plot below and indicate the coordinate of the intersection point. Could anyone ...
15
votes
1answer
96 views

What is the potential usage of ReplaceAllUnheld in Developer Utilities Package?

There is a function ReplaceAllUnheld metioned in the doc Developer/ref/ReplaceAllUnheld. I am curious about what is the ...
6
votes
1answer
191 views

The curious case of missing random-walking particles in the box

Note: I added the entire code I wrote below to generate the initial configuration and have explained step by step what each part of the code does Kindly bear with the code and the explanation. Since ...
0
votes
1answer
82 views

User vs Mathematica functions [duplicate]

Is there a way to distinguish between functions defined by the user and Mathematica built-in functions (such as Sin, Power etc.)?...
0
votes
0answers
56 views

Is it possible to define a new built-in function in Mathematica? [duplicate]

Say I want to define a function to do integration by part, is it possible to define it as a new built-in function in Mathematica, so that I don't need to define it every time I want to use it?
8
votes
3answers
154 views

How to effiectively substitute the member in list with their order?

Now I have a long number list, for example a = {{1020, 3058}, {98, 98}, {599, 600}}; (*just a sample, the list is very very long*) I want to replace the number ...
3
votes
1answer
60 views

problem in matching two sets of particles

I have been trying to simulate a simple system in which there are two set of particles. One kind of particles are localized on the boundary of a circle (shown in purple below), whereas the second kind ...
8
votes
2answers
407 views

Creating a pure function that does operations with pure functions

Suppose I have two functions defined as follows: a = #+3& b = #^2 + 3& So when I call a[2] and ...