New answers tagged

2 votes

How can I flip/mirror the legend?

Using the undocumented option MarkerLayout, as @MarcoB points out, it could be something like this: ...
user avatar
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 ...
user avatar
  • 60.4k
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. ...
user avatar
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. ...
user avatar
  • 3,947
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 ? ...
user avatar
  • 2,877
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 ...
user avatar
  • 24.9k
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 ...
user avatar
  • 60.4k
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 ...
user avatar
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 ...
user avatar
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] ...
user avatar
  • 1,018
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 ...
user avatar
  • 60.4k
5 votes
Accepted

How to plot two functions?

Try ParametricPlot ...
user avatar
5 votes

How to plot two functions?

You can use With to give a local value for y and ParametricPlot for the plot. ...
user avatar
  • 29.3k
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-...
user avatar
  • 36.2k
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 ...
user avatar
  • 8,208
12 votes
Accepted

What is the best method to search pattern for 2D list?

You could use ArrayFilter: ...
user avatar
  • 5,389
7 votes

What is the best method to search pattern for 2D list?

another array-based method: ...
user avatar
  • 6,817
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: ...
user avatar
  • 16.2k
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: ...
user avatar
  • 301
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]} ] ]
user avatar
  • 60.4k
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 ...
user avatar
  • 5,389
3 votes

Is there any way to get nthComposition of a function?

Clear["Global`*"] For some functions f, you can use NestList and ...
user avatar
  • 120k
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). ...
user avatar
  • 5,389
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]
user avatar
  • 443
1 vote

How to define a function of parameters of a DSolve output?

An other way with DSolve is ...
user avatar
  • 15.7k
1 vote

How to define a function of parameters of a DSolve output?

You can solve with the parameters directly: ...
user avatar
  • 216k
4 votes

Strange behavior of 'SquareFreeQ'

Try this: ...
user avatar
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 ...
user avatar
  • 5,389
1 vote
Accepted

How to take the derivative with respect to a function with more than one variable?

...
user avatar
  • 12.3k
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. ...
user avatar
  • 5,389
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. ...
user avatar
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: <...
user avatar
  • 24.9k

Top 50 recent answers are included