Tag Info

New answers tagged

1

I present this for illustrative purposes. Here is a toy data set: samp = RandomReal[{23, 32}, 365 8 ]; This is just 365 days of 8 samples per day. You can get daily mean using: Mean /@ Partition[samp, 8]; You can visualize by just wrapping in ListPlot and with option Joined->True: You can also use TemporalData: td = TemporalData[samp]; td2 = ...


4

There are built-in functions to do that. Mean/@Partition[lst,365*8] Variance/@Partition[lst,365*8]


4

You have to forbid the evaluation of Total[myList] and Mean[anotherList] until you have actually replaced the arguments with the specific lists: obj = someClass[myList -> {}, anotherList -> {1, 2}]; calculateStuff[someClass[props___]] := Unevaluated[1 + Total[myList]*Mean[anotherList]] /. {props}; calculateStuff[obj] (* 1 *)


0

One method I've found that works, at least for this case, is to use Position and MapAt: myReplaceListAll[l_, rule_] := MapAt[Function[x, Replace[x, rule]], l, #] & /@ Position[l, rule[[1]] ] This almost works, except that when Position matches the whole list it returns {}, and MapAt doesn't return the whole expression. list rule = ({x_, y_} ...


0

I would try this, step by step: t = Table[Evaluate[D[Log@h[z, 3], {z, w}]], {w, 4}] (wait with defining f) t /. Derivative[d_,0][h][z,k_]:> x[z,d,k]/. h[z_,k_]:> x[z,0,k] (using FullForm of the derivative). Now apply (repeatedly) % //. x[z,d_,k_] :> x[z, d-1, k-1] /; d >= 1 && k >= 1 and, as a last step, restore the ...


3

What's happening only indirectly involves the pattern matching. Mathematica, when dealing with operations that are Orderless, will put the arguments into a canonical ordering (described here). In this case, an expression like Subscript[Z, 2, 1] Subscript[Z, 3, 1] can be seen to be equivalent to Times[Subscript[Z,2,1], Subscript[Z,3,1]] using FullForm. ...


1

If you want the term $\frac{\partial f}{\partial r}$ to disappear you need to introduce new function which would be: w2 = f[r, θ] r which means that you have to make a substitution f -> w2/r, this way: lapla1 /. f -> (w2[#, #2]/# &) // Simplify // ExpandAll If you once used f or w, don't change theirs definitions, use a new one, you ...


4

Basing on the following thread: Change variables in differential expressions and using great code by Jens for visualisation purposes (I have replaced part [vars__Symbol] with [vars__] because you are using Substripted names which are not Symbols, but that's only about visualisation). You can do the following in the first step: M2 = M /. f -> (f[#, #2, ...


2

The following assumes that your replacements are 3x3 matrices but it is easy to generalize. I'm not sure if you need. It will take care of -1 on edges. replace[mm_, reps_] := Module[{m = ArrayPad[mm, 1], pos = Position[mm, -1]}, MapThread[ (m[[#[[1]] ;; #[[1]] + 2, #[[2]] ;; #[[2]] + 2]] = #2) &, {pos, reps}]; ArrayPad[m, -1]] mm = ...



Top 50 recent answers are included