Tag Info

Hot answers tagged

4

If this is a vector function then we expect its components to get integrated independently? If this is what you want, then see that vector Piecewise and Piecewise vector are not the same things. NIntegrate, Plot, etc. need to see a List as an outer wrapper to know what to do with inside stuff. intervals = {s < -2, -2 <= s < 1, 1 <= s}; test[s_] ...


4

I think you need to check your equations and/or the numeric values you are using. To me it looks like this problem might well have no solution: equation = 10000 u'[r] (1 + u'[r]) - 1.`*^-6 (r + u[r]) (u[r] + r u'[r]) + 10000 r u'[r] u''[r] + 10000 r (1 + u'[r]) u''[r] == 0; derivativeAtEndPoint[uStart_?NumericQ] := NDSolveValue[{equation, 10000 ...


3

This is at least how I might start such a problem: First define a function that calculates the numerical integral (using your definition) from 0 to some number: res[a_?NumericQ, xmax_?NumericQ] := res[a, xmax] = NIntegrate[ x Tanh[Pi x] Sqrt[x^2 + a^2] - (a^2/2 + x^2) Tanh[\[Pi] x], {x, 0, xmax}, WorkingPrecision -> 50] You might notice ...


3

A general remark to start with - speed is in the eye of the beholder. Having said that, there are a couple of things not quite right with your code. First of all, NDSolve isn't doing what you think it does - it returns unevaluated because you didn't give an initial condition and you gave the wrong independent variable - you want to solve for f, not for ...


3

Let's see in detail what the comments are talking about. Define: r[x_] := 2*(1 - (1/3)^2)/(1 + (1/10)*Cos[x]) Compute function under your integral: g[x_] = (Sqrt[(r'[x])^2 + r[x]^2])/(Sqrt[2 (-1 + 1/(r[x]))]) // FullSimplify Plot Im and Re on domain of interest: Plot[{Re@g[x], Im@g[x]}, {x, 0, 2 Pi}] So you are indeed basically integrating the ...


3

Following @Vitaliy's comment try this formulation: kB = QuantityMagnitude@ UnitConvert[Quantity["BoltzmannConstant"] , "Joule/Kelvin"] pdf[dp_?NumericQ, d0p_?NumericQ, w_?NumericQ] = kB^(-1/3)/(w Sqrt[2 Pi]) 1/dp *E^(-1/(2 w^2) (Log[dp /d0p])^2); mt[b_?NumericQ, Nt_?NumericQ, Ms_?NumericQ, d0p_?NumericQ, w_?NumericQ] := Nt kB^(4/3) Ms Pi /6 ...


2

Combined symbolic and numeric calculation can be hard to deal with. You may do the symbolic part first and then do the substitution, or do the pure numeric integration NItegrate many times. Integrate[(n3 + s^2/(2 r))*(c e n)/(g r^(2/3) (s/lb (end - beg) + beg)^(4/3)), {s, 0, lb}][[1]] Output: (3 c e lb n (beg^( 1/3) (5 beg + 6 beg^(2/3) end^(1/3) + 3 ...


2

I don't know your speed or precision requirements but here's an approach that yields a low precision estimate to your 50 sphere problem in a few seconds. It's based on the fact that the surface area of a sphere can be computed via $$\int_0^{2\pi}\int_0^{\pi} \sin(\varphi) \, d\varphi \, d\theta.$$ We'll simply write a test function to determine when a point ...


1

You try to integrate before theta1 etc. are given numeric values. If I understand correctly how you wish to deal with the lists of parameters, then use Map to apply NIntegrate to each integrand: kick3 = Map[ NIntegrate[#, {s, 0, lb}] &, (eta3 + s^2/(2 rho2))* CSR3linear /. {theta1 -> {0.06}, d -> {8.60435}, sigma3beg -> ...


1

This is not an answer to your question but a copy and paste from the documentation which you might find inspiring: Boundary Value Problems with Parameters In many of the applications where boundary value problems arise, there may be undetermined parameters, such as eigenvalues, in the problem itself that may be a part of the desired solution. By ...


1

I can confirm that using SetDelayed instead of Set is the culprit here. As I get the same error you got with SetDelayed but not with Set The following works fine: α = 0.07; A = Sin[θ]*Sin[θ2]*Cos[φ - φ2] + Cos[θ]*Cos[θ2]; B = Sin[θ]*Sin[θ3]*Cos[φ - φ3] + Cos[θ]*Cos[θ3]; V = Sin[θ2]*Sin[θ3]*Cos[φ2 - φ3] + Cos[θ2]*Cos[θ3]; c2 = (B*c*c3 - c3*c3)/(A*c - c3*V); ...


1

This question appears to be off-topic because it is about a singularity in the mathematical model and not about Mathematica; further the OP has been absent for over a year. For example: l = 3; zsi = 0.81; zse = 1.5; vsi = -1.5; vse = 0.5; z0 = 0.01; Block[{zs = zsi, vs = vsi}, sol = NDSolve[{Eqn1 == 0, Eqn2 == 0, z[0] == zs, v[0] == vs, z'[0] == 0, ...



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