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

learn more… | top users | synonyms

0
votes
0answers
123 views

Intersection of any triangle with a circle in Cartesian coordinates

I started a notebook dealing with metrics in a triangle and its intersection points by a circle. Up to know I reached the point of having plotted a triangle, a circle with an arbitrary centre and I ...
3
votes
0answers
103 views

“Off-label use” of Mathematica functions for performance

Assisting an acquaintance with a simulation where a very large number of binomial probability calculations are required, I pointed them to a slightly obscure function to dramatically speed up their ...
4
votes
4answers
807 views

“do … while” loop equivalent in Mathematica [closed]

Have I missed something or is there no built-in which mimics the behaviour of do ... while loop? I am looking for a construct that evaluates procedure once and ...
3
votes
2answers
194 views

DynamicModule/Dynamic CheckboxBar Slow for Large Lists

I am trying to create a dynamic construct that takes a large list of expressions and allows the user to interactively select any number of entries for further manipulation. This is what I have ...
1
vote
2answers
108 views

How to work with lists of functions

I have some lists of interpolated functions and I want to know if there is an easy way to operate with them. A simplified example: ...
0
votes
1answer
85 views

Working with functions

I am required to write a function that takes a function as a parameter. ...
1
vote
1answer
90 views

Problem with System`Graph and Combinatorica`Graph functionality conflict

I'm trying to generate a random geometric graph. When evaluating HighlightGraph, even if I am passing graph object Mathematica always gives error like A graph ...
0
votes
1answer
75 views

mathematica apply list of functions to the same arguments [closed]

How can I apply list of functions to the same arguments? e.g. ApplyFun[{fun1,fun2,fun3},{arg1,arg2}] I looked here and could not find: ...
1
vote
0answers
36 views

How to apply an rule to factors matching a certain form

Suppose we have many expressions involving irrational ArcTan expressions (such as ArcTan[Sqrt[3],5]) along with other irrational factors (such as ...
1
vote
1answer
113 views

Time Varying Payoffs?

I'm trying to write some code that will return the final value of an annuity whose monthly payouts may or may not be constant each month. Right now I have working code for constant payments, but I'm ...
3
votes
1answer
75 views

How to apply RootLocusPlot corectly

I have to analyze the complex regions of variable c which is define obtained with InverseLaplace help in the form ...
0
votes
1answer
60 views

How to define a function that operate with a base case recursively? [duplicate]

Let's start from the simplest case: say I have a function $f(x)=x$, and let's say I want to define a new function (of $x$) to be its $n$-th power $(f(x))^n$. How should I write the code? I tried: ...
3
votes
2answers
231 views

Differential operator squared

I defined a one-dimensional momentum operator $\hat{p}=-i\hbar\frac{\partial}{\partial{x}}$ in Mathematica p = -I * h * D[#, x]& and I want to get the ...
2
votes
0answers
71 views

Are there some other ways to solve a second PDE except DSolve?

I have a partial differential equation as follows: $$\frac{\partial p(x,t)}{\partial t}=\text{Dp} \frac{\partial ^2p(x,t)}{\partial x^2}-\frac{p(x,t)-\text{p0}}{\tau }$$ What I try to do was to get ...
0
votes
0answers
99 views

Question about NDSolve

Here is my code: ...
0
votes
3answers
91 views

How to combine multiple functions into a single function, indexed bya new argument

I have a system of expressions (matrices) which correspond to increasing orders of precision in a theory. These expressions are quite complex (require about 40+ lines of code to produce) and are not ...
3
votes
1answer
120 views

Arguments for ChartElementFunction

I was reading the documentation for BubbleChart and I saw this example ...
1
vote
0answers
126 views

Slow mixture fitting when having ill-conditioned covariance matrices. How to make it faster?

I'm using Mathematica 9.0 to fit multidimensional observations with a gaussian mixture. To do so I first adapted these steps to ensure that the mixture parameters are well defined (see ...
5
votes
2answers
363 views

Multiply each element of an array by another array?

I would like to multiply an array by each element of another array, and am having a lot of trouble finding a built-in or automated method of doing. Here is an example of what I'd like to achieve: ...
1
vote
2answers
72 views

Using Array Elements as Function Arguments

Suppose I have an array p = {a,b,c,d} and a function f that takes a variable number of arguments. I want to evaluate ...
0
votes
1answer
68 views

Can I make a function which depends on several arguments which are not independent?

Here's a simple example Suppose have the permanent relation that z is proportional to xy^2, for real numbers s. z = s x y^2 Now, we are interested in ...
0
votes
0answers
28 views

Problem with slot in If statement [duplicate]

I am struggling with slots, In this case I have a function int which gives either true or false. When it gives true, I want ...
8
votes
1answer
161 views

Why does Plot[Hold[x], {x,0,1}] work?

It appears that, counter to my expectation, all of these (and probably many others) seem to work fine: ...
2
votes
0answers
97 views

How is Wolfram Language different than regular Mathematica? [duplicate]

From all I can see there seems to be no difference between "Wolfram Language" and regular Mathematica. Is Wolfram just a marketing rebranding of Mathematica or is there a new capability I am missing?
13
votes
4answers
381 views

How to make a function with its own options as well as passing options to other functions [duplicate]

I have a function with many of its own options, but I would also like to pass options to subfunctions using the FilterRules function. Here's a simple example: ...
0
votes
1answer
107 views

Fixed Point Math in MMA

I am working with a library that needs input in a Fixed Point notation. I’d like to figure out a way to convert the floating point results into fixed point representation. The fixed point length is ...
0
votes
1answer
60 views

How to use ImageMultiply[] over a list of strings?

I'm trying to do the following: ...
6
votes
4answers
246 views

Using an ellipse as a threshold for Nearest function

The Nearest function can receive as a threshold parameter a radius to look for elements inside that. From the documentation: ...
2
votes
1answer
59 views

Why is left NumberPadding always applied in NumberForm?

I would like to display numbers like 9.0001 and 10.0001 in the fixed-width form of xx.xxxx. ...
0
votes
1answer
116 views

Finding equation of tangent line at a point [duplicate]

my function is defined as f[x_] = x^1.1 - 2.5 x^.5 I need to find the equation of the tangent line to the curve using the point slope form which would be something like f'[a][x+a]+f[a] a=1 and x=1 ...
0
votes
0answers
22 views

Question about a ParametricPlot with a shading grey family of lines and/or different sizes [duplicate]

So, I have this function of the polar angle $\theta$, with a varying parameter $t$: {Cos[\[Theta]] (1 + Sin[t]), Sin[\[Theta]]} and I want to draw it in a ...
4
votes
0answers
111 views

Can Mathematica Operators be combined in a linear fashion for readability?

Here's a simple example. Suppose we want to find the off-diagonal matrix of m: m={{1,2},{3,4}} This can be solved fairly simply by extracting a list of the ...
4
votes
2answers
305 views

Define a function with a function for an input

I want to create the functions $even[f]$ and $odd[f]$ which will apply the formula $even[f(x)] = \frac{f(x)+f(-x)}{2}$ and $odd[f(x)]=\frac{f(x)-f(-x)}{2}$ for an arbitrary $f$. I tried using ...
5
votes
2answers
276 views

Quickly calculating the mean / median of a function over an interval

I'd like to calculate the Mean or Median value of a function over some interval $[a,b]$. However, I can't seem to find how to do this in help. Specifically I'd like to have something that works like ...
1
vote
1answer
87 views

How can I check if one expression implies another?

Say I have one expression, for example $x^3-3 + c = y$, and I want to check if it implies another with some set of explicitly stated assumptions. With the previous example, assuming all variables are ...
1
vote
2answers
212 views

Multiple curves plotted with different colours [duplicate]

I am trying to use ColorFunction for 2 functions on the same plot. I only want the cubic equation to change colour. ...
2
votes
2answers
90 views

Testing for arbitrary algebraic expression in given variable

I want to test, for example with MatchQ, if the argument of a function is an arbitrary expression in a single or several variables whose names can be assumed to be ...
0
votes
0answers
41 views

Using Table[ ] vs using Do[Append [ ] ] [duplicate]

Is it generally better/faster to use the Table function over using Do[Append []]? For example, I have this piece of code: ...
0
votes
1answer
185 views

Pass unevaluated function with evaluated arguments

I am almost sure that this question has been asked somewhere. I found similar ones, but I cannot find exactly what I need, which might mean that I am on the wrong track. I search a method to pass an ...
0
votes
1answer
73 views

How to write series of Do[ ]'s with a single Table[ ]?

Edited to provide more information (sorry I don't know how to format matrices here) I would like to replace: m = 4; ...
0
votes
0answers
72 views

Using Reduce on an inequality

I have been evaluating this formula, $\frac {3^r - 1} {2^r - 1}$ for $r>1$. The numerator is always even and the denominator is always odd. I am trying to show that the denominator will not ...
0
votes
0answers
52 views

Generating Suffixes [duplicate]

I am doing a large Matrix calculation in which I need to generate symbols first like $F^{\mu\nu}$ I would like to get $\mu\nu = 00, 11, 22, 33$ and so on. I need to have the symbols before I can ...
0
votes
2answers
158 views

How can I improve Do loop?

I have very large input of time series data (over 30000 observations) that look like as follows: ...
6
votes
2answers
174 views

Evaluation in lambda function

If I have a function, that returns a function, for example: f[a_] := a^2 * # & then f[3] == 3^2 # & Is there a way ...
1
vote
1answer
114 views

How to define a summation with function calling itself?

I am new to Mathematica. I want to do this f(x)=summation f(t), summation is over t, where 1<=t<=x-1 and mod(x+1,t+1)=1, i.e. when x+1 is divided by t+1, remainder is 1 and f(1)=1. Should i use ...
0
votes
0answers
33 views

How to plot image of a complex function with a given domain [duplicate]

I've been trying to figure out a way to either draw a curve in the domain of a complex function in one plane and then show the result in another plane (simultaneously?). Actually, just plotting ...
0
votes
1answer
93 views

Integration of DiracDelta

I just came across the following curiosity and I'm not sure whether it's a bug or just me missing something. Here's a minimal example: I defined the following "function" ...
2
votes
3answers
116 views

Creating a function as a table of derivations

Suppose I have function, which is in fact a list of $n$ functions with $n$ parameters f = {#1 + #2^2 + #3^3, #1^2 + #2^3 + #3^4, #1^3 + #2^4 + #3^5}& I want ...
0
votes
2answers
119 views

How to display output as symbols?

I have this piece of code which populates a matrix following different rules depending on row and column number: ...
3
votes
3answers
436 views

For-loop not working as I expect

I want to do this: When 10 <= t < 130, give t -> 1; When 130 <= t<300, give ...