New answers tagged

1

By using SetDelayed (short form :=) to define the function g1 or g2 you prevent the evaluation of b1 or b2 respectively into the assigned expression, so e.g. g1 has for its complete definition: ?? g1 Global`g1 g1[s_]:=Piecewise[b1,0] Parameter substitutions into the right-hand-side are made before further evaluation, and since there is no literal s ...


5

Introduction The first thing that I noticed is that the functional form for all of your CDD and LHS functions are identical. I propose that rather than defining six functions for each, we define one function and change the input arguments to cover the various cases. cdd[s_, a_, b_, c_] := 10^(a + b*c - b*s)*Exp[-10^(s - c)] lhs[s_?NumericQ, a_?NumericQ, ...


6

Below is an extended comment showing the effects that can happen when one ignores the correlations among parameter estimators (either on purpose or because journal authors or editors don't know enough about statistics to include necessary information). First I create some data with the same curve form as the function CDDHybrid and a set of predictor values ...


4

Could use Filling -> {4 -> {{1}, LightRed}, 1 -> {{3}, LightBlue}, 3 -> {{6}, LightRed}} and omit FillingStyle. Or Filling -> {1 -> {3}, 4 -> {6}}, FillingStyle -> {{LightBlue, Opacity[0.5]}, {LightRed, Opacity[0.5]}} which respectively produce the plots below.


5

This does what I think you're after, fiddle with options as desired: With[{a = Interval[1.01 + .18 {-1, 1}], b = Interval[.92 + .11 {-1, 1}], c = Interval[2.2 + .2 {-1, 1}]}, Plot[{Min[a + b*x + c*x^2], 1.01 + .92 x + 2.2 x^2, Max[a + b*x + c*x^2]}, {x, -5, 5}, Filling -> {1 -> {3}}, FillingStyle -> Darker, PlotStyle -> {None, Red, ...


0

We can learn something by looking at the progression of finite integrals: z = 1; \[Epsilon] = 1/200000000000000; trend = Table[{n, NIntegrate[ BesselK[1, Sqrt[(x^2 + z^2)]]/ Sqrt[(x^2 + z^2)] x (Cosh[(1 - \[Epsilon]) x]), {x, 0, n}, MaxRecursion -> 20, WorkingPrecision -> 40] }, {n, 10^Range[7]}]; Show[{ListLogLogPlot[trend], ...


2

It's from the Bessel factor: Cosh[(1 - ϵ) x] /. x -> 10.`40^16 Note that the Bessel function evaluates to Underflow[]:


4

The problem is that Expectation does not evaluate to a numeric result in all cases. It's also quite slow. You could replace it by NExpectation in the final integrand. I threw in an extra N for just to be sure. It takes so long to evaluate, I didn't have time to experiment. AverageProbSuccess[B_, \[Lambda]_] := Block[{n = 0, i, Expectation}, ...


2

Since your number is quite large, you can use Stirling's approximation to do this. It's also very common to use this approximation in statistical mechanics: For large number $n$ $$\log(n!)\approx n\log(n)-n$$ So in your case $$n=\frac{Nn}{3}$$ then $$ \log\left[\frac{(3n)!}{n!\times n!\times n!}\right]\\ =\log[(3n)!]-3\log[n!]\\ \approx 3n \log(3n)-3n ...


0

It looks like there isn't a good way to bypass Overflow[]. However, for very large factorial calculations, it's useful and incredibly accurate to use Stirling or Nemes approximations, depending on the size of the factorial. @Mathematica devs, an idea- maybe catch overflow errors, tell Factorial to substitute the Stirling or Nemes approximation, then try to ...


0

For people who has the same problem but their data manipulation isn't too heavy (like me), can use this neat trick. In this example, I defined a list my do loop want to loop over, point 32 and 33 are bad data so i deleted them manually! Instead of looping over i,1000,1044 now we loop over a list called list of points It works for small data processing, ...


5

The syntax you use is wrong. There is no import element called "P" for the MAT format. Take a look at the documentation: it lists the allowed elements: "Elements", "Rules", "Options", "Data", "LabeledData", "Comments", "Labels". You probably want "LabeledData", so use Import["file.mat", {"MAT", "LabeledData"}] or alternatively Import["file.mat", ...


2

Here is what I get when I try your equation: a = 1; b = 0.2; c = 4; y0 = 8.5; v0 = 0; DSolve[{a y''[t] + b y'[t] + c y[t] == 0, y[0] == y0, y'[0] == v0}, y[t], t] (* {{y[t] -> 8.5 E^(-0.1 t) (1. Cos[1.9975 t] + 0.0500626 Sin[1.9975 t])}} *) You may need to restart your kernel and try again.



Top 50 recent answers are included