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

learn more… | top users | synonyms

3
votes
0answers
108 views

Do a gauge transformation for a Chern-Simons theory?

Suppose we have the following Lagrangian density: $$ L=\epsilon^{\mu\nu\rho}\big(\sum_a A^a_{\mu}(x) \partial_\nu A^a_{\rho}(x)-\sum_{a,b,c}\frac{1}{3} f^{bca} A^a_{\mu}(x) A^b_{\nu}(x) ...
1
vote
1answer
75 views

Transform list of inequalities into matrix form $A\ x \leq b$

I have a list of linear inequalities, and I want to get it into the form $A\ x \leq b$; i.e., find the matrix $A$ and the vector $b$. Is there any function in Mathematica that can that can do this?
0
votes
0answers
42 views

Limits of PrimeNu [duplicate]

Is there any way to find distinct prime factors for very large numbers using Prime and/or PrimePi that exceeds the ...
2
votes
2answers
74 views

`PrimeNu` counting function

Building on this question, what is the most efficient counting function for distinct prime factors? It would obviously be more efficient if Prime and ...
0
votes
2answers
128 views

How to calculate expected return, row by row in matrix? [closed]

Please help me, I'm writing my project and dont know how to solve this big matrix: I have to compute return row by row: 1st row: (18.32-17.14)/17.14 ; (19.17-18.32)/18.32 .... ...
1
vote
1answer
69 views

Defining functions that reference other values

How could I define a function that references other values? eg a = 2 x; b = 4 k; f[k_, x_] := a^b
8
votes
4answers
261 views

Numerical instability in cosh and sinh - integral functions

I'm trying to calculate the function: CoshIntegral[x] Sinh[x] - Cosh[x] SinhIntegral[x] Unfortunately Mathematica seems to hit a point (x~20) and things become ...
8
votes
2answers
205 views

Automatically compute r[1] = r1; r[2] = r2; …

I have three variables like this, r1 = 4; r2 = 3; r3 = 1; and I want to insert them into a function use them in a function definition like so: ...
0
votes
1answer
117 views

How to plot a function with variable with an open interval? [closed]

I want to plot this revenue function: $r=30q-0.3q^2$ I have no range, its an open interval, but when I try to plot in Mathematica it requires the min and max of the plotting limits. How do I do ...
1
vote
1answer
113 views

Cleaning up InverseLaplaceTransforms in Mathematica

I am attempting to use Mathematica to model an electrical circuit in the s domain. The circuit contains capacitances and and inductances. I've written a series of equations using Kirchoff's laws to ...
1
vote
1answer
86 views

Linearity of a function in Mathematica

I have a function which has something like myFunc[q,a state[c,d]] a could be anything, and I want to tell Mathematica that ...
1
vote
1answer
105 views

Function derivatives in arbitrary dimension

I have a higher dimensional function: $$f(x,t)=-\ln(t)-\ln(1-\left\|x\right\|^2-t^2)$$ where $x\in\mathbb{R}^n,~t\in\mathbb{R}$. I want to compute the derivatives with the commands ...
3
votes
3answers
179 views

Prime factor counting function

Is there any way I can speed up this prime factor counting function? (I am looking for all numbers in a range with 3 prime factors (counted with multiplicity).) ...
4
votes
2answers
175 views

Using Element[]

Can the Element[] function only be used for the domains given in the documentation? I am trying to use it to determine if a value is contained in a previously defined list. Thanks!
1
vote
3answers
137 views

Pure function inside another pure function

I have the following working expression: In[15]:= Length[Select[IntegerPartitions[10],First[#1]==5&]] Out[15]= 7 But, instead of using the constant 5 I want ...
6
votes
2answers
165 views
4
votes
3answers
485 views

Make a differentiable smooth sawtooth waveform

So, I am trying to understand the effect of sawtooth waveform on a mechanical system model. For example, a system of a plate and a box on it. And then we try to oscillate the plate. In order to do ...
6
votes
1answer
180 views

How to type binomial coefficient $\binom{n}{k}$

I know how to type a fraction as you would write a fraction in Mathematica (9). How do you type Binomial[n,k] as $\binom{n}{k}$ in Mathematica? Is there a single ...
0
votes
0answers
89 views

Need Help with Output/Code Optimization Conparative Statics with System of Equations and Matrices

I have a system of equations (equilibrium conditions) and would like to evaluate how changes of exogenous variables affect the endogenous values. In step 1, I state the equilibrium equations and some ...
0
votes
0answers
103 views

Defining a function with more than one formula

I want to define a function with more than one formula, but I don't know how. For example, I want to define a function f which ...
-1
votes
2answers
201 views

How can I extract when a select condition is met in a do loop the value of the iterator?

I use the following code to find out the number of consecutive prime numbers using a formula $n^2+n+i$ found out by Euler (starting from n=0): ...
14
votes
2answers
735 views

Is there an equivalent to MATLAB's linspace? [duplicate]

Does Mathematica have an equivalent to Matlab's linspace? I want to make a list with "start", "stop" and "number of points". What is the neatest way of doing this?
0
votes
2answers
163 views

Using a table to format a grid

Ok, I can't wrap my head around this because I don't know Mathematica well enough yet, so I'm asking for help, at least a direction to explore in. I have a Grid: ...
4
votes
1answer
128 views

Volume within parameter space

Imagine a parameter space with variable 0<p<1, 0<e1<1/2 and 0<e2<1/2. ...
50
votes
2answers
1k views

Flatten command: matrix as second argument

One thing I could never wrap my head around is how Flatten works when provided with a matrix as the second argument, and the Mathematica help isn't particularly ...
0
votes
0answers
64 views

Custom Errorbar-Function

I wanted to have a better control on the ErrorListPlot, so I defined a custom ErrorBarFunction: ...
2
votes
3answers
198 views

How would I plot the volume element in cylindrical coordinates?

I have this graph: But it doesn't have a function so I can't just plugin in a function into wolfram or mathematica to plot it. I have these coordinates to make it however: ...
4
votes
3answers
139 views

Multiple output cells

Is it possible to have multiple outputs from a single function? For example: In[1]:= x+1 x+2 Out[1]= 1+x Out[2]= 2+x has multiple outputs, how can I ...
5
votes
1answer
114 views

Strange Behavior when making Equal Listable in Pick

While trying to make this problem more efficient I tried different methods and dabbled with making Greater and Equal ...
2
votes
2answers
371 views

Q-Function representation in Mathematica

I observed that there is no Q-function representation in Mathematica. The definition of Q-Function is: \begin{align} Q(x) &= \frac{1}{\sqrt{2\pi}} \int_x^\infty e^{-\frac{u^2}{2}}du \\ ...
4
votes
1answer
116 views

Orthogonalizing without normalizing

Is there a way to make Orthogonalize do the normal Gram-Schmidt procedure without normalizing the result? As far as I've understood this was possible with ...
2
votes
2answers
201 views

How can I iterate my code a 1000 times?

this is my solution to Exercise 5 of http://work.caltech.edu/homework/hw2.pdf Please help me make this more elegant. The exercise is about classifying random Points by a (randomly generated) target ...
5
votes
1answer
62 views

How to bail out from a non-applicable transformation function?

I provide a custom function in TransformationFunctions options of FullSimplify that can do a transformation only for some values ...
5
votes
1answer
183 views

Shortest polygonal path

I'd like to find the shortest distance between some points (every point must be visited), such as between these 3 points: ...
5
votes
0answers
157 views

Strange Integrate behavior (a bug!)

The following two calculations should give the same result. After all, integration is a linear operation. I have pasted the code below in case you want to play with it. ...
0
votes
0answers
51 views

mathematica function autocomplete issue [duplicate]

This is the default function structure prompt from Mathematica 9 This is my own function module ...
3
votes
1answer
226 views

Integral of Lorentzian yields different results depending on when parameter assigments are made

I'm evaluating the integral of a Lorentzian, which I know equals one. First I define the function and evaluate the integral in two slightly different ways. Surprisingly, I do not get the right answer ...
1
vote
0answers
66 views

Decapitating “explicit” and “implicit” heads

This is a follow up to this question. So far, I named "explicit" heads to those that appear explicitly in the expression. For example, f[x] has an explicit head. I ...
6
votes
3answers
335 views

Difference between @ and @@

I am confused by the commands @ and @@. From the documentation, I learnt that @@ is the ...
4
votes
2answers
377 views

ArcTan[z] and ArcTan[x,y], Restriction and Conversion

In Mathematica there are two different forms for the arctangent (inverse tangent), namely ArcTan[x,y] which gives the arc tangent of $y/x$, taking into account ...
13
votes
5answers
313 views

Partitioning a list of numbers the Mathematica way

I have two sorted lists, one list will be called the "fences" and the other the "values" Fences could be: $\{1, 5, 9, 14\}$ Values could be $\{-1, 1, 3, 4, 6, 9, 10, 13, 14, 15\}$ I want to ...
1
vote
1answer
150 views

using a Mathematica function to define a new function

I'd like to define a function of three variables which produces a new, named function of a single variable, where this final variable is not a member of the first three. So I'd like something where I ...
4
votes
1answer
187 views

Strange result for the analytic integration leads to Hypergeometric2F1

The integration result for Integrate[1/(r^2 Sqrt[x/r^(4 - 2 \[Gamma]) + 1]), r] is: ...
2
votes
1answer
76 views

What is the need for function parameters? Many possible inputs

If I have many possible variables related to one another, why do I need to define my function with parameters for plotting? For example, if I have an equation like: ...
2
votes
1answer
76 views

Behavior of ValueQ inside a function

The following code Cases[Function[{x}, x + 1], a_?ValueQ :> Hold[a], ∞, Heads -> True] unexpectedly returns {Hold[x + 1]} According to the manual, ...
0
votes
0answers
89 views

How to apply a tensor to a list of arguments

The problem I have is the following: Let C be a list of coordinates, say, C = {x1, x2, ..., xn} and ...
1
vote
1answer
161 views

Split Lingustic(IPA) at Words Unique Sounds

How might I split a word at each IPA of each unique sound. For example {"pray", "wade"} (* {{"p","r","ˈeɪ"}, {"w","ˈeɪ","d"}} *) ssch answered a question here ...
8
votes
1answer
232 views

Two ways of map a function on the list: Which one is faster?

There are 2 ways to make a function listable on the list: Use Map or use SetAttributes. My question is, which one is faster, ...
4
votes
1answer
248 views

How to express an expression with only ArcTan and ArcTanh?

I have an expression which is simply (j/k) x^(j/k) LerchPhi[x,1,j/k)] where 0 < j < k. Manually I have been able ...