# Tag Info

### Stopping mathematica from rearranging elements in a list

You can use DeleteElements which came with V 13.1: ...
Accepted

### How to draw an image similar to a periodic function (f [x+1]=2 f [x])?

Edit For x<0,we rewrite f[x+1]=2f[x] to f[x]=f[x+1]/2; ...
Accepted

### How to fit function with data?

Provide initial estimates for a and b ...

### How to fit function with data?

NonlinearModelFit default settings work ok with simpler model and thena and b can be derived,...

### How to draw an image similar to a periodic function (f [x+1]=2 f [x])?

Plot[With[{qr = QuotientRemainder[x, 1]}, 2^First[qr] Last[qr] (Last[qr] - 1)], {x, 0, 3}]
Accepted

### Can I write a function that describes a hysteron?

To define a memory, you can define a variable and, for safety, put it in a separate name space, like e.g. nsk. Further, you did not specify what k should be if x==a or x==b and what K shloud be the ...

...
Accepted

### How can I zoom in on a specific region?

You could always implement your own poor's man zoom. Code ...

### Stopping mathematica from rearranging elements in a list

set1 = {-1/x, -1/x + x/2 - 2 Log[x] - Log[x]/x, 1}; Fold[DeleteCases, set1, {-1/x}] (* {-1/x + x/2 - 2 Log[x] - Log[x]/x, 1} *)

### Stopping mathematica from rearranging elements in a list

UniqueElements[{set1,{ -1/x}}][] (* {-x^(-1)+x/2-2*Log[x]-Log[x]/x,1} *)
Accepted

...

### Creating a list of functions with desired coefficients

Instead of using Subscript[x, 1], I suggest using x. You can still use Format to display ...

### How to fit function with data?

Use a better search method: ...

### Pattern matching vs. condition in a function

For g4, your condition doesn't evaluate to True or False. Specifically, ...
Accepted

...
Accepted

...

### Different answers when attempting replacement of function argument

fib1 should be limited not to evaluate unless $n$ is an explicit integer number, so let's redefine it as such (in the following I've also used a version with ...

### Plotting root locus - how to display 'k' values on the curve?

Using ColorFunction ...

### To draw a function within an interval

It is still a bit unclear exactly what kind of an answer would help you most. The way I read the last comment is that you want all $x,y,z$ to be plotted. In other words, you want a 3D-plot. The ...

### Stopping mathematica from rearranging elements in a list

or use filter, in Mathematica it's Select {-(1/x), -(1/x) + x/2 - 2 Log[x] - Log[x]/x, 1} // Select[# =!= -1/x&]

### Stopping mathematica from rearranging elements in a list

Instead of applying "Complement" to the whole list set1, you may apply it to the single elements of set1 like: ...

### Trying to plot the Fourier transform solution to the heat equation on Mathematica

See if this does what you want Code ...

...

### Is there a neat code to swap elements of a list?

list = Range; swap = {{2, 5}, {3, 6}}; Fold[SubsetMap[RotateRight, #1, #2] &, list, swap] {1, 5, 6, 4, 2, 3, 7, 8, 9}

### Different answers when attempting replacement of function argument

Look at: fib1[n] -1 + n fib1[n] /. n->10 9 And for fib2: fib2[n] 2 Here the ReplaceAll does nothing.

### How to apply a constant function to a vector of values?

Using Query func = {1 &, Cos, Sin}; xval = {a, b, c, d}; Query[Transpose, func] @ xval gives ...

### Listable (on certain level) custom function

pts = {{x1, y1}, {x2, y2}}; Just use Map: Map[myf, pts] {myf[{x1, y1}], myf[{x2, y2}]} Or ...

### Stopping mathematica from rearranging elements in a list

If I understand correctly, this is what you need set1 = {-(1/x), -(1/x) + x/2 - 2 Log[x] - Log[x]/x, 1} SortBy[Complement[set1, {-1/x}], Position[set1, #] &]