Questions tagged [functions]

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

Filter by
Sorted by
Tagged with
0
votes
0answers
30 views

Wigner 3j-symbol in mathematica

I am looking for a nice and workable formulation of the 3j-symbol in terms of hypergeometric functions. On the wolfram webpage I found: http://functions.wolfram.com/HypergeometricFunctions/...
3
votes
1answer
79 views

What does :Automatic in a function definition mean

I've been trying to figure it out, to no avail. In reading someone else's code, I come across a function definition, where it says something like this ...
1
vote
1answer
74 views

Is it feasible to curve fit to a staircase function? [closed]

Taking as a starting point the advice given in this post I am trying to fit data to a staircase function as follows: ...
0
votes
0answers
56 views

Function and variables [closed]

Make a function in which for entered functions with 3 variables , values of variables and relative error of function ,calculates needed relative errors of variables. Can someone give me an idea how ...
2
votes
1answer
101 views

Plot nested integration of an InterpolatingFunction efficiently

Suppose we have an InterpolatingFunction from NDSolve ...
1
vote
1answer
37 views

For a multivariable polynomial of degree t, how can you find the coefficients of monomials of degree t?

Hello Mathematica StackExchange community, I'm hoping that someone can be of help! Let p be a fixed prime. I have a multivariable polynomial g (of degree t). I need a list of all the monomial terms ...
0
votes
0answers
23 views

how to convert a vector contains vectors each vector 8 bits i want to change each 8 bits into decimal [closed]

how to convert a vector contains vectors each vector 8 bits i want to change each 8 bits into decimal then i want to plot the image with img = Image[ vector, "Byte"]
3
votes
1answer
93 views

Mathematica unable to evaluate function which it can write explicitly in simple form

I have a function $\psi(x,n)$ in mathematica which is quite complicated. However, plugging in $n=0$ gives a simple form. Mathematica knows this (see below), however it is still unable to even evaluate ...
2
votes
1answer
32 views

How do I make exponential graph show only one trend-line with two lists of data?

Below is my code containing two lists of data, I need the graph to show one exponential trendline from an exponential equation, but it currently shows one trendline per item in the list. I am sure ...
0
votes
1answer
23 views

Defining a conditional statement for a function

I am trying to define a function that is zero when it is evaluated on real numbers and on a preset list of symbols. I am doing this by using ...
4
votes
1answer
494 views

How this foo, ## & @@ work?

Can anyone explain the code below? The problem is in this part of the code. What is foo, ## & @@? I have been looking at ...
1
vote
1answer
40 views

Little confused about taking transformation

I have a function f, the value of the function at x=0 is zero and at x=2 it is one. I am trying to interchange this, meaning at x=0, f should take the value of one and at x=2 f should be zero. ...
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 ...
4
votes
2answers
114 views

Making tables and update calculated values

I'm trying to make tables like in the image to calculate max and min of the expressions. Whenever I change the max and min of a and ...
0
votes
1answer
43 views

Two “different” call of the same expression give two different results… why?

Consider the following code: ...
0
votes
0answers
45 views

Extracting a linear equation from a graph

...
1
vote
0answers
63 views

Slot numbers, pure functions [closed]

For the first line of code my function works fine on the list, but when trying to use Map I just keep getting an error (Function::slotn) basically saying there are not enough arguments for it to work, ...
5
votes
4answers
280 views

Recursive function, if and which statements

I am given this question: Let a function $ T_n(x) $ be defined by: $$ T_{n+1}(x) = \frac{1}{x} T_{n-1}(x) - \frac{2}{7} T_n(x), $$ where $ T_0(x) = 1, T_1(x) = x $. I need to construct a recursive ...
1
vote
0answers
28 views

Do I have to write the independent variable always?

I'm not used to using Mathematica. Please help me. What I want to do is similar to the following: U and V are unknown function ...
2
votes
3answers
72 views

Function on nested lists

Please can someone help with this question, I'm a bit stuck. Write a function which will accept a list corresponding to a mark list, where each entry in the mark list has the form ...
4
votes
4answers
214 views

How to Force Evaluation of Derivative in a Pure Function Definition

Let's say I have a function f1 = #^2 &; I want to calculate its derivative, perform some manipulations and make the result a pure function. I try ...
0
votes
0answers
24 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 ...
5
votes
1answer
69 views

BreadthFirstScan and DepthFirstScan

Recently, I have been playing with the functions BreadthFirstScan and DepthFirstScan. I'm having a hard time understanding the ...
0
votes
2answers
61 views

Use `If` to create new list from old

I'm trying to use If and AppendTo to create a list by imposing conditions on an initial list. And I'm getting an error that "...
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
46 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
2answers
40 views

Truncating digits after calculation

I am working on numerical solutions to PDEs. I get some outputs which I then place back into the original equation to check my answers against expected values which are the original inputs. The ...
3
votes
2answers
77 views

How does mathematica decide what `x_` is in `MemberQ[list,x_/;(x==#)]&/@list`

Consider the following code: list={1,2} MemberQ[list, x_ /; (x == #)] & /@ list This gives {True,True} ...
0
votes
0answers
22 views

Using a Which statement with Graphics3D [duplicate]

*Problem solved in the comments I am trying to write a function that outputs a different graphic depending on the user's input, with four total options. I was making a test version and am running ...
2
votes
1answer
27 views

StringMatchQ with Alternatives

Why when trying to find whether one (out of several) patterns matches an expression - using StringMatchQ - all of them seem to be ignored and no matches are found? ...
3
votes
3answers
120 views

Is there a way to speed up the following calculation Table[If[TrueQ[],k,Nothing],{k,10^5,10^7}]

I've the following code: Table[If[TrueQ[2+3^k>2^k+(-1+2^k)*Floor[(3/2)^k]],k,Nothing],{k,10^5,10^7}] Is there a way to speed the calculation up in Mathematica ...
1
vote
0answers
44 views

Defining function with index [closed]

I have the following relation: (i=1,...,q). For defining li, I write: l[i_] := 2 R Sin[\[Phi][i]/2] where R is the radius of a circle, l[i] is the i-th length ...
3
votes
1answer
70 views

Plot function with parameters from Reduce

I would like to modify the question a bit. I want to plot the function m with different combination of (a1,b1,a2,b2) over a ...
5
votes
1answer
53 views

Creating a dynamic list of parameter defined functions

I'm trying to create a list of functions that is dynamic in size and defines function names like so: ...
0
votes
0answers
22 views

What is this function syntax doing? [duplicate]

I'm trying to work my way through another person's notebook. I came across this function definition: ...
4
votes
2answers
157 views

How to calculate volume under $ f(x, y) $?

I have the following function: σ = 0.3; μ = 5; cy =0; cx=0; f[x_,y_]=Exp[-(1/2)((Sqrt[(x-cx)^2+(y-cy)^2]-μ)/σ)^2]/(σ*Sqrt[2*π]) Plotting this with: ...
1
vote
0answers
52 views

Why is g[x] handled differently as f[x] from Mathematica? [closed]

When I execute this code: ...
0
votes
1answer
48 views

How to export a table of functions [closed]

Consider a table having rows {a, b, f[a,b,t]}, where a,b are parameters while f is a function of t (being the numeric solution of some differential equation). Is it ...
7
votes
1answer
130 views

About Silverman's bandwidth selection in SmoothKernelDistribution

I asked the following question in the site Cross Validated: https://stats.stackexchange.com/questions/444320/convergence-of-kernel-density-estimate-as-the-sample-size-grows/444479#444479. It was about ...
0
votes
1answer
52 views

Convert function to its harmonic in mathematica [closed]

How do I expand the following function function: (x0 + B Cos[x] + A Sin[x])^3 such that the function expand as a harmonic that id I get Sin(x), Sin(2x), Sin(3x) and similarly Cos terms...Instead of (...
0
votes
2answers
97 views

Simplifying polynomial fractions with same `DiracDelta` function in both denominator and numerator

I am trying to simplify an expression with multiple Diracdelta functions in both numerator and denominator. For example, ...
7
votes
1answer
65 views

Logistic Regression classifier in Versions 12 vs 11.3

There is a mysterious "LogisticRegression" method in MMA, which could be applied as a substitution for missing multinomial logit functionality. In version 11.3 I had the following simple 3-category ...
0
votes
0answers
21 views

Plot 2 functions, and function defining practise [duplicate]

I would like to plot the f1 and f2 functions on the same plot. The problem is that all functions are green on the plots. Is this a good practice to define the f1 and f2 functions and the rules like ...
0
votes
1answer
38 views

How to map a list of entities into a function?

x = RandomChoice[CountryData[]] Here I have defined x to be a random country. ...
5
votes
2answers
659 views

How to optimize the following function?

Consider the following function: function[x_, y_] = If[x < Exp[y], Sqrt[1 - x/Exp[y]], 0]; functionTotal1[x_] = Sum[function[x, 0.02*j], {j, 0, 4*10^5, 1}]; ...
1
vote
0answers
23 views

Returning only part of a list after a function call to save memory [closed]

I need to get only V of a singular value decomposition of a matrix. In MATLAB I could write: ...
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 (...
3
votes
1answer
41 views

How to make function act on (multiple) replacement variables [closed]

I have a function which returns an algebraic expression corresponding to a "jump" between two ordinates, for example $[x]=x_2-x_1$. The function applies for any choice of variables and labels. The ...
0
votes
1answer
36 views

What to input for Nested ANOVA on Mathematica (SS-Subgroup B)

Does anyone know how to run a nested ANOVA on Mathematica, given a dataset? For example: PCB Level 1, Sample 1: {1,2,3}; PCB Level 1, Sample 2: {4,3,2}; PCB Level 2, Sample 1: {1,5,7}; and PCB Level 2,...
4
votes
1answer
102 views

How to find the operand of a sinusoid?

For a function $\sin[2x]$, the operand is $2x$. If we want know the value of the operand by hand, the function is simply $\arcsin(\sin[2x])=2x$. How to do this with Mathematica? Here's what I tried: ...

1 2 3 4 5 52