Questions tagged [functions]

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

268 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
1answer
23 views

How to substitute part of expression with function variable (Goal: create function that solves expression numerically for one of the variables)

I have a complicated expression that contains N variables. I want to create a function of N-1 that solves for one of those variables Toy example: ...
0
votes
0answers
37 views

How can I access a list of functions?

I found answers to this question but I don't know how to apply them to the code below. The code below rotates a cube with edges of length 1 by an angle p around the z axis. The origin of the ...
0
votes
0answers
27 views

Using different functions in summation

I am trying to evaluate the sum $$c(k_1,k_2) = \sum_{a,b}{\Phi^{(2)}_{a,b} w_a(k_1) w_b(k_2)},$$ where $\Phi_{a,b}^{(2)}$ is the second derivative of $\Phi$ with respect to $a$ and $b$ respectively, ...
0
votes
0answers
21 views

Running out of memory when expanding an symbolic expression using rules.How to handle such cases?

while deriving equations related to dynamics of 6 connected body, I ended up creating about 3000 set of rules,because of which final expression looks simple, now the issue is when i want to ...
0
votes
0answers
57 views

Infinitesimals in Mathematica

Is it possible to parse for Mathematica the following function ? f[x_] := x + t, Where t is infinitesimal $dx$ ? I work on ...
0
votes
0answers
38 views

Defining and Squaring an Operator using Mathematica

Hello I have a question regarding the possibility of defining a operator using Mathematica. Essentially what I would like to do is define the following, \begin{gather*} {\mathcal D := \frac{1}{(x^2+...
0
votes
0answers
27 views

Finding intersections of points from more than two functions

How to find the intersections of points for more than two functions? Say I have f1, f2, and f3. I don't want to do : ...
0
votes
1answer
74 views

How to constrain parameters of a pure function?

Consider the following definition of splitList: ...
0
votes
0answers
39 views

Problema simulating FindRoot

I am writing a procedure that simulates the findRoot built-in function using the same code that appears at chapter 6 of $\textit{Programming in mathematica}$ by Paul Wellin. The code is the following....
0
votes
0answers
22 views

FactorSquareFree::lrgexp: Exponent is out of bounds for function FactorSquareFree. Error

I'm trying to make a two-dimensional contour plot of the temperature of a plate. This is my initial function: ...
0
votes
0answers
27 views

specify arbitrary number of arguments in a function

I want to design a function like Xor function inside Mathematica which can take an arbitrary number of boolean functions inside it as arguments and xor all the ...
0
votes
1answer
47 views
0
votes
0answers
31 views

Redefine a function on certain values

This question is related to Zero-dimensional matrices, in particular to the answer https://mathematica.stackexchange.com/a/39543/42722. In Mathematica $0 \times n$-matrices are not well-defined, so I ...
0
votes
1answer
64 views

How to get a function from a numerical integration?

I wold like to know how to get a function from a numerical integration. Here is an example: h[y_?NumericQ] := NIntegrate[y*Sin[Sin[x]], {x, 1, 2}] h[2] Then my ...
0
votes
0answers
18 views

Problem with makeOperator which yields Polynomials of an operator

Hi Is it possible to improve the macro provided by Jens Polynomial expansion of operator ...
0
votes
0answers
34 views

Strange behaviour Plotting User-defined Function: Charting`Private`pvar$

I am using MMA 12.0.0. I create a user-defined function and plot it. ...
0
votes
0answers
48 views

Problem when doing a 3d-plot of a function

So I have been working with Mathematica I have defined a function called funcional that receives $u, \alpha, \beta, y2 , x3 $ where the first one is a function of ...
0
votes
0answers
27 views

Problem when integrating a discontinuous function

I have this simple code: ...
0
votes
0answers
27 views

replacing a founded value in a function

Here is the sample F[r_] := r^2 + r^3 DerivI[r_] := D[F[r], r] A = FindRoot[DerivI[r], {r, 9}] B = F[r] /. r -> A I want to replace ...
0
votes
0answers
51 views

Extracting a linear equation from a graph

...
0
votes
0answers
28 views

Variant on `PrimeZetaP`

Mathematica has PrimeZetaP for the prime zeta function $\sum_p \frac{1}{p^s}$ where the sum is taken over all primes. How do I use Mathematica to make an ...
0
votes
0answers
32 views

Pulling answer from previous output

This will probably be a very simple answer. I am trying to find a way to pull the last output from a line and define it as a separate variable so it can be used in a later function. Specifically in ...
0
votes
0answers
74 views

Finding ellipse formulas from set of ellipse relations

Question: Given the ellipse relations below, what additional ellipse formulas/relations/equations can I derive? I asked a question similar to this in Finding formulas from other formulas and ...
0
votes
0answers
35 views

Defining a function and order of operations

I feel I have a profound misunderstanding of how Mathematica works. Here's an example that confuses me: Say that for a matrix $A$ I want to extract the first $\mathrm{Tr}(A)$ normalized eigenvectors (...
0
votes
0answers
48 views

Delayed Rule right-hand-side mis-evaluation

Outline I am trying to create a rule that will give me a minus sign if the number of times A is applied on X is odd where A is some οperator and X a random quantity. Some of the configurations of ...
0
votes
0answers
34 views

Creating a special product function

I am having trouble working with lists inside functions with Mathematica. Basically, I have a list of numbers and a special way to multiply them. I want to have a function that is able to create a ...
0
votes
0answers
79 views

Get R^2 value between interpolating functions and a list of points

I am looking to compare the degree of accuracy of a theoretical model by comparing my theoretical curve to my experimental data points. My theoretical curve is an interpolating function generated ...
0
votes
0answers
46 views

Define a function including two solve solutions

I'm trying to combine the solutions coming from two NSolves and define a new function that I've to integrate. Basically I've defined two ...
0
votes
0answers
22 views

InverseFunction cannot evaluate negative arguments

I have difficulty figuring out where my code fails. I want to obtain $\textbf{ry}$ which is the inverse function of rho (see below). When I input positive values for its argument, there's no problem. ...
0
votes
0answers
28 views

Easiest way to simultaneously keep track of two values in a list

I have a bunch of functions a,b,c,... that all take in a list of images and return a list consisting of a list of transformed images, and a number (let's call it ...
0
votes
0answers
79 views

NSolve not solving my transcendental equation

Would be grateful for your help in tackling this complex polynomial where I am trying to solve for x. When I run the code below, I get the message: value x of ...
0
votes
0answers
73 views

Define the partial derivatives of a multivariable function

I have some vector $K = [K_1, K_2,...K_n]$ which is a function of variables $(x,y)$ i.e. $K = K(x,y)$ I want to symbolically calculate the partial derivatives e.g. $\partial_x K$, $\partial_x \...
0
votes
0answers
62 views

How to turn an algorithm into a function

I have written a script to help me find the several local minima of a dataset. It takes two arguments: the dataset list and an x-coordinate value that tells the script from where to start looking for ...
0
votes
1answer
132 views

Automating a large operation by making a function

I would like to automate the following operation. To be transparent I shall put my code into separate chunks and explain the process. Suppose I have the following: ...
0
votes
0answers
39 views

How to define a function in an implicit form

Know the 2-variables function $F(x,y)$. How can I define the function $x\to f(x)$ s.t. $F(x,f(x))=0$?
0
votes
0answers
54 views

Function works outside For loop but not inside, and loop fails spectacularly

I'm building two lists, each to carry a different representation of the same set of objects. One list, list2, is constructed first; then the second list, ...
0
votes
0answers
69 views

How to list all the possible functions of given structure?

I can run this command : Tuples[{ Tuples[{x, y, z}, 2], {a, b, c}}] to list all combinations that looks like: ...
0
votes
0answers
43 views

Function iteration

I wrote a function in Mathematica that applies certain construction steps on the "incidence matrix" of a graph in order to obtain a new graph with certain properties. These construction steps can be ...
0
votes
0answers
43 views

Obtaining the equation type of an interpolated function

I used InterpolatingFunction on a set of points. How can I know the type of that equation ? (polynomial, sinusoidal, logarithmic,etc...). I am looking for a general case answer. Here is an example ...
0
votes
2answers
74 views

Problems with creating a matrix with functions

I have a function which gives me all the coordinates of a certain bloc in a lattice (with the help of another function for rows and columns): ...
0
votes
0answers
21 views

Error while defining custom matrix function

I'm trying to define a custom matrix Ry with a parameter x, in Mathematica. ...
0
votes
0answers
36 views

How to graph a text as a function of some arbitrary parameters?

I'm trying to graph a text in a couple of plots I have. I want to be able to edit the text depending on the values I choose (rho0, zp, zm, temp, ion, and perm) and show them at some point in my plot (...
0
votes
0answers
101 views

How to solve “Coordinate should be a triple of numbers”?

Something seems different with duplicated question "How to solve this error? “should be a triple of numbers or a Scaled form.” ", MMA tips may tell that Abs do not ...
0
votes
0answers
55 views

How to find a domain at which a function is non-zero

Consider some function f[x,y]. Is there any way to find a domain at which it is non-zero? Namely, I would like to compute the integral ...
0
votes
0answers
37 views

Defining a function through an ODE containing unspecified operators

I want to do some algebra using a function only defined through a DE containing unspecified operators. The DE is $$ \partial_zu(z) = \left[\hat{D}+\hat{N}(z,u)\right] u(z). $$ Here $u$ lives in ...
0
votes
0answers
52 views

How to exclude some methods?

Can I exclude one or several methods from methods tried by a function? When we use some 'algorithm-intensive' function, we can often specify whether we want to proceed according to the chosen method ...
0
votes
0answers
105 views

How to handle exceptions and failures in Mathematica?

In python I can write fallback values like: ...
0
votes
0answers
59 views

Problem with arc length

...
0
votes
0answers
22 views

Acquire a single-variable function by slicing a 3d graph along a given line

Consider my Calculus 2 math problem: Given a function f[x,y]=x^2-3xy and two vectors a = {1,2} and b = {1,1}. Spanning a linear ...
0
votes
0answers
34 views

To assign an array to a function

// Pre-defined parameter kS = 2*(\[Pi]*NefS)/LambdaSS; Here, NefS is a function of LambdaSS. The matrix m (i,j) defined corresponding value of NefS (jth ...