Tag Info

New answers tagged


I am not sure if I completely understood your problem, but maybe the following is what you are looking for: myFunction[t_, opts : OptionsPattern[paropts]] := Quiet[With[{x = If[OptionValue[a] =!= a, OptionValue[a]/t, 1/t]}, x + OptionValue[c]]] It works both when the option a is set, either in paropts or in the function call, or not. I also added an ...


Unfortunately your code is too incomplete to test, but the following should do what you want: myFunction[t, opts:OptionsPattern[paropts]]:= With[{x = If[OptionValue[a], a/Optionvalue[b], 1/OptionValue[b]]}, y=x+OptionValue[c]]


There have been reports in version 10.0.1 that the Suggestions Bar (aka Predictive Interface) sometimes mangles output values in notebooks. Try turning off the Suggestions Bar as described in this Wolfram Support Article.


My concerns have been mostly addressed here. The correct answer that works is given by: colorQ = Quiet @ Check[Blend @ {#, Red}; True, False] &; which can be implement in either of the following methods: colorQ /@ {Red,Hue[0.5],GrayLevel[0.5],CMYKColor[0,1,1,1/2],Opacity[0.5,Purple],blah} {True, True, True, True, True, False} colorQ[Red] True


You have to use SameQ (===): test[lcolor_: Red] := Module[{}, Red === lcolor] test /@ {RGBColor[1, 0, 0], Red, Blue} {True, True, False} For a full explanation read the Details sections for Equal and SameQ


You can do it like this, but your system is Stiff: p[t] = {p1[t], p2[t]}; p'[t] = {p1'[t], p2'[t]}; A[t_] = {{p1[t], 1}, {1, p2[t]}}; NDSolve[Flatten@{Thread[p'[t] == A[t].p[t]], Thread[p[t] == {1, 0}] /. t -> 0}, {p1, p2}, {t, 0, 1}] NDSolve::ndsz: At t == 0.9040861047003397`, step size is effectively zero; singularity or stiff ...


I suggest that you use local rules for your fixed values. Then, the following seems to do what you ask for: ClearAll[dotQ, init, vars]; dotQ[s_String, MSymbol_Symbol] := StringMatchQ[s, ToString[MSymbol] ~~ LetterCharacter]; vars[MSymbol_] := Select[Not@*(dotQ[#, MSymbol] &)@*ToString]@*Variables; init[expr_, MSymbol_Symbol] := Thread[#, Hold] ...


Based on comments, I came to the following approach: DynamicModule[ {nn, tn, dist, dataAll, data, dx, func, wave, f}, ColumnForm[{ Button["New data", dataAll = RandomVariate[dist, 2000]; data = Take[dataAll, nn]; func = CalcG1[wave, data, 0, Ceiling[Log2[nn] - Log2[Log2[nn]]]]; f = func[tn]; ], PopupMenu[Dynamic[wave, ...

Top 50 recent answers are included