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

learn more… | top users | synonyms

0
votes
1answer
116 views

Loop function question [closed]

I'm new to Mathematica. Below is the code I have trouble with. ...
0
votes
1answer
64 views

Circumventing the default scoping: Assign a variable inside a function [duplicate]

I'm currently trying very hard to assign a variable inside a function. Therefore I'm using a function like this, which should reassign a predefined variable. ...
0
votes
0answers
50 views

Display functions without dependence?

I'm solving systems of equations with a few different functions of time, t, and so I'm getting output with lots of [t] running around. Is there a way to display these functions without the ...
0
votes
2answers
113 views

Defining a function in terms of matrix elements

Currently trying to use elements from a matrix in defining a function however having some trouble. This is a somewhat simplified version of the problem. Say I have the matrix ...
0
votes
1answer
41 views

Showing result of derivative and other functions [closed]

I have a problem with my Mathematica 7.0 When I write: Derivative[x^2, x] Mathematica returns as result : ...
14
votes
2answers
674 views

Why do certain values in ArcSin not fully evaluate?

This is a continuation of: Why do certain fractional values in TriangleWave not evaluate? The analysis by R.M and rasher revealed that problem to reduce to the behavior of: ...
0
votes
0answers
20 views

Incorporating Built-In Function Options/Parameters into Shorthand [duplicate]

Shorthand syntax provides an alternate way to apply functions and, in many cases, improves readability. A simple example would be ...
0
votes
1answer
86 views

How to distinguish expression from zero [closed]

my question is the following. I have an array, which elements are functions (say, sines of symbolic arguments). Some of the elements are zeros. I want to write code like: ...
1
vote
1answer
99 views

Is linear interpolation applicable here

From my understanding about Linear Interpolation especially of that of Newton's Divided Difference Polynomial, we could get the value of F(x) from the given set of ...
0
votes
1answer
40 views

Extend a function defined for integers to a differentiable function of a real variable

Here is a function that calculates the probability of randomly landing on a Fibonacci number not greater than $n$: ...
7
votes
2answers
325 views

Can you apply the Cellular Automata function to a grid containing numbers?

Im attempting to simulate a simple evacuation model using cellular automata theory.My study aims to determine whether Cellular Automata can effectively represent how people would behave in a fire ...
2
votes
2answers
202 views

How to plot several functions without jumping? (multiple eigenvalues of a system as functions of 2 parameters)

I've been working on this research problem for months with some success by no global/proper solution to the problem. So I have square, Hermitian matrices of various sizes ($8,20,38$ dimensions) with ...
3
votes
0answers
45 views

Precedence of defined functions [duplicate]

When I define functions in Mathematica like: f[x_] := 3 f[x_Integer] := 6 How is the value of f[6] determined? It seems to ...
8
votes
2answers
239 views

Nest , Fold … is there an extension for more than 2 arguments?

Fold is an extension of Nest for 2 arguments. How does one extend this concept to multiple arguments. Here is a trivial example: ...
2
votes
1answer
86 views

Declaration of variables in large Linear Programming model with NMaximize

I want to solve a large LP problem using NMaximize. This is a small instance of my bigger problem: $$max \sum^{4}_{t=1}(\sum^{4}_{c=1} V_{c}*f_{c,t})\\ s.t\quad ...
2
votes
4answers
175 views

Redefine ArcCot to be inverse of range [0, Pi]

Mathematica implements ArcCot function as an inverse to Cot on range [-Pi/2, Pi/2]. I ...
2
votes
1answer
91 views

Piecewise function with user-input interval

I would like define a function g[data,bins,x] which is a piecewise constant function taking value data[[i]] in the range ...
1
vote
2answers
100 views

How to sort Table/Matrix including legend(Labellings)

I want to sort table including its legend for graph I have table similar to M1 M2 M3 1 5 2 3 1 4 4 2 -10 5 7 11 6 -2 1 ...
6
votes
2answers
207 views

Why does PolynomialQ[x^n, x] return False?

From what I can see PolynomialQ will return False whenever some exponent is another variable such as here: ...
1
vote
3answers
136 views

professionalize/optimize my code that calls a function

I have the following construction, which defines a function that I subsequently call in a loop multiple times. I use this very often, but I have never looked into if there is a more professional way ...
6
votes
3answers
179 views

Understanding Function and Variable in Mathematica for beginner [closed]

I'm reading the book of Leonid Shifrin, and I love the way the book explains the core in Mathematica. As everything is an expression, now I understand that, there ...
9
votes
4answers
235 views

Refering to global variables inside modules

How do I refer to global variables inside modules if the same name is used for a local one? In code, I want that ...
1
vote
1answer
91 views

Perform FindRoots on Function Evaluation Containing RootSearch

I am using Ted Ersek's RootSearch function in Mathematica 9.0 (http://library.wolfram.com/infocenter/Demos/4482/) to create a function that I am using for graphing. ...
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 ...
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) ...
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 ...
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
0
votes
1answer
146 views

Is it possible to convert expressions containing Root objects to Excel formulas?

I am still a beginner and do not fully understand pure functions and root objects. When I tried to calculate the inverse of a function, Mathematica gave me: ...
8
votes
4answers
260 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: ...
1
vote
1answer
110 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
2answers
100 views

Add a column to a matrix as a function of the other columns

I was wondering if its possible to add a column to a matrix by a formula that uses all other columns, like this: ...
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 ...
0
votes
1answer
116 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
104 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).) ...
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
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
1answer
178 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 ...
6
votes
2answers
95 views

Partial result of aborted evaluation of FullSimplify

When FullSimplify invoked on a large expression, it can run for hours. If I do not have time to wait, and abort the evaluation, I get no result, although, ...
4
votes
3answers
478 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 ...
8
votes
3answers
161 views
6
votes
2answers
165 views

how recover lost data of coordinates from contourplot of mention data?

I have made Contour Plot for a lot of data, like this ...
1
vote
1answer
156 views

Interpolation of a table with 4 parameters

I have a huge data file which I need to do some analysis on it. The file is built in this way that for each 4 variables, there is a value of the function: ...
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 ...
14
votes
2answers
721 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
160 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: ...
-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): ...
0
votes
0answers
88 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 ...