Questions tagged [functions]

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

Filter by
Sorted by
Tagged with
-1 votes
0 answers
113 views

I can't find the reason for the flat chart [closed]

That's what I need to do. There is a function Φ[α,β,z] in which the replacement of k1 and k2 is used. Thus, an analytical representation of the integral characteristic of the solution of the problem ...
user avatar
  • 1
5 votes
1 answer
357 views

How to use PlusMinus properly?

As an easy exercise, I would like to define a function $$f(x)=\pm x$$ and be able to ListPlot the function for some discrete values. Here is what I tried ...
user avatar
1 vote
0 answers
28 views

Efficient construction of a formal polynomial using list manipulations

I have a code which is probably extremely inefficient given my inexperience with Mathematica list manipulation. Take as input data: ...
user avatar
  • 1,287
2 votes
1 answer
103 views

Introduce formal symbols indexed by natural numbers

I'm going to describe a toy example here which I'm hoping with some help, I can then soup up into the more complex application I have in mind. Suppose the input is a list of lists, and for now take ...
user avatar
  • 1,287
5 votes
1 answer
236 views

Why does this Fourier transform not match the formula?

From this page: So I'm trying to get that result in Mathematica. From the fourier formula above, we can see that {a, b} = {1,-1}. However, the code below returns a different result. ...
user avatar
  • 1,750
1 vote
1 answer
99 views

How to plug in an implicit function into another function and evaluate in Mathematica?

I am wondering how to do the following in Mathematica. Say, we have an implicit function $y=f(x)$ defined by $F(x,y)=0$. I would like to evaluate another function $G(x,y)$ at the implicit function $y=...
user avatar
  • 11
4 votes
2 answers
183 views

Tropical Operation Conversions: Multiple Operations

I apologize if my syntax is bad. I looked around, but didn't see anything on this in the stack exchange. I would like to be able to transform a classical real-valued polynomial to a tropical ...
user avatar
  • 143
2 votes
1 answer
90 views

Why Mathematica does not return explicit output [closed]

I am new to Mathematica. One thing that I don't get is why if I define a matrix and give it a name, then use the name in another function, I get back the function itself. However, When I use an ...
user avatar
  • 21
11 votes
1 answer
241 views

Association vs Pair - Creation performance, Selection performance

Suppose that we ...
user avatar
  • 2,451
4 votes
1 answer
68 views

Replacement, PatternTest, Module related Question

Let's see how MMA handles following type of expression : Replace[L, {pattTest1->rhs1, pattTest2->rhs2, pattTest3->rhs3}, {1}] Specific example : ...
user avatar
  • 2,451
0 votes
1 answer
73 views

Animate a point that follows a function inside a plot

I'm trying to create a plot that shows an animation of a point moving along a function. The idea behind this is that a I want the point to follow the function until the discontinuity point. For every ...
user avatar
  • 69
3 votes
2 answers
84 views

Find global maximum of InterpolatingFunction in interval but not maximum value

I have InterpolatingFunction generated from experimental data with many local maxima, one major peak I need to find, and the tail that grouse much higher then major peak. I tried to find my peak with ...
user avatar
3 votes
1 answer
78 views

Classifying elements, by the value of a fixed function, using Replace

Let L be a list of several lists. And the length of each list is less than 1000. You can create L by ...
user avatar
  • 2,451
1 vote
3 answers
67 views

Module returns multiple functions

I want to write a module that returns two functions which then can be evaluated later on. I know how to do it with a single function, but I don't know how to make it work for multiple functions. An ...
user avatar
  • 113
1 vote
1 answer
89 views

While inside a function body does not work as expected [closed]

I'm trying to write a function that return a randomly created rational polynomial function that has a discontinuities points. I already have a function that generates random rational polynomial (...
user avatar
  • 69
1 vote
0 answers
71 views

sometimes Select / sometimes Position is faster

As you see, For list L, L1(Select method) is slower than L2(Position method). But for list <...
user avatar
  • 2,451
0 votes
1 answer
43 views

How to define a function of parameters of a DSolve output?

If I have some ODE that has some parameters, say $a$ and $k$, how would I define a function of those parameters of the solution DSolve. For example cosider the following code ...
user avatar
  • 101
0 votes
1 answer
48 views

Find the parameter region where function returns negative value

I have a function $f(m,n)$ where m and n are positive integers. Suppose $f(m,n)$ is like a black box, I can get values of it when I enter values of m and n. I want to scan over a region for example $...
user avatar
  • 51
0 votes
0 answers
66 views

Packed/Unpacked array - what object/like 0 or 1?/how to check/ [duplicate]

In Mathematica, there is a concept called packed array. ...
user avatar
  • 2,451
0 votes
1 answer
32 views

Recursive error encountered when updating rules of assignment [closed]

I'm working on a problem which requires associating a single (complex) number with a pair of binary vectors. I'm doing this by creating a set of assignments through a function I call ...
user avatar
  • 595
3 votes
2 answers
90 views

How to remove duplicates from a pair with some conditions?

Here is a simpler example of my real problem. Assume that I have a groups which includes sublists as follows: ...
user avatar
  • 2,147
0 votes
0 answers
36 views

Extracting function domain from a finite set of assignments

Suppose we define a function through a finite collection of equalities, e.g., f[1] = 1; f[26] = 321 and so on. We can extract the set of output values by running <...
user avatar
  • 595
2 votes
0 answers
39 views

Delete list item if message is thrown

I have a nested list with each element containing FindRoot like this: {FindRoot[a,b], FindRoot[c,d], FindRoot[e,f],...} ...
user avatar
5 votes
4 answers
181 views

Find shortest distance between two functions [closed]

The problem is to find the shortest distance for given functions: y=x^2+7/2 and y=ln(x) without using Minimize. Does anyone have any idea how to approach this ...
user avatar
  • 51
9 votes
4 answers
527 views

How can I use variables instead of slots in DeleteCases?

Here is a toy example to illustrate my problem. I have a list of 3-tuples and I want to delete elements from this list that satisfy a condition shown below. ...
user avatar
  • 1,750
0 votes
0 answers
31 views

Using the recursion index to compare with a value in another list

I am trying to generate an arrivals and departures plot for a signalised junction with the following parameters: lambda: rate of arrival c: cycle length of traffic lights g: length of time signal is ...
user avatar
4 votes
1 answer
122 views

How to get a function from a string?

I'm trying to create a function that takes in input a function written as string and the return it applying a ToExpression and an Evaluate (Code below). The goal of this function is to transform the ...
user avatar
  • 69
4 votes
3 answers
480 views

How to simplify function with Abs?

I'm trying to remove Abs below. ...
user avatar
  • 1,750
6 votes
5 answers
794 views

How can I apply a function only to even-index elements of a list?

A = {1, 2, 3, 4, 5} and, Dd[P_] := P + 1 How can I map "Dd" into "A" such that the outcome is: {1, 3, 3, 5, ...
user avatar
  • 61
3 votes
1 answer
53 views

RunProcess : Save directly to Mathematica Variable

I can convert mysource.jpg to myresult.jpg using an external program myprog.exe, and set a ...
user avatar
  • 2,451
3 votes
1 answer
61 views

Stop NotebookEvaluate before the end of a notebook depending on test inside this notebook

CONTEXT: Hello, I have 2 notebooks, lets call them "Main.nb" and "FileProcessing.nb". In my "Main.nb" I have a Do loop where the iterating parameter goes over 300 .csv ...
user avatar
  • 31
2 votes
1 answer
117 views

Speed Up the Gelman-Rubin-History function

A bit of background information I have created a function to calculate the convergence of the Gelman Rubin diagnostic (useful in Bayesian analysis). The function seems to work as I want, however I ...
user avatar
0 votes
1 answer
26 views

Confusing abnormalities observed when counting a specific operator in an expression [duplicate]

Recently I have met with some confusing abnormalities when trying to determine if there is a specific operator (usually Plus[] ) in an expression by programming. ...
user avatar
  • 289
2 votes
1 answer
137 views

A question related to the usage of LegendLayout -> {"Row", 1}

I saw this piece of code from an answer by @Syed here. ...
user avatar
  • 2,147
3 votes
2 answers
190 views

Why is the matrix "mat" not modified here?

Why is the matrix mat not modified here? I expected it changes with list1 and list2 so that <...
user avatar
  • 1,750
0 votes
0 answers
28 views

How to combine several similar terms in computation of algebra?

As the title shows, how can I combine several similar terms when I try to compute some complex algebra terms. For example, I want the result of $$\frac{1}{6} b_1 \left(-\left(b_2^2 \left(-2 \sqrt{3} e^...
user avatar
  • 101
0 votes
0 answers
37 views

Eliminate point of function

So I have a function f(x) and I know that for x=x1 the function goes to infinity. I want to remove this point of the function and a "new" function that interpolates from x1- to x1+ at that ...
user avatar
2 votes
2 answers
143 views

Double quotes as a 'function' (verbatim ToString?)

Can we construct a function F such that F makes any typed text into a string. Just like double quotes. ...
user avatar
  • 2,451
0 votes
0 answers
42 views

Non-Gaussian Hidden Markov Process

I'm using estimated process to simulation a Hidden Markov Process with two states using data derived from different ARIMA processes ...
user avatar
3 votes
3 answers
255 views

How can I delete duplicates with Abs?

I have this list with some duplicate elements and I want to delete duplicate ones. ...
user avatar
  • 1,750
4 votes
1 answer
103 views

Why is this region in RegionPlot3D wrong?

I believe this is simple, but I can't wrap my head around forming region for RegionPlot3D. I have been reading and trying to understand how to write the region but ...
user avatar
  • 1,750
1 vote
1 answer
107 views

Why does this TeXForm cause many errors?

Why do I get this error? I don't do any calculation with this. I just want to use TeXForm and then wrap MaTeX around it. ...
user avatar
  • 1,750
5 votes
2 answers
1k views

Why does this triple integral take so long?

How can I compute this triple integral? I tried this but it has been running for a long time and not return result yet. ...
user avatar
  • 1,750
0 votes
0 answers
48 views

Function for probability distribution approximation of a compound random variable

In the book (Klugman et al, 2019) on can see the Example 9.12. The number of claims has a Poisson–ETNB distribution with Poisson parameter 𝜆 = 2 and ETNB parameters 𝛽 = 3 and 𝑟 = 0.2. The claim ...
user avatar
  • 111
2 votes
2 answers
226 views

Three equation solving analytically in Mathematica

Im doing coding in iterative schemes but I do not know to solve three equations analytically in Mathematica step by step. For example I given thre equations in the attached figure. I want to solve ...
user avatar
  • 169
2 votes
1 answer
169 views

Why is this RevolutionPlot3D empty in the middle around x = 0.5?

Why is this RevolutionPlot3D empty in the middle around x = 0.5 like this? ...
user avatar
  • 1,750
4 votes
1 answer
174 views

How can I fill this region?

How can I fill this region? Plot[{x^2, x^2 - 2 x + 1}, {x, -2, 2}, PlotRange -> {Automatic, {0, 0.5}}, GridLines -> Automatic]
user avatar
  • 1,750
1 vote
2 answers
78 views

Ploting a function

I just ploted y[x],y'[x] but I would like to plot other function which is g[x] based on my solution but it can't plot this ??!! ...
user avatar
3 votes
3 answers
123 views

How to insert some number of parentheses into an expression to get smallest integer result?

Assume that I have an expression like this (without evaluating) expr = 1/2/3/4/5/6/7/8/9/10 You can insert some number of parentheses into the expression above to ...
user avatar
  • 2,147
4 votes
1 answer
68 views

Mathematica replaces list of zeros with zero [closed]

Consider the following functions: f[x_]:= {{Im[x], Re[x]}, {Re[x], Im[x]}}; g[x_]:= {{Im[x],0},{0,0}} When applying each of the functions to the list of lists <...
user avatar

1
2 3 4 5
67