Tag Info

Hot answers tagged

5

q[r_] := Piecewise[{{25/(0.1*1), r < 0.1}, {25/r, r >= 0.1}}] phi[r_, t_] := (Pi/2) + q[r]*t v[r_, t_] := q[r]*r*Cos[phi[r, t]] s[x_] := Piecewise[{{-1, x < 0}, {1, x >= 0}}] f[x_, y_] := s[x]*v[Sqrt[x^2 + y^2], ArcTan[y/x]/q[Sqrt[x^2 + y^2]]] Here are two ways to go: 1 NIntegrate[Boole[(23 <= f[x, y] <= 24 && x^2 + y^2 <= ...


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


4

How about pl = ContourPlot[f[x, y], {x, -1, 1}, {y, -1, 1}, RegionFunction -> Function[{x, y}, x^2 + y^2 < 1], PlotPoints -> 25,ContourShading -> False] Then lines = Cases[pl // Normal, Line[pts_] :> List[pts], Infinity]; lines = Select[lines, Length[#[[1]]] > 20 &]; lines = Map[Flatten[Transpose[#], 1] &, lines]; ...


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

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

Ok, here is my stab at understanding the issue. To begin, this is how I am interpreting the integral (it is always a good idea to clearly mark the dependence of your symbols): $$\frac{\int_0^{\infty } i(q)\,q^2 \cos (q\,x) \, dq}{\int_0^{\infty } i(q) \, q^2 \, dq}$$ where $i(q)$ is the intensity as a function of $q$. So, lets interpolate over the data ...


2

Perhaps this will help:- eqn = a Integrate[Exp[-s^2]/(s - c x)^2, {s, -Infinity, Infinity}, Assumptions -> Im[c x] != 0] + b Integrate[Exp[-s^2]/(s - d x)^2, {s, -Infinity, Infinity}, Assumptions -> Im[d x] != 0]; a = 1.5; b = 2; c = 0.8; d = 1; Plot[eqn, {x, -1000, 1000}]


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


2

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


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


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

I suppose I dislike mixing structural operations - like Thread - inside algebraic expressions. My objections are two-fold: 1) I prefer to keep Mathematica operations distinct from actual algebra for aesthetic reasons. 2) If an expression is cut and pasted and changed, operations like Thread can all too easily end up chewing into mathematical ...


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



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