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

learn more… | top users | synonyms

0
votes
0answers
31 views

What's real analogue for FromDigits?

FromDigits only works for integer strings. What's its real-number analogue?
3
votes
1answer
56 views

Compability between Graphics coordinates and shifted projections in GeoGraphics

I'd expect GeoGraphics to handle positions of points since they are provided with GeoPosition wrapper. But it is not the case ...
1
vote
2answers
83 views

Permanently rounding numbers/values to a given number of significant figures

I am searching for a simple way of rounding and setting an input to a desired number of significant figures. There are a vast number of posts that discuss similar problems, but none address this ...
2
votes
2answers
106 views

Polynomial expansion of operator

I am new to Mathematica, I am trying to generate the polynomial function of a operator. So for example, the operator $L $ is $\frac{\partial f}{\partial x}+\frac{\partial f}{\partial y} $, and I want ...
1
vote
1answer
25 views

LineScaledCoordinate problem for exact coordinates

There appears to be a bug in LineScaledCoordinate I've faced writing an answer for Animate point go round a triangle. For coordinates with exact values, instead of ...
0
votes
0answers
37 views

ParametricPlot3D plot n functions [on hold]

Below is the code I am aiming to get, however I do not know how to have mathematica dynamically generate code to create n numbers of {..., examplefxn[[n]], ...}, ...
2
votes
1answer
70 views

How-to convert real number into List of its digits?

How could I convert a real number into a List of its digits in Mathematica? Example: 8.168643234 Desired output: {8,1,6,8,6,4,3,2,3,4} Many thanks in ...
0
votes
0answers
69 views

Numerical Integration/Function

I have a problem with a function defined numerically through an integral of the form: ...
0
votes
1answer
33 views

Defining Solutions to FindRoot a functions of parameters-Part II

Here's a similar question as the the preceding question with the same title, but this time with vectors, which I need to use. I followed the suggestion in the answer the the previous question, but it ...
0
votes
1answer
48 views

Recursive definition of nested sums

I have a set of functions which take lists as arguments. They recursively nest sums, and I have defined them as follows ...
3
votes
0answers
49 views

Using an external Pattern breaks Format

I noted while writing this answer that using an external Pattern on Format doesn't work: ...
4
votes
1answer
80 views

Is there a built-in function to do binary search?

Is there a built-in function to do binary search? Say, given a list (sorted) and a number, find the position which keeps the listed sorted when the number is inserted. I know that ...
4
votes
1answer
89 views

Display level of recursion of a recursive function during execution

Given a recursive function, is there some simple way to display or store the value of recursion or "how many levels deep" the function is at a given time? For instance, if we wrote the recursive ...
4
votes
3answers
123 views

Getting terms and only evaluate specific parts

I want to expand the expression but I do not want it to evaluate. Sum[(HoldForm[1/(2 # - 1) - 1/(2 # + 1)] &)[i], {i, 1, 6}] However if you evaluate this you ...
1
vote
3answers
85 views

Breaking a While loop

A simple example to illustrate what I'm talking about: m=0; While[m<=50, m=m+1; p=m] The result is: m=51 p=51 In ...
3
votes
0answers
64 views

Extracting an equation from an interpolated function

Im trying to use LibraryLink to do some calculations in C but part of the expression i want to calculate is an Interpolating Function. C cant use that obviously so I'm trying to shift it to a data ...
0
votes
0answers
95 views

How to speed up my code with constructing matrices

I have run this program for a long time to get the result for n = 2048(about 5hours) and no more result till now (can't run with n = 4096). I would know how to make it more efficient. Any help or ...
0
votes
2answers
57 views

Operations on transfer function model

Suppose I have a transfer function defined via TransferFunctionModel, e.g. tf == TransferFunctionModel[{{1/s}}, s]. How can I ...
8
votes
0answers
95 views

Why is this evaluation halved when adding units?

Why does this strange behavior occur when dealing with units and quantities? ...
1
vote
0answers
57 views

How to put Black as the background colour, and text as white in Mathematica? [duplicate]

My question is equal to this one,even though by different reasons. I would like to know how can I change the white background to black, and the black text to white. I'm asking again, since a year has ...
0
votes
2answers
72 views

Parametric Function

i'm struggling to implement the following parametric function: I need to create a g function with two arguments (w and v). If w and v are not empty lists, then it will return a list containing two ...
1
vote
0answers
34 views

Input `Reduce[Mod[a + x, l] == 0, x]' and output `x == -a + kl`?

Reduce[a + x == k l && k > 0, x] (* k > 0 && x == -a + k l *) I think a + x == k l and ...
5
votes
2answers
103 views

How to use Manipulate to cycle through a list of lists over a function

So I can do something like this which I like: Manipulate[i, {i, {1,2,3,4}}] It lets me pick which specific values I want to allow to be chosen for my function. ...
3
votes
0answers
42 views

How to add my own functions to the library? [duplicate]

I would like to have my own functions (some sort of helper or utility functions) available all the times I run Mathematica. How to do that?
2
votes
1answer
85 views

IntegerQ and Element Integers give different results in one case

f1[x_] := IntegerQ[x] f2[x_] := Element[x, Integers] Both functions give identical results in everything except for such case: ...
0
votes
2answers
50 views

Solving coefficients of a function having boundary conditions

I have a function F=c+dz, which has particular boundary values, say F(z=1)=2 and F(z=-1)=1, ...
0
votes
0answers
65 views

DeleteDuplicatesBy function does not exist

I'm using 10.0.1.0 x64 on Windows. The DeleteDuplicatesBy function appears in autocomplete lists, and is present in the documentation, but does not appear to ...
2
votes
2answers
67 views

FullForm applied to functions

I would have expected FullForm[Cases[{a^2, a^3}, a_^1]] to produce ...
0
votes
1answer
62 views
1
vote
1answer
108 views

Write 7. as 7.0 and .7 as 0.7 [closed]

i would like to know how to do in order to transform using a function .7 in 0.7 and 7 in 7.0. I need that the values in the list will really change because i must print them in a text file. Thank ...
10
votes
1answer
187 views

Max element of a list with a custom ordering function

I need a function to find max element of a list according to some custom ordering function, assuming that the function implements a total order (elements being compared might not even be numbers). ...
1
vote
2answers
96 views

Pattern Match and Replace Expression involving Pure Function

Let's say I have an expression that in held form contains a pointer to a function. expr = Hold[2*{"FUNCTION1"} + 5]; ...
-2
votes
2answers
142 views
10
votes
8answers
419 views

Find the minimum integer r such that $(10^r - 1)/37$ is an integer

I know Element[(10^r - 1)/37, Integers] tests the condition. So what is the command that gives me the minimum integer value r ...
2
votes
1answer
34 views

Default value behaves differently when used in Function and when used with Cases

Consider this example: Cases[{4, x, 5 a , 6 x}, x_.*a_ :> x] (*{1, 1, 5, 6}*) It is clear that the _. took 1 as a ...
1
vote
0answers
55 views

PrimitiveRoot function

The function PrimitiveRoot[n] claims to return the SMALLEST primitive root of n. I believe this is not true. For example PrimitiveRoot[18] returns 11, yet 5 is the smallest primitive root of 18. ...
1
vote
3answers
134 views

Create a function which gets a function and a x as argument and returns the y [closed]

After a few hours and lots of tries, I am hoping that someone could give me a solution to my problem. I want to have a function, which gets a function and a value as arguments. The function should now ...
2
votes
2answers
79 views

Generating a permutation of elements in chunks

Is there a way for me to generate a list of permutations in "chunks" such that I needn't store everything on RAM all at once? Consider that (WARNING: DO NOT RUN! --- Will generate a list with 13! = ...
2
votes
1answer
44 views

Double application of NIntegrate produces unexpected error messages [duplicate]

In the course of trying to answer 69601, I encountered unexpected error messages. In highly simplified form, NIntegrate[NIntegrate[z y, {y, 0, 10}], {z, 0, 10}] ...
1
vote
2answers
76 views

Expressions containing globally undefined symbols inside a function where they are defined

Consider the following code. f[a_,b_]:=x; Clear[a,b]; x=a+b; f[1,2] It returns a+b. However, from a certain viewpoint, one ...
13
votes
11answers
1k views

Divide all but the maximal element in a list by 10?

I have a list of numerical data, and I want to write a program that will keep the maximum as it is, but reduce the rest by certain factor (such as 10). For example: ...
4
votes
1answer
90 views

Coefficients of a polynomial in powers of 10

Can I express a polynomial function in Mathematica in power (ScientificForm) ? I was trying: ...
1
vote
0answers
65 views

What are the differences between these functions when used for NMaximize?

In short, the question is how to construct the function you want to optimize? ...
6
votes
4answers
129 views

Minimizing a function with a constant $l > 0$

I'm VERY new to Mathematica and would like some help with minimizing a function. $$f(x) = \frac{1}{2} \sqrt{\frac{\left(l^4+x^4\right)^2}{l^4 x^2}}$$ I want to find which $x-value$ (probably ...
0
votes
2answers
93 views

Replace variables and redefine a function

I would like to redefine a function f(x)=1+2x^2 to a new function g(y)=1+2y by using the replacement ...
6
votes
3answers
169 views

Is it possible to find generating functions of infinite sequences with Mathematica?

I'm trying to find the generating function of a sequence as $(0,1,0,1,0,1,\dots)$ but reading Mathematica's help on FindGeneratingFunction[] seems to tell me that ...
1
vote
2answers
107 views

Josephus problem

See the Josephus Problem. My code takes in two numbers; one is the number of participants, and the other is supposed to be the number of players skipped between executions. ...
1
vote
2answers
55 views

Incomplete Integration in Area

Area[2 Sqrt[(1 - p^2)^2 - r^2], {p, 0, 1}, {r, 0, 1 - p^2}] is able to perform only the integral over r, leaving the integral ...
0
votes
0answers
41 views

Plot function failure, and understanding how mathematica selects recursion points for correction

I think it is best to start out by directing everyone to this link. The discussion concerns why the Plot function fails to accurately generate a simple sine wave for given parameters. The answer given ...