# Tag Info

3

Limit can actually approach a value from any direction in the complex plane. For instance Limit[__, Direction -> I] is valid. To have a bidirectional limit along the real line, you'll have to implement it yourself. Something like this should work pretty well I think. Basically just take limits in both directions and make sure they equal. ...

0

Problem with defining such derivatives is that Dt doesn't hold its arguments, so if f and g have some definitions ClearAll[f, g] f[a_, b_] := a^2 + b g[a_, b_] := a + b then they are evaluated when passed to Dt, so "standard trick" with defining UpValues like: f /: Dt[HoldPattern@f[a_, b_], HoldPattern@g[a_, b_]] := r1[a, b] will not work. What you ...

1

From what I can tell you are not correctly scoping your variables. I think the Print calls and ; in unusual places is not helping. Please have a read of What are the most common pitfalls awaiting new users?. FAZ does not need suppression of output as you actually want the output. Use something like Column to output all of the tools. FAZ := Function[{f}, ...

2

As suggested in comment by J.M., NonCommutativeMultiply might be useful here. Using //. and two replacement rules you can get desired results. $ncmRules = { (* Change b ** a to q a ** b. *) x___ ** b^n_. ** a^m_. ** y___ :> q^(n m) x ** a^m ** b^n ** y, (* Replace adjacent powers of same multiplicands by single power. *) x___ ** y_^n_. ** ... 2 A quick fix of your code: Manipulate[ ClickPane[ Show[Plot[graph, {t, -2, 2}, PlotRange -> {{-2, 2}, {-2, 2}}], sf@dx[ode], Graphics[{PointSize[Large], Point[pt]}]], (AppendTo[graph, sol[dx[ode], #]]; AppendTo[pt, #]; t0x0 = #) &], Style["Enter f(t,x)"], {{ode, x^2 - t, "dx/dt = "}}, {{t0x0, {0, 0}, "{t0, x0}"}, InputField, ... 0 Ah, quoting. How about: returnsList /: Length[Unevaluated[returnsList[a_]]] := returnsLength[a] 5 Your goal is clear, but it contradicts with Mathematica evaluation order. The main problem is that Length evaluates its argument. Please check this question and especially Leonid's comments. You can use my answer with two UpValue definitions from there, but I don't recommend to do so. Clear[returnsList, returnsLength] Length[returnsList[a_]] ^:= ... 1 I believe you've just made a syntax error by leaving out && between the two inequality operators. If I understand your question, you should have functions defined as follows: ClearAll[a, b, func]; a[x_Real] :=(* example calc *)-1*x; b[x_Real] :=(* example calc *)x; func[table_?(MatrixQ[#, NumericQ] &), x_] := Cases[table, {n_, __} /; a[x] ... 2 I am not sure you are doing anything wrong (i.e., perhaps this is a bug) but a little experimenting shows that your TagSetDelayed expression must be evaluated before returnsList has any down values. That is, the following sequence of evaluations succeeds. Clear[returnsList, returnsLength] returnsList /: Length[returnsList[a_]] := returnsLength[a] ... 3 protected = Unprotect[Dt] {"Dt"} Dt[f[___], g[___]] := R1 Dt[f[a, b], g[]] R1 Clear your definition Clear@Dt Dt[f[], g[]] 0 Remember If your definition is no longer needed Clear it - otherwise you might get unwanted results in other areas. And restore protection: Protect[Evaluate[protected]] {"Dt"} 1 Ad 1 After commenting the second definition, fun[x,y] was evaluated and left in this form since no definition was provided for symbolic arguments. Then the replacement was done and tutorial/Evaluation says: [...] in evaluating an expression like h[e1, e2, ...]. Every time the expression changes, the Wolfram Language effectively starts the evaluation ... 2 The message name is$Assumptions::cas so it is coming from the setting of $Assumptions rather than from within Simplify. You can confirm this with:$Assumptions = x < 0 && x > 0 During evaluation of In[111]:= $Assumptions::cas: Warning: contradictory assumption(s) x<0&&x>0 encountered. >> Don't forget to reset$Assumptions ...

2

Clear[f] f[t_] = Assuming[{t > 0}, t^4*Integrate[x^3/(Exp[x] - 1), {x, 0, 1/t}] // Simplify] (* -(1/4) + I*Pi*t - (Pi^4*t^4)/15 + t*Log[-1 + E^(1/t)] + 3*t^2*PolyLog[2, E^(1/t)] - 6*t^3*PolyLog[3, E^(1/t)] + 6*t^4*PolyLog[4, E^(1/t)] *) tmax = 1.5; Show[ Plot[f[t], {t, 0, tmax}, PlotStyle -> Blue, PlotLegends -> ...

1

If $f(T) = T^4\int_0^{1/T} \frac{x^3}{e^x-1}dx$. Then you can differentiate it by parts which gives you Cv[t_] := -1/(t*(Exp[1/t] - 1)) + (4*t^3*NIntegrate[x^3/(Exp[x] - 1), {x, 0, 1/t}]) Plot[Cv[t], {t, 0, 1}, Frame -> True]

0

An approach similar to that of yarchik but non-commutative is CircleTimes[a, b] := Times[a, b] CircleTimes[b, a] := q Times[a, b] CircleTimes[z_, z_] := Times[z, z] CircleTimes[z__] := Module[{zz = {z}, tem}, tem = CircleTimes @@ zz[[-2 ;; -1]]; (CircleTimes @@ Join[zz[[1 ;; -3]], {First@tem}]) Rest@tem] Then, a⊗b (* a b *) b⊗a (* a b q *) ...

2

Clear@arrowAxesXYZ arrowAxesXYZ[{a_, b_, c_}, arrowhead_: Automatic, arrowstyle_: {}] := {arrowstyle, Arrowheads[arrowhead], Map[Arrow[Tube[{{0, 0, 0}, #}]] &, {a + 2, b + 2, c + 2} IdentityMatrix[3]]} Graphics3D @ arrowAxesXYZ[{10, 3, 2}, Large, Red] Graphics3D @ arrowAxesXYZ[{10, 3, 2}]

2

Define your multiplication by two rules CircleTimes[x_, y_] := q Times[x, y] for 2 arguments and CircleTimes[a___] := Module[{b, c}, If[Length[{a}] > 2, b = CircleTimes [{a}[[1]], {a}[[2]] ]; c = Join[{b}, {a}[[3 ;; All]] ]; Apply[CircleTimes, c]] ] It can be written shorter, here I separated into steps for clarity. Test: a⊗b⊗b⊗a (*a^2 b^2 ...

-1

Almost ... Clear[a, b, q] ab = ba = q a b; ba ab

4

You came close; you can almost transcribe the equations and then let Mathematica do the recursion for you. This isn't necessarily the most efficient way to do things, but it makes up for that in simplicity, and given the size of your problem it's plenty fast enough. First, let's get rid of any stale definitions: Clear[f, x, y]; Then let's define our ...

8

Yes, you can use only pure functions: f = ## &[#, Log@#] & /* # &; f[myF] /@ {7, 3} (* {myF[7, Log[7]], myF[3, Log[3]]} *) It can be shorter with a bit different syntax: g = ## &[#, Log@#] &; g /* myF /@ {7, 3} (* {myF[7, Log[7]], myF[3, Log[3]]} *)

9

Imo the most common/readable/flexible way: Function[h, h[#, Log[#]] &][myF] /@ {7, 3} and for fun, less general, as pointed in comments: Through@*#[Identity, Log] &[myF] /@ {7, 3} which can be even shorter, thanks to ybeltukov Through@*#[# &, Log] &[myF] /@ {7, 3}

2

I like this syntax: In: f[#, Log[#]] & /. f -> # &[myF] /@ {7, 3} Out: {myF[7, Log[7]], myF[3, Log[3]]}

4

OK, let me extend the comment into an answer. If ft still contains InverseFunction, your goal can be achieved by (* Solution 1 *) tf = First@Head@ft (* Solution 2 *) tf = ft[[0, 1]] (* Solution 3 *) tf = InverseFunction@Head@ft (* Solution 4 *) tf = InverseFunction@ft[[0]] (* Solution 5 *) tf = InverseFunction@Function[t, #] &@ft Solution 5 should ...

1

Let me test several versions of the redefined arg: x = RandomComplex[{-1 - I, 1 + I}, 1000000]; arg1[x_] := Mod[Arg@x, 2 π]; arg2[x_] := Arg[-x] + π; arg3[z_] := π + ArcTan[-Re[z], -Im[z]]; Max[Abs[arg1[x] - arg2[x]], Abs[arg1[x] - arg3[x]]] (* 8.88178*10^-16 *) arg1[x]; // AbsoluteTiming (* {0.16715, Null} *) arg2[x]; // AbsoluteTiming (* {0.154602, ...

0

From a comment by Artes, this seemed to solve the problem for the OP: arg[z_] /; Im[z] < 0 := Arg[z] + 2 Pi; arg[z_] /; Im[z] >= 0 := Arg[z]

0

f = {f1, f2, f3}; x = {x1, x2, x3}; Block[{i = 0}, List @@ (f /. s_Symbol :> s[x[[i++]]])] {f1[x1], f2[x2], f3[x3]}

3

Every symbol always has a context. Most of the time we are in the Global context. $Context (* "Global" *) Normally we don't have to specify a variable as Globals Simply writing s is sufficient provided we are in the Global context. Inside your package the symbols and functions are defined in the SimulatorV2DebugPrivate context. In the function ... 6 Needs["GeneralUtilities"] MultiMapAt[Range[3], {f1, f2, f3}][{x1, x2, x3}]$\ ${f1[x1], f2[x2], f3[x3]} Which is equivalent to using (Composition @@ MapThread[MapAt, {{f1, f2, f3}, Range[3]}])[{x1, x2, x3}] Or MapIndexed[{f1, f2, f3}[[First@#2]]@#1 &, {x1, x2, x3}]$\ ${f1[x1], f2[x2], f3[x3]} Or #1[#2] & @@@ Thread[{{f1, f2, f3}, ... 6 Inner[#1[#2] &, {f1, f2, f3}, {x1, x2, x3}, List] (* {f1[x1], f2[x2], f3[x3]} *) #[[1]][#[[2]]] & /@ Transpose[{{f1, f2, f3}, {x1, x2, x3}}] (* {f1[x1], f2[x2], f3[x3]} *) 0 Along with @J.M.'s superfast solution, and this nice little identity, where for$X_j \text{ iid},$uniformly distributed on$[0,1],$$$\dfrac{1}{n!} \left\langle n \atop k \right\rangle = P\left(\sum_{j=1}^{n}X_j\in[k,k+1]\right)$$ we can get eg eulplot[6, 2], eulplot[12, 5]: eulerian[k_, n_] := CoefficientList[(1 - x)^(n + 1) PolyLog[-n, x]/x, x][[k ... 1 I like this (equivalent) one better: ClearAll[sd]; t = Transpose; sd@{} = 1; sd@m_:= sd@m= sd@t@m= m[[1,1]] /; Length@m == 1 sd@m_:= sd@m= sd@t@m= Sum[m[[1,j]] (-1)^(j + 1) sd@Drop[m,{1},{j}], {j, Length@m}] 2 This is how I would write it: sneakydeterminant[m_] := sneakydeterminant[m] = sneakydeterminant[Transpose[m]] = If[Length[m] == 1, m[[1, 1]]], Sum[Power[-1, j + 1] m[[1, j]] sneakydeterminant[ m[[Complement[Range[Length[m]], {1}], Complement[Range[Length[m]], {j}]]]], {j, 1, Length[m]}] The only difference is the ... 7 You at least have to provide k0 with a delayed definition, otherwise you've fallen at the first hurdle, since the original input will already have been lost. This will give you a fighting chance: k0 := 0.4 π; Now, we need to work with the (unevaluated) ownvalues of this symbol, rather than allowing its definition ever to evaluate. Since we don't know what ... 2 @Winther's solution is particularly fast from here adapted slightly: pwf[z_] := Piecewise[{z[[#]], # - 1 <= y < #} & /@ Range@Length@z] iidf[n_] := With[{nn = n}, ffunc = Table[If[i == 1, 1, 0], {i, 1, n}]; Do[temp = ffunc; temp[[1]] = Integrate[ffunc[[1]], {z, 0, z}]; Do[temp[[k]] = Integrate[ffunc[[k - 1]], {z, z - 1, k - 1}] + ... 7 Adapting once again Leonid's solution from here, f[1, z_] := UnitBox[z - 1/2]; f[n_Integer, z_] := Module[{zl, t}, Set @@ Hold[f[n, zl_], Simplify[Convolve[UnitBox[t - 1/2], f[n - 1, t], t, zl]]]; f[n, z]]; f[4, z]$\displaystyle\begin{cases} -\frac16(-4+z)^3&3\le ...

5

f[1] = Integrate[PDF[UniformDistribution[{0, 1}], z - y], {y, 0, 1}] /. z -> y; f[n_] := f[n] = Integrate[f[n - 1] /. y -> z - y, {y, 0, 1}] /. z -> y // Simplify; f[3]

1

You can use Block inside body of f function to temporarily set desired symbols to those passed as arguments of f. ClearAll[argument, f, test] argument = {xx, yy, zz}; test[t_] := {argument^2, Range[t]} f[kx_, ky_, kz_, t_] := Block[{xx = kx, yy = ky, zz = kz}, test[t]] f[a, b, c, 4] (* {{a^2, b^2, c^2}, {1, 2, 3, 4}} *) Alternatively you could first ...

5

There is no need for HoldSecond, etc., because arguments can always be reordered so the held argument is the first one. HoldRest is needed so an indefinite number of arguments can be passed, but the first argument subjected to pattern matching to discriminate which of many function definitions applies. HoldAll handles almost all other cases of non-standard ...

1

Looking at the Associations guide in the documentation I came across KeyValueMap that can be applied to the entire table. Since the Dataset has named rows then the key will be the row name and the value will be the row. dat[ KeyValueMap[ Function[{key, value}, Grid[Join[{{key, SpanFromLeft}}, Partition[value, 2, 2, {1, 1}, ""]]] ]] ] // ...

10

Your definition a[x_] == a[y_] ^:= Round[x] == Round[y] Is structural. It tells Mathematica how to rewrite certain expressions. It has no mathematical meaning. Mathematica has no mechanism to infer mathematical meaning from the rewrite rules you provide. It cannot determine what mathematical consistency might mean for your symbols. Rewrite rules are not ...

Top 50 recent answers are included