Tag Info

New answers tagged


I thought this question for 2 days, and now I have a solution(I don't know how the built-in BernsteinBasis to implement to make the D[BernsteinBasis[5, 3, u], {u, 2}]// PiecewiseExpand work well) as below: Unprotect[PiecewiseExpand]; PiecewiseExpand[expr_]/;! FreeQ[expr, Bernstein] := (expr /. Bernstein[n_, i_, u_] :> Piecewise[ {{Binomial[n, ...


I am not aware of any good workaround (if you insist on using the same syntax) - the depth-1 limitation for UpValue search is pretty restrictive. You may try something like this: ClearAll[Gate]; Gate /: {a___, Gate[b_], c___} := {a, b, c} /; MatchQ[Stack[_][[-5]], HoldForm[Lookup[_List, _]]] but I can't say how robust this is, and also this would ...

Top 50 recent answers are included