7

Try the following Series[f[InverseFunction[g][y]],{y,0,10}]


5

Try Map[(If[# <= 0.4, 1, 0]) &, RandomReal[{0, 1}, 20]]!


4

@LeslieChiu Follow @kglr suggestion Clear["`*"]; f[x_] = Piecewise[{{1, x <= 0.4}, {2, 0.4 < x <= 0.7}, {3, 0.7 < x <= 1}}]; f /@ RandomReal[{0, 1}, 20]


4

SeedRandom[1] x = RandomReal[{0, 1}, 20]; t = .4; You can also use UnitStep or Boole or Clip as follows: result1 = UnitStep[t - x]; result2 = Boole[# <= t] & /@ x; result3 = Round @ Clip[x, {t, t}, {1, 0}]; Grid[Prepend[Transpose[{x, result1, result2, result3}], {"x", "UnitStep[t-x]", "Boole[#≤t]&/@x", "...


4

In an even more trivial case. It appears that Module is not willing to recognize such indexed variables as symbols: f2[x_] := Module[{out[1]}, out[1] = x; out[1]] f2[5] Module::lvsym: Local variable specification {out[1]} contains out[1], which is not a symbol or an assignment to a symbol Module[{out[1]}, out[1] = 5; out[1]]


3

According to the Help, ''Every time a module is evaluated, a new temporary symbol is created'' and ''Block localizes values only; it does not create new symbols'' Clear["`*"]; f1[x_] := Block[{out}, Table[out[i], {i, 1, Length[x]}, 42]] f1[{1, 2, 3}]


3

You can get the row sums using {2} as the second argument of Total: Total[{{1, 2}, {2, 0}, {3, 4}}, {2}] {3, 2, 7} Then you can use Ordering and Sort to get the ordering of sums and the sorted sums, respectively: Through @ {Ordering, Sort} @ % {{2, 1, 3}, {2, 3, 7}} and Transpose the resulting pair of lists: Transpose @ % {{2, 2}, {1, 3}, {3, 7}} ...


3

Does it work? {f[4] - g[-1], h[2], 2*g[2] + h[-1]} /. y_[x_ /; x < 0] -> c*y[x]


2

Integrate[(λ0/Sqrt[2])*Sech[((t - τ) - 1/2*T)/σ] (1 + Tanh[((t - τ) - 1/2*T)/σ]), τ] gives (*1/Sqrt[2]λ0 σ (ArcTan[Sinh[(-2 t+T+2 τ)/(2 σ)]]+Sech[(-2 t+T+2 τ)/(2 σ)]) *) then enter the limits. Numerical evaluation may be difficult for your parameter values


2

I have rewritten your code somewhat. It now completes in python and it works in Mathematica. Please tell me if the outputs are reasonable. solution3d[edges_, vd_, vl_, ew_] := Module[{ uedges = UndirectedEdge @@@ edges, vcoords = List @@ vd, ew2 = KeyMap[UndirectedEdge @@ # &, ew], vars3d, \[Lambda], lbnd, ubnd, obj3d, err, sol, edgeLengths3d}...


2

Are you sure you have typed your function as you intended? I can't make it work, so I think you mean: f[x : {{_, _} ...}] := f /@ x; f[{a_, b_}] := a + b; f[{{1, 2}, {2, 0}, {3, 4}}] Which outputs {3,2,7} You could also use (amongst many other possibilities): {{1, 2}, {2, 0}, {3, 4}} /. {x_, y_} -> x + y I think from your example output {{2,2},{1,3},{...


2

MapIndexed work fine. list = {{1, 2}, {2, 0}, {3, 4}}; result=SortBy[First]@MapIndexed[{Total@#1, #2} &][list] (* {{2, {2}}, {3, {1}}, {7, {3}}} *) and then adjust the appearance. Flatten[#, 1] & /@ Reverse /@result (* {{2, 2}, {1, 3}, {3, 7}} *)


2

f[list_] := ( k = 1; Sort[Map[{k++, #[[1]] + #[[2]]} &, list], #1[[2]] < #2[[2]] &] ) f[{{1, 2}, {2, 0}, {3, 4}}] (* Result of calling f *) (* {{2, 2}, {1, 3}, {3, 7}} *)


2

Integrate[ E^(-\[Alpha] \[Sqrt](x^2 + y^2)), {x, -\[Infinity], \[Infinity]}, {y, -\[Infinity], \ \[Infinity]}, Assumptions -> a > 0] (ConditionalExpression[(2 \[Pi])/\[Alpha]^2, Re[\[Alpha]] > 0]) There is an internal parameter to the notebooks called $Assumption. There is the documentation page for Assumptions for the built-ins Simplify, ...


2

Do integration first and then take the limit k-> inf. Use indefinite integration. Integrate only finds a solution for m==0. g[x_, m_, k_] = 1/((2*(x - m))^(2*k) + 1) mint[x_, k_] = Integrate[g[x, 0, k], x] (* x Hypergeometric2F1[1, 1/(2 k), 1 + 1/(2 k), -4^k x^(2 k)] *) Use a trick. Tell Limit that x^(2 k) is always positive. (Valid for Integer k)...


2

Does this help? f2[x_?NumericQ, m_] := Limit[1/((2*(x - m))^(2*k) + 1), k -> Infinity]; Module[{m = 0}, NIntegrate[f2[x, m], {x, m - 1/2, m + 1/2}]] (* 1. *)


1

f[x_, y_, z_] := x + y + z; Try @@@ (Apply at Level 1): f[#,#2, 1] & @@@ {{1, 2}, {3, 4}} {4, 8}


1

The equations depend on the variables Hb , Db , kb , Ks , Gb and two parameters K,Ho For given parameters (examplary {K -> 1, Ho -> 1}) NMinimize might solve your problem: eqn = {Hb/Db == K,Ks == Sqrt[(Coth[kb Db])/(1 + Gb)],Gb == (2 kb Db)/(Sinh[2 kb Db]) Hb/Ho == Ks (Ho)^2 == Hb^2 (1 + Gb) Tanh[kb Db]} NMinimize[{1, eqn} /. {K -> 1, Ho -> 1}...


1

Clear["Global`*"] Rather than using If, I recommend that you use Piecewise area[J_, L_] = Piecewise[{{Abs[L*Integrate[Max[J x, x^2], {x, 0, 1}]], L < 0}}, Abs[L*Integrate[Min[J x, x^2], {x, 0, 1}]]] Vol[J_] = Integrate[area[J, L], {L, -1, 1}] // Simplify Vol[-J] == Vol[J] // Simplify (* True *) Plotting, Plot[Vol[J], {J, 0, 5}, ...


1

This is not an answer but rather something I do not understand. This seems quite Bizarre to me the more I think about it. pts = RandomPoint[Ball[], 10000]; pts2 = Map[RandomReal[{0, 0.5}, 3] + {1.5, 0, 0} + # &, pts]; (* points with noise and translation *) pts3 = RandomPoint[Ball[{1.5, 0, 0}, 1], 10000]; (* points sampled from another ball that is only ...


1

Your two functions do not share the same formula. However they share the same denominator: numerator[r_, q_, d_] := numerator[r, q, d] = (2 \[Pi] (1 + r q - r q E^(-2 q d))) (* there was a product r1 r1 that I wrote as r1^2, hope it's ok *) denominator[r1_, r2_, q_, d_] := \[Epsilon] q ((1 + r1 q ) (1 + r2 q) - r1^2 q^2 E^(- 2 q d))) The uV1 function ...


1

You can use Manipulate, PopupMenu and InputField as follows: functions = {Total, Min, Max, MinMax, Mean, Median, Commonest, Quartiles}; flabels = {"Suma Datos", "Dato Minimo", "Dato Maximo", "Rango", "Media Aritmetica", "Mediana", "Moda", "Cuartiles"}; fl = Thread[functions -...


1

You can use .5 {-y, x}/(x^2 + y^2) // TraditionalForm to see that .5 {-y, x}/(x^2 + y^2) can be use to express the vector value function. $$\left(\frac{-0.5y}{x^2+y^2},\frac{0.5x}{x^2+y^2}\right)$$ and actually,{-y, x}/(x^2 + y^2) is the gradient of the function ArcTan[y/x] or ArcTan[x,y] Grad[ArcTan[x, y], {x, y}] Grad[ArcTan[y/x], {x, y}] // Simplify (* {-(...


1

Another realization of ybeltukov's code. start=1/2; f[x_] = x + Sin[x]; Manipulate[ Show[Plot[{x, f[x]}, {x, 0, Pi}], NestList[{Last@#, f[First@# ]} &, {start, f[start]}, n] // ListLinePlot ], {n, 1, 10, 1} ]


Only top voted, non community-wiki answers of a minimum length are eligible