Hot answers tagged

4

As Compatibility/tutorial/Utilities/FilterOptions says: The functionality of FilterOptions is provided by the kernel function FilterRules. Although the syntax is not identical. You have to change two things in the code: BeginPackage["RiemannSum`", {"Utilities`FilterOptions`"}] to BeginPackage["RiemannSum`"] And Begin["Private`"] to ...


3

ParametricNDSolve will return a numerical ODE solution with any number of free parameters. This parametric solution can then be fed into NonLinearModelFit (or whatever home-brew chi-squared algorithm you want to cook up) to find the best-fit values for the parameters. As an example, suppose we want have the ODE $y''(x) = - y(x)$, with initial conditions ...


3

is there some way to take the call ReplaceAll[var, rules]and make it forget contexts for a minute? BeginPackage["Test`"]; replace::usage = "Returns var/.rules."; print; Begin["`Private`"]; replace[rules_] := ReplaceAll[Symbol[$Context <> "var"], rules] End[]; EndPackage[]; Not general, but works. I would expect that replace[rules_] := ...


3

You can make use of Formal Symbols. BeginPackage["Test`"]; replace::usage = "Returns \[FormalV]/.rules."; Begin["`Private`"]; replace[rules_] := \[FormalV] /.rules End[]; EndPackage[]; Then in the notebook. replace[\[FormalV] -> 0] (* 0 *) Hope this helps.


2

Quitting and restarting may not always be the best way to handle shadowing, as it destroys the results of any computations performed. One can also use Remove. From the tutorial Contexts If you once introduce a symbol that shadows existing symbols, it will continue to do so until you either rearrange $ContextPath, or explicitly remove the symbol. You ...


2

This package is no longer available in recent Mathematica versions. It has been replaced with builtin functionality. Please read here: http://reference.wolfram.com/language/Compatibility/tutorial/Geometry/Rotations.html


2

Try replace[rules_] := ReplaceAll[Global`var, rules] in your function. Then replace[var -> 0] replace[Test`Private`var -> 0] yields 0 var as I think you'd like.


2

we can do a STFT of Sin[Pi*t^4] f[t_] := Sin[Pi*t^4]; data = Table[f[t], {t, 0, 5, 0.001}]; Spectrogram[data, SampleRate -> 1000] the instantaneous frequency of f[t] is $$\frac{\frac{\partial f(t)}{\partial t}}{2 \pi }$$.So the ideal instantaneous frequency is: Plot[Evaluate[D[Pi*t^4, t]/(2 Pi)], {t, 0, 5}] Ok,Combine the two image: Well ...



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