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

learn more… | top users | synonyms

4
votes
2answers
37 views

Partitioning a list when the cumulative sum exceeds 1

I have a long list of say 1 million Uniform(0,1) random numbers, such as: dat = {0.71, 0.685, 0.16, 0.82, 0.73, 0.44, 0.89, 0.02, 0.47, 0.65} I want to ...
2
votes
0answers
35 views

3D Random walker simulation

I'm having trouble figuring out why my confining boundary condition logic does not work here. In theory when the walkers' step is directed outside the region (say the right wall) the walker would have ...
1
vote
1answer
52 views

How do I write a function inside a ArgMin

I want to solve this ArgMin[NIntegrate[(Tanh[x] - Erf[x/a])^2, {x, -5, 5}], a] and it does not work, what is the correct way to do this? ...
-2
votes
0answers
68 views

I need to write an animation of something l [on hold]

I need to write an animation of something like this: [![enter image description here][1]][1]
1
vote
2answers
38 views

using Map to apply 2 lists to the LCM function - help [duplicate]

I have 2 lists of numbers and I want to quickly compute the array of answers to the LCM function for the 2 lists and a 3rd static number. I tried the following ...
1
vote
0answers
75 views

Using functions in Solve [on hold]

i wanted to calculate the real roots of a function. To my knowledge the function i defined has no real roots, so i expected an emptyset, but instead i got some Root[...#..] answers by Mathematica. ...
0
votes
0answers
42 views

Personal Reminder with Speak capability repeats multiple times

I am trying to create a personal reminder for myself using the Speak function in Mathematica hoping that the computer speaks the task only once at the designated time. However, I have found that the ...
2
votes
1answer
92 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
55 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
43 views

How to apply a user-defined function to a list [on hold]

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
115 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, ...
-1
votes
0answers
43 views

How to calculate the value of financial derivatives [on hold]

I want to loop through all of the put and calls available for each of the derivative types as listed by calling: FinancialDerivative[] I need to eliminate the ...
5
votes
3answers
138 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
42 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$ ...
3
votes
1answer
63 views

Are these two functions equivalent?

I checked several cases and saw that two functions are equivalent in these samples. However, are the two equivalent in all cases? Is there a way to check that? Explicit function: ...
1
vote
0answers
28 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
3answers
57 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
89 views

Need help interpreting a small block of code

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
61 views

Define a function with multiple lines mathematica [closed]

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

defining a function using other functions

I have the following code: ...
0
votes
0answers
69 views

Errro in plotting the results of FindRoot

I would like to plot the results of FindRoot over certain range of one input. First of all I am sorry that the equation is a bit long and messy. I have tried to ...
1
vote
1answer
101 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
49 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
49 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
162 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
34 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
37 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
73 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, ...
11
votes
2answers
355 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 ...
3
votes
2answers
36 views

How to add Optional Sequence

Note: This question could be duplicate but I couldn't find any so far. It is know that Optional (:) can be use to represent expression if omitted. ...
0
votes
2answers
50 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) ...
1
vote
1answer
30 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
28 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
76 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, ...
9
votes
1answer
274 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
2answers
188 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 ...
3
votes
2answers
113 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
80 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 ...
4
votes
1answer
55 views

Strange behavior of ArcTan [duplicate]

I've noticed a strange behavior of Mathematica's ArcTan function with two arguments. If both arguments are 0 or ...
7
votes
6answers
486 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
76 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
117 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
121 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 ...
4
votes
1answer
127 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
119 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 ...
0
votes
0answers
64 views

Finding double inverse Laplace transform numerically

Edit: I asked Prof. Valko, he was so nice to point out where the mistake is. The problem is solved ! Thank you for your attention ! Recall the the double Laplace transform of a function $f(x,t)$ is ...
2
votes
4answers
117 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: ...
12
votes
5answers
237 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
92 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 ...