# Tag Info

### Different answers when attempting replacement of function argument

The /. infix form is just syntactic sugar. The expression that gets evaluated here is ...

### Different answers when attempting replacement of function argument

Using Hold and ReleaseHold does the job as well: ...

### 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 ...

### 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.

### Creating function with array input with desired coefficient and evaluate it

Using TakeList: ...

### Simplify inverse of function

If you need to implement the result in Excel, you might want to consider solving the problem completely in Excel. Excel is certainly not the equivalent of Mathematica but it does have a lot of ...
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 ...
1 vote

### Add a column to a matrix as a function of the other columns

list = Partition[Range @ 9, 3]; Query[All, {Splice, Apply @ f }] @ list gives the expected result: ...

...

### How to fit function with data?

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

### How to fit function with data?

Use a better search method: ...
Accepted

### How to fit function with data?

Provide initial estimates for a and b ...

### 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}

### Pattern matching vs. condition in a function

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

### SplineDegree->1 does not work with BezierFunction?

I've made a function like what @yu-sung-chang was suggesting. ...
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 ...

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

y[x_]:= Which[x >= b, 1, x <= a, 0, a < x < b, k ]
Accepted

### Same code behaves differently as a pure function and a function, and insider another function

That's due to the renaming mechanism of nested scopings. When evaluating Transformer2[algebra_] := , the local variable algebra ...

### Same code behaves differently as a pure function and a function, and insider another function

This doesn't really seem to have to do with Function versus SetDelayed, so it might warrant a separate question. Rather then ...

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

Using ColorFunction ...
Accepted

...

...

### 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

### 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 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 ...

### 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

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} *)

### 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: ...

### 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, #] &]

### Stopping mathematica from rearranging elements in a list

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

### 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 ...
1 vote

### Define function to test arguments and set value to 0 (application 0 Log  = 0)

Rather than define your function directly, you could define it based on the result of the log expression. ...

### Define function to test arguments and set value to 0 (application 0 Log  = 0)

Maybe ClearAll @ g SetAttributes[g, Listable] Off[Infinity::indet] g[0, 0 | 0.] := 0 g[x_?NumericQ, y_?NumericQ] := Re[x Log @ y] g[__] := 0 g[10^-5, -10.^-8] -0....
1 vote

### Define function to test arguments and set value to 0 (application 0 Log  = 0)

I would define my own Log like e.g.: ClearAll[myLog] SetAttributes[myLog, Listable] myLog[x_] = If[x <= 0, 0, Log[x]]; Now zero arguments are defined: ...
Accepted

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

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

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

See if this does what you want Code ...
1 vote

Question 1: ...
1 vote

### Listable (on certain level) custom function

\$Version (* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *) ClearAll["Global`*"] Rather than use the attribute ...