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

learn more… | top users | synonyms

0
votes
0answers
97 views

Problem With NDsolve trying to simulate n-body-gravity problem

Im Trying to model a cloud of point masses that act according to gravity, what im strugeling with is the exclusion of cases where euclidian distance = 0, If I try to do it with an If statement in my ...
2
votes
3answers
272 views

Tracking iterations of a function

I'm learning MMA with Wagner's book. On page 41, he uses this to display the iterative steps of a FindRoot. However, I can't seem to replicate this (code at end), perhaps due to the difference in MMA ...
3
votes
2answers
79 views

Function pattern to support listed and non-listed arguments

I often want to write functions that take as an argument either a) a rule or b) a list of rules. As an example, when using Replace with just one rule, it does not ...
6
votes
1answer
271 views

What is wrong about Abs[x]-a? Is it a bug?

Why is the Out[74] not {1 - a, {x -> -1}}? ...
0
votes
3answers
88 views

Create polynomials from Series

This question actually doesn't have quite a lot to do with the Series function, but I don't know how to describe my problem. So here's the thing. I'm trying to ...
0
votes
1answer
60 views

Integrating function can't be epressed? [closed]

Hi I have a function in a form of $$\frac{a}{x}exp(\frac{b}{\sqrt{3}-x})$$ The code is Integrate[a/x*E^(b/(3^0.5 - x)), {x, 1, 3^0.5}] But it can't work ...
2
votes
1answer
108 views

Define function that counts recursive fibonacci

If I write count=0; fib[0]:=(count=count+1; 0); fib[1]:=(count=count+1; 1); fib[n_] := (count = count+1; fib[n-2] + fib[n-1]); Then I can ...
1
vote
2answers
116 views

Define the square of a function [closed]

Is there any good way to define the square of a function in M9? Usually one can write e.g. f[z_] = 3*Sin[z] etc etc. But is it possible to define ...
2
votes
4answers
366 views

How to completely delete the head of a function expression

Is there any way to completely remove the head of an expression function? For example, how would I remove the head Cos from ...
1
vote
0answers
79 views

Expression for evaluating multiple functions?

I am constructing 3D data points for a plot and corresponding to specific conditions "manually". I define the values of five parameters [these I always have to define myself]. From those, I evaluate ...
4
votes
3answers
209 views

Counting number of inversions

Is there an inbuilt method to find the number of inversions in a set of numbers? I found Inversions in Combinatorica but when I ...
0
votes
2answers
65 views
0
votes
1answer
47 views

Switching the ordinate and abscissa causes problem in `ParametricPlot`

I have a function that plots properly in PolarPlot, but I'd like to plot it in ParametricPlot and then switch the y and x ...
0
votes
1answer
74 views

Is there a way to make the MemberQ function apply to a list?

Is there any way to ask a boolean question if the elements of the list {2,5} are in the list {1,2,3,4,5}?
0
votes
1answer
62 views

How I can define a new function as a function argument?

I need to pass a function with t as independent variable as a function parameter and want to create a new function of the same through this provided the argument of another function. Here is my code. ...
0
votes
1answer
99 views

Getting “Null” output from package?

I have a script written to test a package as follows: ...
1
vote
0answers
59 views

How to find matrix exponential using RootSum?

From what I've been able to deduce, Mathematica uses a root sum scheme to determine the exponential of a matrix. Can someone please explain to me the theory behind this? I've searched, but have had no ...
0
votes
2answers
229 views

How to pass a list as function argument?

I have the following function lFreqPhylo[a_, Q_, b_, p_] := Sum[Log[freqFunction[r[[p]][[i]], L[[p]][[i]], a, Q, b, {i, 1, nbranches[[p]]}]; The objects L, r ...
-1
votes
3answers
117 views

Creating Do loop that cycles back to earlier values

I need to create a Do loop that distributes letters in a list of lists. I also need to be able to cycle back through to the beginning of the list. For example, I ...
2
votes
1answer
77 views

Can Do-Loops iterate backward? [closed]

If I create a Do statement, Do[expr, {i, imin, imax}] is there a way to make the statement evaluate from ...
0
votes
1answer
52 views

ToExpression and Fortran notation

ToExpression["9.0E-03"] interprets String as 9*e - 3 instead of what I am expecting ...
2
votes
1answer
107 views

What is the formula Mathematica uses for ZetaZero?

What is the formula/algorithm Mathematica uses for the ZetaZero command?
1
vote
1answer
72 views

Apply function to output of previous function

I am trying to write a function that takes 3 tuples. Each tuple contains two lists which are first divided. This results in 3 lists. Then I want to take the Mean of all the columns. I can do this ...
5
votes
1answer
71 views
0
votes
1answer
56 views

Inverse functions - how are they calculated?

Mathematica is able to calculate InverseFunction[LogIntegral] and InverseFunction[RiemannR] (and many other inverse functions). ...
1
vote
1answer
54 views

VertexSize with GraphPlot [closed]

I'm constructing a graph using GraphPlot and I want some vertices to have a different size than others, like this: ...
2
votes
2answers
92 views

Graphical solution of a a two-variable system containing an equation and an inequality

I'm currently studying atmospheric-gravity waves and their dispersion relations. I want to have look at values of $(x,y)$ that solve the following system : \begin{equation}\label{}(1) \left\{ ...
1
vote
0answers
71 views

Find eigenvalues without filling the matrix

Is it possible to find eigenvalues of a matrix without filling it? The matrix elements are given by a known function f[p1,p2]. This is relevant for a matrix too ...
1
vote
1answer
56 views

Get subgraphs: communities of graph g

I have a graph g. I want a set of graphs c which holds the community subgraphs of g. I ...
3
votes
0answers
78 views

Why does Part behave like it transposes lists? [closed]

From the documentation of Part: Part[expr,i,j,...] is equivalent to expr[[i]][[j]]... ...
1
vote
2answers
97 views

function of derivative of a function

I know a similar question is answered somewhere, but it doesn't work for my case for some reason. I have the following problem in Mathematica. I want to compute f[h[x]]= x^2 + D[h[x],x]. Here, h[x] ...
2
votes
1answer
81 views

Why evaluation doesn't fail if arguments are invalid? [duplicate]

Sorry for a noob question, but this is something that I wonder about each time I work with Mathematica. Coming from standard programming languages (Python and Java), I expect my functions to fail ...
0
votes
1answer
142 views

Discrete peaks to curve via Voigt summation

I have two data sets. One is an experimental recording of an absorption spectrum, composed of regularly spaced (wavenumber, intensity) coordinates with a fine wavenumber resolution, thus making ...
0
votes
1answer
49 views

Defining arbitrary order derivatives function [duplicate]

I have a function $\phi(t)$ and I want to define a function $\phi D(t,r):=\phi^{(r)}(t)$, in other words evaluate the $r$'th derivative of $\phi$ at $t$. The naive code that I have is: ...
1
vote
1answer
78 views

Sort lists of vertices {indegrees, outdegrees} by indegree

in = VertexInDegree[F]; out = VertexOutDegree[F]; I want both in and out to be ordered by in. Example: graph has nodes a,b,c with indegrees 1,2,0 and outdegrees ...
1
vote
1answer
48 views

Replicability of RandomVariate within a function?

I have a rather basic question but can't figure out a foolproof answer. In the following code, I build a function which returns the mean difference between successive elements of a vector created from ...
0
votes
0answers
30 views

Table of values for functions with random variables [duplicate]

I'm trying to get a table of values for functions with random variables. First of all, i have a function like that: ...
0
votes
0answers
73 views

Financial Derivative european call option

When estimating financial derivatives like a european call option there is a parameter named: dividend paid per time unit. What does this mean, I have not been able to find any more information about ...
0
votes
1answer
76 views

Problems with For statement

I'm trying to iterate some expression through for loop: ...
0
votes
1answer
97 views

Mapping a function over n levels

I want to map a function over a matrix of rank n, for example: ...
11
votes
4answers
433 views

Plot the minimum of a list of functions

This is my first question on any stack-exchange site and I'm also very new to using Mathematica software so please excuse/correct me if I mess up. I would like to take a list of functions of a single ...
1
vote
3answers
165 views

Testing for continuity over a given domain

Is there any way to use Mathematica to test whether a function is continuous over a given domain?
0
votes
0answers
120 views

Solve function doesn't work

I have the following system of equations that I need to solve: ...
1
vote
1answer
58 views

Compose two special power series expansions

I have two functions $A(x), B(x)$, given in a special power series form: $A(x)=1-x^{2}\left(\frac{a}{10}-\sum_{k=1}^{9}b_{k}\left(\frac{(x^{2}-1)}{r}\right)^{k}\right)$ ...
2
votes
0answers
97 views

A math function similar to “LatticeReduce” for finding linear independent basis

We would like to ask a math function similar to "LatticeReduce" for finding linear independent basis. The input is a list of vectors $M=\{v_1,v_2,v_3,\dots\}$, with the following property: There is a ...
4
votes
4answers
211 views

Speed up replace all

I have large list of rules, I would like to use list/.rule, but assume that rule is a set of rules rule 1, rule2 rule...I want ...
2
votes
1answer
184 views

Plotting attributes of vertices in WattsStrogatzGraphDistribution[n, p, k]

I have a graph WS = RandomGraph[WattsStrogatzGraphDistribution[n, p, k]]. I need to plot several characteristics of each v: the ...
1
vote
1answer
193 views

ListDensityPlot

In Mathematica help it's written that: ListDensityPlot[array] -> generates a smooth density plot from an array of values. ...
6
votes
1answer
112 views

Is it possible to circumvent a bug inside SeriesCoefficient?

As far as I can tell, there seems to be a bug in SeriesCoefficient: ...
2
votes
1answer
158 views

Matrix exponential MatrixExp[] vs Sum[MatrixPower[]] doesn't match?

I might be an idiot, but I cannot get the manual expansion of e^At to match the MatrixExp[A t] result. For example, I have the following: ...