Tag Info

Hot answers tagged

11

I've got a theory.... Let's try to get the antiderivative: Integrate[(1 + 16*Tan[2*x - y]^2)/(1 + 4*Tan[2*x - y]^2), x, Assumptions -> y \[Element] Reals] (*returns 5 x - (5 y)/2 - ArcTan[2 Tan[2 x - y]] *) Seems legit. You can test with D[5 x - (5 y)/2 - ArcTan[2 Tan[2 x - y]], x] and plot or rearrange. This antiderivative is technically correct, ...


7

[Edit notice: I'll put the gist up front.] 10 π is not wrong With proper assumptions given, the integral evaluates as desired by the OP, to 6 π. Without them, it gives one of the correct values of the integral, 10 π, the one that in some sense is more likely, but without the correct conditions attached. (One may well argue that is a bug. However, ...


5

To flesh out GuessWho's suggestion: sol[t_] = NDSolveValue[{Cos[t] E^(Cos[t] + 0.5 t) == f'[t], f[0] == 0}, f[t], {t, 0, 40}] Show[ Plot[E^(-0.5 x) NIntegrate[Cos[t] E^(Cos[t] + 0.5 t), {t, 0, x}], {x, 0, 40}] Plot[E^(-0.5 t) sol[t], {t, 0, 40}, PlotStyle -> {Red, Dashed}] ] The second plot is about 300 times faster than the first one.


2

Just to illustrate versatility of Mathematica: Plot3D[2 x - y, {x, -2, 2}, {y, -2, 2}, RegionFunction -> Function[{x, y, z}, x^2 + y^2 < 4]] f = TransformedField["Cartesian" -> "Polar", 2 x - y, {x, y} -> {r, t}]; j = Simplify[Det[Outer[D[#1, #2] &, {r Cos[t], r Sin[t]}, {r, t}]]]; Integrate[f j, {r, 0, 2}, {t, 0, 2 Pi}] where the ...


2

While belisarius's comment answers the question, an arguably better way to achieve these is to use regions. For example, the plot is less choppy and there is less rounding error when integrating (for this example at least). (* without regions *) f[x_, y_] := 2*x - y (* choppy plot *) Plot3D[f[x, y], {y, -2, 2}, {x, -1*Sqrt[4 - y^2], Sqrt[4 - y^2]}] (* ...


2

Oddly, if you follow the hints given in the ConditionalExpressions you can get pointed to the right answer although constrained to an overly restrictive region. $Version "10.1.0 for Mac OS X x86 (64-bit) (March 24, 2015)" expr = (1 + 16 Tan[2 x - y]^2)/(1 + 4 Tan[2 x - y]^2); Integrate[expr, {x, 0, 2 Pi}] ConditionalExpression[9*Pi, -(Pi/2) ...


1

You could sample by yourself dataSample= (E^(-0.5 #) NIntegrate[Cos[t] E^(Cos[t] + 0.5 t), {t, 0, #}] &) /@ Range[0, 40, .1] ListLinePlot[Thread@{Range[0, 40, .1], dataSample}]


1

Integrate and NIntegrate agree on this matter: Table[Integrate[(1+16 Tan[2 x-y]^2)/(1+4 Tan[2 x-y]^2),{x,0,2Pi}],{y,0,10,2}] (*==> {6π,6π,6π,6π,6π,6π}*) Table[NIntegrate[(1+16 Tan[2 x-y]^2)/(1+4 Tan[2 x-y]^2),{x,0,2Pi}],{y,0,10,2}] (*==> {18.8496,18.8496,18.8496,18.8496,18.8496,18.8496}*) N[6Pi] (*==> 18.8496*)


1

This is a stab at cleaning it up. I put in table form so you can see how to loop over a. Needs["NumericalCalculus`"] Table[ g[t_] = {-(a + 2*Cos[2*t])*Sin[3*t], (a + 2*Cos[2*t])*Cos[3*t], 2*Sin[2*t]}; dg[t_] = If[t - 2*Pi <= 0, g'[t], g'[2*Pi]]; tfn = Module[{s}, NDSolveValue[{t'[s] == 1/Norm[dg[t[s]]], t[0] == 0, ...



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