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

learn more… | top users | synonyms

0
votes
1answer
35 views

What is the function “oneflag_:0” in this expression? [closed]

The first function Pivotdown can zero out all entries in a column below a desired location. But l don't know the function of “oneflag _0".
31
votes
3answers
3k views

Implementing continuous phase/Arg function

In MATLAB there's a function called phase that is just like our Listable friend Arg, but ...
0
votes
0answers
75 views

How to change the built-in function? [duplicate]

As you can see,the original Differences will get {} when your parameter is a list with one element just. Differences /@ {{1, 2, ...
0
votes
2answers
64 views
0
votes
1answer
31 views

Simplification of rational function with Assume function [closed]

I didn't manage to simplify this expression : Simplify[Assuming[x > 0, -((2 Sqrt[x^2/(1 + x^2)^2])/x)]] Do you have ideas why the simplification is not ...
10
votes
1answer
315 views

Interpolation function way off

I have a simple list of data points to which I would like to fit an interpolation function. However, the results given by Interpolation[] gives an oscillating function which is not warranted by the ...
3
votes
1answer
98 views

Map if-function on a list

I need to convert a battery charging mechanism from Excel into Mathematica. This Excel function is about deciding if the charge/decharge rate is positive, then multiply with efficiency factor, ...
44
votes
3answers
585 views

What bug fixes can be implemented in init.m?

In comments on this question, Mr. Wizard suggested a community wiki to share the bug fixes/workarounds (or possibly other tricks) people load in their init.m. I ...
1
vote
2answers
121 views

How to make function accept list of rules as an argument?

Considering the list of rules: r= {"a" -> "1", "b" -> "2", "c" -> 3, d -> 231, "e" -> 1.25}; I want to have a function ...
4
votes
2answers
130 views

Discritizing an analytical 3D-function

I have the following Problem: I need a discretized amount of points in a 3D-volume. These points satisfy a condition to built-up a 3D-geometry. In my example below I selected a helical geometry. The ...
5
votes
1answer
102 views

Same name for functions in package and Global context

I am using a package that was written for Mathematica 3 while I am now working on Mathematica 8. I have issues with 2 functions in particular, Order and GraphComplement. They are a part of this ...
20
votes
4answers
3k views

Plotting piecewise function with distinct colors in each section

I have a piecewise function that I would like to plot but I was wondering if it is possible that each part of the function that is plotted when its corresponding condition is true be plotted with a ...
7
votes
6answers
519 views

Partial sum of a list

The problem I have is really basic but I just can't get my head around it. Suppose I have a list of ordered pairs A = {{a, b}, {c, d}, {e, f}, {g, h}, ...}. I ...
2
votes
1answer
84 views

Inputs which make two function have the same value [closed]

Suppose I have two function f(x1,...,xN) and g(x1,...,xN). How can I find the values ...
0
votes
1answer
125 views

For-loop function problem [closed]

I wrote the following true anomaly function based on a Fortran program that I found in a computational space flight dynamics book. The function uses an iterative method to calculate the true anomaly ...
17
votes
0answers
132 views

V10's TypeSystem - what are these function useful for? [closed]

The symbols in the TypeSystem` context are clearly used for working with Datasets, but they seem powerful. I was hoping that someone could help explain how they work and is they are useful for ...
5
votes
1answer
140 views

Attributes with Pattern test

Probably this question has no application but it helps understand basic issues about Attributes and functions. I was writing a piece of code where I accidently ...
5
votes
1answer
125 views

How to make my fuction return a step count

I am new to mathematica, and I have this 3d random walker program which runs with a fixed (given) amount of steps. What I want it to do is to run forever but stop when two walkers collide (aka have ...
2
votes
1answer
62 views

Finding the expansion of $\sin(a_{1}+a_{2}+a_{3})$ on Mathematica [closed]

How to find the expansion of $\sin(a_{1}+a_{2}+a_{3})$ on Mathematica, using $$ \sin(a+b) = \sin a \cos b + \sin b \cos a$$ to the end? I tried FunctionExpand ...
13
votes
9answers
2k views

Finding maximum or minimum of implicit functions

is there any built in function that can be used to find maximum or minimum of implicit functions? For example, if we have the equation $$x^2 + y^2 = (2 x^2 + 2 y^2 - x)^2,$$ then we can visualize the ...
12
votes
6answers
869 views

Generating Random Real numbers with certain numbers not included

I'm writing a program that i need 1000 real number between -3 and 6. the code that I used for generating and saving them was l = RandomReal[{-3, 6}, 1000] But I ...
1
vote
0answers
172 views

Help with calculating a complicated integral

Edit: The question is solved : )) Thank you for your attention ! I am sorry for mass questions, but the question bothers me a lot. So I would like to ask this question here. This problem arises when ...
2
votes
4answers
136 views

How to obtain the gradient of a function as a function?

The Grad function allows me to get the gradient of a function like this: ...
13
votes
5answers
252 views

Prevent Plus from threading

This is probably a very simple question, but I couldn't find a duplicate. As everybody knows, {x, y} + v gives {x + v, y + v}. ...
4
votes
2answers
99 views

Derivative before Numerical Integration

I need to take the derivative of a function that have a numerical integration on it. The variable in which the integration will be taken is not the same as the one in which the derivative will be ...
2
votes
1answer
120 views

Function not returning number [closed]

I am quite new to Mathematica and I guess this question is really basic, but I can't figure it out myself. I'm making a simple notebook that plots a Hamiltonian function, a plane of constant energy, ...
3
votes
0answers
54 views

Monitor CUDA function

Is there a way to monitor CUDA function without bringing much performance reduction. For example, Map can be monitored by ...
1
vote
0answers
62 views

Finding correct combination of functions

I am trying to write code where I have an array $S$ or numbers in any order [5,4,2,1,....] Then I have a specific set of functions that I can write. ...
2
votes
1answer
92 views

Function under Button, need help [closed]

I would like to put this function under button so I can just press button to evaluate instead of having to shift+enter ...
1
vote
2answers
77 views

Recursion definition wont work [closed]

When I try use any function for example f[n_] := n f[n - 1] and then f[10] I am getting error "Recursion depth of 1024 ...
6
votes
2answers
204 views

Using MovingMap to calculate percentage changes

Bug introduced in 10.0 and fixed in 10.1 MovingMap (new in version 10) applies a function to discrete data over a moving window. This is very convenient for ...
1
vote
1answer
105 views

Simple code failing which used to run perfectly

This very simple code ran perfectly two days ago, and now it is failing, for no reason that I can see. It is simply running indefinitely, and when I abort it, it continues running until I abort it ...
6
votes
1answer
92 views

How to recognize variables like built-in functions?

Many built-in functions can recognize variables. For example, function 'Table' makes its iterator change color. How can I implement a function that has a similar behavior? In this function, I can pass ...
1
vote
0answers
43 views

Rescale large numerical factors in rational functions

Given a rational function $$ f(x_1,x_2) = \dfrac{r_1 x_1^2 + r_2 x_2}{r_3 x_1 + r_4 x_2}, $$ with $r_i$ arbitrary real or complex numbers, is there a built-in function to get Mathemtica to rewrite as ...
5
votes
3answers
245 views

How to Handle Infinity in calculations?

In my numerical calculations I have a list of Eigenvalues with some of them equal to zero. So, when I calculate the log to the base ...
3
votes
1answer
74 views

Defining a list of functions

I'm using polynomial mappings such as s[{x_,y_}] := {x + y^2, y -x} and playing with compositions of such mapping, e.g. ...
2
votes
1answer
139 views

Problem with implementing Regula Falsi [closed]

I checked the "Questions that may already have your answer" and didn't really find what I need. It's actually pretty basic. I want to solve an equation manually with Regula Falsi. I dont need a ...
4
votes
3answers
2k 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 ...
-1
votes
3answers
83 views

How to change function iteratively as a function of its previous form?

I am trying to do the following :- f[x_] := {x, 2}; Do[f[x_] :=Append[f[x], {x, 4}],{3}] % runs into recursion limit because I want to grow my function (which ...
8
votes
2answers
660 views

Function Interpolation with Automatic / Algorithmic Values Mesh

I have an underlying function f(x,y,z) that is computationally intensive, but is smooth and continuous. I'm needing to find the function values along a line in xyz. Currently, I'm calculating f at ...
1
vote
0answers
43 views
4
votes
1answer
875 views

Circular membrane vibration simulation

I'm new in Mathematica and I'm trying to simulate the vibration of a circular membrane for math project but I don't even know how to start. The wave equation describes the displacement of the ...
1
vote
1answer
156 views

DownValues when using Set and SetDelayed

It is known from several questions asked in SE that one of the basic differences between Set and SetDelayed is that the former ...
2
votes
1answer
455 views

Understanding the difference between matrix indices and image coordinates in context of ListDensityPlot

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

Extreme Slowdown with Fold

I am doing a finite difference model, and need to create a list recursively. For a small list, Fold is extremely fast, but when the list becomes large enough, Fold becomes extremely slow. Here is the ...
4
votes
0answers
52 views

How to know the string data/settings, of some options/functions

It is known that several functions and options take some sort of input in this form: option->"something" function["something"] The simple example for this is ...
6
votes
2answers
215 views

Fitting does not work

I have a set of points, which is basically one minus a Lorentz curve. And the NonlinearModelFit ...
2
votes
1answer
78 views

How can I iterate a function up to a certain integer and plot the resulting functions to a single graph [closed]

Firstly I'm sorry if this has been asked before, but I couldn't find what I was looking for. Say I have a function: f[x, a] := x^2 + a Is it possible to plot a ...
5
votes
5answers
216 views

Nested function with an increasing argument

If, for example, I have a nesting function like Nest[1 + x^n (#) &, 1, 3] it gives the result ...
0
votes
1answer
54 views

Defining functions with parameters

I want to change my code in which I set the global values of my parameters in the beginning, to a code in which I leave the parameter values undefined in the definition of functions. Take for example ...