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

learn more… | top users | synonyms

2
votes
1answer
128 views

Find a family of curves

I have a diagram with seven curves (each with a different parameter). My goal is to find a function for the family of curves (i.e. a single function not just for the seven parameters, but for all ...
2
votes
2answers
66 views

Multiple functions with shared arguments in Manipulate

I am trying to define multiple functions with the same set of parameters and then put them in a Manipulate to simulate their behavior. Ideally it should be something like that: ...
0
votes
1answer
48 views

How to apply a user-defined function to a list [closed]

I'm using Wolfram | Alpha Pro; I have a function f[n] = 351n^(-0.7); How do I apply it to each element of a list like {2, 9, 22}? f/@{2, 9, 22} just results in ...
6
votes
2answers
132 views

Getting an explicit representation of the function returned from Interpolation [duplicate]

I am using Interpolation to get an InterpolatingFunction that fits a set of points. For example, ...
5
votes
3answers
173 views

How to tell Mathematica to get the real-only inverse function?

The problem I have is that Mathematica seems to play better with complex numbers so that the result of N[InverseFunction[Function[x,x^3]][-1]] is ...
0
votes
1answer
80 views

Interpolate the discrete list into continuous function

I have a data whose list plot shows up following graph I would like to interpolate the missing data and make the function continuous but for particular x-coordinate there is multiple values of $y$ ...
1
vote
0answers
31 views

Function with many lines that takes image as parameter not returning same result as if I run the same lines of code

Running the exact same lines of code in a function produces just a return of the original image without any points identified, whereas when I run the exact body of the function line by line it works ...
0
votes
2answers
65 views

How to find the value of a variable using solution of Simultaneous equations? [closed]

I have to find the value of p where p=a1*x+b2*y; using the solution of the equation ...
1
vote
0answers
91 views

Need help interpreting a small block of code [closed]

I have recently "inherited" some Mathematica scripts which I need to interpret to write in some other languages (Maple and C++). I have never used Mathematica before so I have been learning on the ...
3
votes
1answer
69 views

Define a function with multiple lines mathematica [closed]

How is this done? ...
1
vote
2answers
68 views

defining a function using other functions

I have the following code: ...
3
votes
1answer
118 views

The basic primitive recursive functions

How can the basic primitive recursive functions be expressed in the Wolfram Language? Apparently here's an example for primitive recursion: ...
3
votes
1answer
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 ...
1
vote
1answer
61 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. ...
4
votes
1answer
171 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 ...
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".
0
votes
1answer
59 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: ...
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, ...
13
votes
2answers
477 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 ...
0
votes
2answers
65 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) ...
0
votes
1answer
50 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
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 ...
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, ...
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 ...
5
votes
4answers
244 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 ...
4
votes
2answers
131 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
105 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 ...
7
votes
6answers
520 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
85 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
133 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
142 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 ...
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
253 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. ...
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 ...
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
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 ...
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 ...
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 ...
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. ...
5
votes
3answers
246 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 ...
2
votes
1answer
140 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 ...
-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 ...