Tag Info

Hot answers tagged

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


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


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


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


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


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



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