# Tagged Questions

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

50 views

### A function about prime gaps

I want to define a $f$ function on Mathematica such as this. $f[k]$ gives the smallest $m$ holds $2k=Prime[m+1]-Prime[m]$. For example, $$f[1]=2$$ $$f[2]=4$$ $$f[3]=9$$ $$f[4]=24$$ How can i do that?...
63 views

### Building functions using WolframAlpha? Any other general examples welcome :)

I want to build my own version of SubsetQ using WolframAlpha to return True or False. ...
172 views

### Goal optimization: finding the best combination of capacitors and resistors resulting in given properties

I want to edit @MarcoB answers (because the code he gave doesn't answer the question appropriately)->(the function that need to be optimised is not implemented as asked) But it seems like I am having ...
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".
69 views

### If Statement in function does not evaluate

I've written a function that should try to simulate a "triangle-wave-signal", given a few parameters. It looks like this: ...
77 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, ...
504 views

### Fitting a curve to an image object: not a superellipse, not an egg curve.. what else?

I'm facing the problem of quantifying the morphology of objects with such a shape (nannoconids... they are fossils). One of the final goals is to produce a solid of revolution and compute volume/...
70 views

### How can I put a defined symbol as the integrand of NIntegrate, without using a functional form with a pattern test?

Something like this, I define an integrand (really big and hairy, simple below) ...
51 views

### Oddity with ToExpression [duplicate]

Is this a bug? ToExpression["3231.432"] 3231.43 I would have expected the following: 3231.432 I am using Mathematica 10.2.0
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 ...
108 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, ...
361 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 ...
247 views

### Results in terms of a function

Let's assume I have a function $f(x)=\exp(10x^2)$, i.e. f[x_]:= Exp[10*x^2]. When I differentiate $f$ by evaluating the expression ...
135 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 ...
113 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 ...
530 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 ...
90 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 ...
127 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 ...
139 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 ...
147 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 ...
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 ...
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 ...
146 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: ...
258 views

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}. ...
102 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 ...
121 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, ...
57 views

### Monitor CUDA function

Is there a way to monitor CUDA function without bringing much performance reduction. For example, Map can be monitored by ...
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. ...
78 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 ...
94 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 ...
175 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 ...
96 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 ...
45 views

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 $... 1answer 106 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 ... 1answer 75 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. ... 3answers 253 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 ... 1answer 149 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 ... 3answers 86 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 ... 0answers 43 views ### When evaluating this integral Mathematica returns two different answers When evaluating this integral in Mathematica 10.3 Student Edition: ... 1answer 261 views ### What is the difference between defining a function and specifying the type of argument, versus applying a test to that argument? Say I want to create a function that evaluates differently based on what type of argument is given. I've found two ways of doing this, ... 1answer 94 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 ... 0answers 57 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 ... 1answer 82 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 ... 2answers 217 views ### Fitting does not work I have a set of points, which is basically one minus a Lorentz curve. And the NonlinearModelFit ... 5answers 220 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 ... 1answer 57 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 ... 1answer 47 views ### Output of Coefficientrules into Jacobian matrix I have a pair of large polynomials in u, v, a1...a9 and b1...b9, generated by ... 1answer 97 views ### Evaluate Limit only if both directions(sides) are equal?Ex:$\lim _{x\to 0}\left(\frac{1}{x}\right)=DNE$I want the limit of a function to only evaluate if both the left and right hand side are equal. For example$\lim _{x\to 0}\left(\frac{1}{x}\right)\$ doesn't exist(two sided limit). However, the right ...
I've got the following transfer function (in the s-domain): $$\text{H}(s)=\frac{\text{C}s}{\text{RC}s+1}$$ Is there a function in Mathematica 10 that I can go back to the differential equation (in ...