New answers tagged functions
2
votes
How can I flip/mirror the legend?
Using the undocumented option MarkerLayout, as @MarcoB points out, it could be something like this:
...
5
votes
How can I flip/mirror the legend?
You can use "MarkerLayout", an undocumented option to Legend functions I've learned about in this answer. In fact, I think this question is likely a ...
3
votes
Accepted
Find first position satisfying condition, which is true after a certain element
Perhaps you mean binary search. If you plan to compile, see here and here.
...
2
votes
Find first position satisfying condition, which is true after a certain element
I am probably confused, but I can't explain the following. Here is a list of 100 integers.
...
2
votes
Find first position satisfying condition, which is true after a certain element
I've made a function called Earliest
So what is Earliest function ?
...
1
vote
Additional line in the Plotting
You must restrict the region of "P" and only plot the piece you want. However, this will restrict the x-axis. To prevent this you need ...
1
vote
Accepted
Additional line in the Plotting
The extra line is due to a jump discontinuity in the value of G[r], which switches from positive to negative right before that jump. One way to avoid that portion ...
0
votes
Partially Orderless Arguments in Functions
Edited after comment below
The proposed solution can be useful if the objective is solely to manipulate a symbolic inert function (a symbol without an explicit definition and that does not evaluate ...
0
votes
Replacement of a variable only for a part of an expression
You may either use ReplacePart (close to what @Alrubaie proposed)
expr = a^2 + f[a];
ReplacePart[expr, 2 -> f[c]]
(* a^2 + f[c] *)
or map the replacement ...
0
votes
Replacement of a variable only for a part of an expression
You just need ReplacePart
Where ReplacePart[Function/Expression , Location which part to replace]
...
1
vote
Accepted
Additional lines in the plotting graph
Your equations have more solutions than the two you are apparently interested in:
l = NSolve[T[r] == 0, r];
Length[l]
(* Out: 5 *)
(In passing, note that ...
5
votes
Accepted
5
votes
How to plot two functions?
You can use With to give a local value for y and ParametricPlot for the plot.
...
5
votes
Accepted
Very simple, unexpected Low Performance of set(=)
I assume that, like all modern software, Mathematica implements copy-on-write. From the Wikipedia:
Copy-on-write (COW), sometimes referred to as implicit sharing or shadowing, is a resource-...
8
votes
Accepted
Determination of a Function
This is actually a tiny bit tricky as far as I'm aware, in that there's not a built-in syntax that "just does it"! Maybe someone's aware of a way Mathematica can easily solve for symbolic ...
12
votes
Accepted
7
votes
10
votes
What is the best method to search pattern for 2D list?
I am sure there are many ways to do it, but here is my take:
...
3
votes
Is there a formula that can quickly calculate the ByteCount of an integer?
Table[FromDigits[Table[5, {n}]], {n, 4}]
(*out: {5,55,555,5555}*)
plot:
...
4
votes
Accepted
Is there a formula that can quickly calculate the ByteCount of an integer?
You could try this as an alternative:
ListLogLinearPlot[
Table[
{num, ByteCount[num]},
{num, PowerRange[10^19]}
]
]
4
votes
Is there a formula that can quickly calculate the ByteCount of an integer?
I think what's going on here is that the Manipulate automatically converts num to a fixed precision floating point number, probably because the step size becomes so ...
3
votes
Is there any way to get nthComposition of a function?
Clear["Global`*"]
For some functions f, you can use NestList and ...
5
votes
Accepted
Is there any way to get nthComposition of a function?
Depending on exactly how you want to use this, you might want to bundle this up into its own function (or function overload).
...
4
votes
Is there any way to get nthComposition of a function?
As answered well in the comment, we can find it by
Nest[f, x, 5]
1
vote
1
vote
How to define a function of parameters of a DSolve output?
You can solve with the parameters directly:
...
4
votes
7
votes
Accepted
Strange behavior of 'SquareFreeQ'
Try to evaluate this: SquareFreeQ[List]
It turns out that List is, indeed, square-free. So, it was replaced (it was the head of the expression, so that's where the ...
1
vote
Accepted
3
votes
How to create a matrix with multiple variables defining the elements?
Array[f,{3,3,3,3},{0,0,0,0}]
will give you a 4-dimensional matrix.
f@@@Tuples[{0,1,2},4]
will give you a 1-dimensional list.
...
7
votes
Accepted
Value of allegedly infinite limit is different for different values of the variables
The result given is generically correct. Here is the analysis.
...
1
vote
How to take the derivative with respect to a function with more than one variable?
I understand that you want to calculate dp/dq. That is the ratio of the change of p to the change of q if x is changed an infinite small amount.
To make it simpler I insert the constants and define:
<...
Top 50 recent answers are included
Related Tags
functions × 3328function-construction × 441
plotting × 371
list-manipulation × 355
calculus-and-analysis × 199
equation-solving × 177
evaluation × 126
matrix × 112
programming × 105
performance-tuning × 88
syntax × 79
differential-equations × 70
replacement × 69
variable-definitions × 68
simplifying-expressions × 66
functional-style × 65
graphics × 63
complex × 62
pattern-matching × 59
numerical-integration × 58
core-language × 58
numerics × 56
probability-or-statistics × 55
symbolic × 55
table × 52