Questions tagged [functions]

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

256 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
0
votes
0answers
30 views

How to change the formulae of FeatureExtraction?

I have a feature extraction function fe, which gives me n/0.816497 as the output of fe[{1}]:- ...
0
votes
0answers
55 views

Functions definitions with variable arguments

How do you define a variable amount of functions with a variable amount of arguments? I don't get the reference at all : ...
0
votes
0answers
107 views

Help! SystemException[“MemoryAllocationFailure”]

I am trying to run this code: ...
0
votes
0answers
65 views

Is there a way to Connect a function ''normally'' through its Pole?

Basicaly I have this function: ...
0
votes
0answers
108 views

How to give a function multiple variables in a mapped and nested list?

I come from python (not advanced tho), and have been learning mathematica. I'm currently struggling with the following code: This is a basic version of what i wanted to implement: ...
0
votes
0answers
76 views

HannWindow implementation and discretization speed

I would like to discretize a series of HannWindows, but two issues arise. First, my manual implementation of HannWindow seems to ...
0
votes
0answers
42 views

Having Trouble with CountryData [EDITED]

I have a list which I call by countryExportPartners = Table[l = CountryData[][[n]]; {l, CountryData[l, "ExportPartners"]}, {n, 1, Length[CountryData[]]}] I ...
0
votes
0answers
84 views

Iterating a Module

I have a Module that can act on other Modules, which is given as Kk[EE,p,z1,z2,z3,K_func] and I am trying to iterate it, such that ...
0
votes
0answers
47 views

Plotting smoothly inverse squared force fields

I would like to plot a DensityPlot of two 1/r^2 functions on a 2D plane (this is supposed to visualize the inverse squared force field law between two points). If I plot the code below I get only two ...
0
votes
0answers
38 views

How to can write the simplest form

I am trying to find the simplest form of a function that contains many different Sign to a function without the Sign function: <...
0
votes
0answers
63 views

Vector from Matlab to Mathematica as a function

I have a 400x1 vector T in Matlab which is a function of another 400x1 vector E. I have these two vectors. I had a few questions : How do I transfer these two vectors to Mathematica I want to write T ...
0
votes
0answers
36 views

Defining functions with pattern as argument

I want to define a function such that f[18/17 h[y][z]] = 18/17 z for any function h[y][z]. I first tried with ...
0
votes
0answers
63 views

Integrate a multivariate function similar to a delta function

I am doing a code in Mathematica. I have the following function: ...
0
votes
0answers
59 views

paraconjugate of polynomial

I'm trying to obtain the paraconjugate of a polynomial with the following code, ...
0
votes
0answers
74 views

How to change ellipse function format?

I already has ellipse function as below: −3.06274x^2−y^2+1192.22x+152.71y+1.829648xy −196494==0 but I want to get the function like: ...
0
votes
0answers
81 views

how to override the derivative of a function ?

i have the following equation : ...
0
votes
0answers
103 views

Array Plot Custom Color Function Black Magic

Sorry, lots of code here, somebody explain this to me: ...
0
votes
0answers
41 views

How can I store interim results from FindMinimum?

I wrote a mathematica function which uses external programs. The external programs read numerical datas from mathematica. The mathematica function need x-parameter in the next round of FindMininimum-...
0
votes
0answers
30 views

Factoring a multi-variable function into single-variable terms

Suppose I have an arbitrary function $f$ of $n$ variables. For simplicity, let's assume that $n=3$. Suppose that I have its explicit form, $f(x,y,z)$ and I want to expand it into a sum of terms, each ...
0
votes
0answers
523 views

How can I define my own ColorFunction?

Suppose I want to define a color function to use more than one graph. I'd prefer not to type it out every time. I know that I can set ColorData like this: ...
0
votes
0answers
40 views

MMA Function is not recognizing an input parameter to PrependTo Statement

I am getting an error in the following code? What is the error telling me? How to fix? ...
0
votes
0answers
79 views

Retrieving values from InterpolatingFunction

I have code for finding the flight of a golf ball and I would like to retrieve the values of horizontal displacement x[t] and at the time when the golf ball hits the ground (y[t]=0, when t=tmax) <...
0
votes
0answers
59 views

Why Plot is not a listable function but still take input as a list?

By using Attributes I can see that the function Plot is not a Listable function. ...
0
votes
0answers
158 views

Map onto function defined by derivative operator

I'm trying to map different values onto the derivatives of a function. To test it, I've tried the following: D[x^5, x] /@ {1} And the output is: ...
0
votes
0answers
504 views

(Basic Question) How to use nested functions properly?

UPDATED PORTION OF QUESTION AT THE BOTTOM First, let me apologize for two things: 1) I'm very new to Mathematica, so this question is certainly very stupid, 2) I looked for the solution to this both ...
0
votes
0answers
108 views

Solving equations involving NIntegrate

First, I have defined some functions like ...
0
votes
0answers
36 views

Confusion over constructing interpolation functions from tables

Suppose I have a set of functions: f[x_] := x^2; g[x_] := (f[x])^2 +2*f[x]; h[x_] := 2*f[x]+5*g[x]; I tabulate the first two functions over ...
0
votes
0answers
318 views

What's the fastest way to find the nearest Positive Definite Matrix?

Let's assume that I have a symmetric matrix $A$. What's the fastest way to find its nearest positive definite matrix in Mathematica? Any help would be appreciated.
0
votes
0answers
59 views

How to apply equivalences in the Limit?

Actually, I have the following expression $a1$: ...
0
votes
0answers
180 views

how to write the Max of this function / How can i use Max[]

Hi every one I really need your help in this question write the function in the picture nction in Mathematica because I need to make graph... ?? could anyone help me ? I'd appreciate some help. ...
0
votes
0answers
91 views

Extracting Data from For Loop

I want to add phases in for loop and after adding a new phase I want to export this data? How can I do this? Can you show me where I do wrong? ...
0
votes
0answers
65 views

Why 3 Different results for same Integral of a series?

I have the integral of a Series. According to some details, I get different outputs and I don't know which to rely on. Can anyone explain me the differences and if I am doing some mistakes? ...
0
votes
0answers
82 views

Why do I get Imaginary unit after Abs and Complex expand?

I am getting an imaginary unit in the output after Abs and saying Complex Expand, why? Then, when I integrate in x and z, I miss beta. I don't get why beta vanishes in the definite integral. ...
0
votes
0answers
56 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.
0
votes
0answers
80 views

Speed optimisation of consecutive loops

Very simple question, which for some reason I am unable to find a proper solution with Nest or NestWhile. My issue is speed. The idea is simple. 1) Construct a list of length T according to a linear ...
0
votes
0answers
647 views

Polar to Cartesian and Cartesian to Polar Transformation

I have noticed some odd behavior when converting from Polar < -- > Cartesian. For example; https://math.stackexchange.com/questions/290209/diff-eq-transformation-polar-coordinates We want to ...
0
votes
0answers
224 views

Compiling matrix multiplication using a list of matrices

I'm trying to create compiled function which computes a list of Gamma matrices named GammaM and multiply them within the compiled code. ...
0
votes
0answers
84 views

Using RegionFunction with non-trivial Inequality

So I have been using ContourPlot to plot the zero set of a fairly unwieldy function, with many intersecting components. There's really only one of these components ...
0
votes
0answers
81 views

Solving a system of equations with conditional functions

With your help i am getting closer to the solution of my problem. I know that the code is long but most of it is boring definition. At the beginning i am just defining function, which works at the ...
0
votes
0answers
57 views

PolynomialExtendedGCD in 2 variables

Consider a field $R$ and the ring $A=R[y]$. Consider two polynomials $g,h\in A[x]$. I want to obtain $d=\gcd(g,h)\in A[x]$ and two polynomials $s,t\in A[x]$ satisfying the Bézout relation: $sg+th=d$. ...
0
votes
0answers
355 views

Impose a boundary condition to a function

Background I am trying to impose a boundary condition on a function of two variables $u(x_1,x_2)$. The boundary condition is: $u(x_1,0)=A\cos(\omega x_1)$. The same function in mathematica $u(x_1,0)$...
0
votes
0answers
57 views

How to calculate a continuous function once and access values later?

I have a function that involves a numerical calculation: h[v_]:=NIntegrate[f[x]*Log[p[x, v]], {x, -Infinity, Infinity}] I need to visualize how well a bunch of ...
0
votes
0answers
90 views

Using DeleteCases to ignore term of Product

I'd like to calculate $\int_{-\infty}^{\infty}\mathrm{d}x/(1+x^6)$ through a variation of the residue formula, which is $\int_{-\infty}^{\infty}f(x)\mathrm{d}x=2\pi i\sum \text{Res }f$ for Residues in ...
0
votes
0answers
48 views

Obtain a SymmetricReduction of a bivariate (symmetric) function given in Piecewise form

I would like to re-express the following bivariate (symmetric) function (defined over the unit square) ...
0
votes
0answers
68 views

Personal Reminder with Speak capability repeats multiple times

I am trying to create a personal reminder for myself using the Speak function in Mathematica hoping that the computer speaks the task only once at the designated time. However, I have found that the ...
0
votes
0answers
66 views

Constructing a function for expanding general $n$ products

I have the following quantum mechanically motivated product: $\langle0\vert(A_1b_1 + A_2b_2 + A_3b_3)(B_1b_1 + B_2b_2 + B_3b_3)(C_1b_1 + C_2b_2 + C_3b_3)$, where $b_i$ is an annihilation operator ...
0
votes
0answers
263 views

Piecewise function output response interpretation

Piecewise[{{t^2, t <= 0}, {t, t >= 0}}] Outputs: t^2 t <= 0 t t >= 0 0 True What does the last line of output 0 True mean? Sometimes it ...
0
votes
0answers
476 views

simulate a 32-bit signed integer overflow in a recurrence function

Considering the following recurring equation: which is this factorial function: I want to find the value of x where f(x) = 0. Actually, the solution is impossible with Mathematica, and it's pretty ...
0
votes
0answers
60 views

Should this be equal to Gamma function or not?

I define the following function: Nat2[s_] := InverseFourierTransform[FourierTransform[1/t, t, w] (-I w)^(s - 1), w, x]/Cos[Pi (s - 1)] /. x -> 1 I expected ...
0
votes
0answers
132 views

Timing: how make a program to work faster using built in functions and tables

I want to improve my code to make it working faster even for very large numbers. ...