Tag Info

Hot answers tagged

30

Here's a dynamic version (sorry, I couldn't resist). Manipulate[ DynamicModule[{alist, pt, pc}, pt[a_] := {Cos[a], Sin[a]}; alist = Union[Range[0, 2 Pi - Pi/6, Pi/6], Range[0, 2 Pi - Pi/4, Pi/4]]; a = Nearest[alist, Mod[ArcTan @@ p, 2 Pi, 0]][[1]]; pc = pt[a]; Graphics[{ Circle[], {LightGray, Line[{{0, 0}, pt[#]}] & /@ alist}, ...


28

There are a couple tricky points here. Here's a start, which I imagine you can finish. markings[t_] := Module[{o={0,0},p={Cos[t],Sin[t]}, t2=Together[t],tFormat, rot}, tFormat = If[Denominator[t2]=!=1, Row[{Numerator[t2],"/",Denominator[t2]}]]; rot = If[TrueQ[Pi/2<Mod[t,2Pi]<3Pi/2],t+Pi,t]; {{Opacity[0.3],Line[{o,p}]}, ...


28

You can check out this one. I don't know how well it works Periodic`PeriodicFunctionPeriod[E^(I 2 Pi t) + Cos[3/9 Pi t], t] 6 Perhaps you are also interested in the other functions in that context. Check Names["Periodic`*"] EDIT As @Artes notes in the comments, in v10 there's a documented version of this function called FunctionPeriod


26

Solutions to algebraic or transcendental equations are expressed in terms of Root objects whenever it is impossible to find explicit solutions. In general there is no way express roots of 5-th (or higher) order polynomials in terms of radicals. However even higher order algebraic equations can be solved explicitly if an associated Galois group is solvable. ...


20

You can use TrigExpand to expand all trigonometric functions to fundamental forms and then Eliminate solves the rest eq1 = Sin[x]^8 + 2 Cos[x]^8 - 1/2 Cos[2 x]^2 + 4 Sin[x]^2 == 0; eq2 = t == Cos[2 x] Eliminate[TrigExpand[{eq1, eq2}], x]


19

This is a new version of my answer in response to the edited question (the first version is here). It is based on the same idea, but the Weierstrass substitution rules are now generated by Mathematica (instead of entered by hand) and results with $\pm$ solutions are correctly returned. First, generate the Weierstrass substitution rules $TrigFns = {Sin, ...


19

Here is a numeric approximation method that can be useful when no analytic information is known. I will illustrate with the function WeierstrassPPrime[t, {2, 3}] that was mentioned in a comment to one response. We begin by taking random steps, and sampling the function at those steps (I'll explain the random step size presently). We then plot the ...


17

Removing the imaginary portion of an expression is done by doing ComplexExpand[Re[expression]]. Using just Re alone will not work as Re does no evaluation on symbols with unknown complex parts. Now as stated in the problem and the comments above this particular problem requires a fair amount of assumptions. The simplest way to add local assumptions is to ...


16

Try using FullSimplify: FullSimplify[Sin[x] == Tan[x] Cos[x]] This returns True if Sin[x] == Tan[x] Cos[x] (which it does). Please note that == (Equal) should be used instead of a single equal sign (Set). More complicated trig identities can be difficult to reason about. Mathematica may not be able to properly determine whether they are true or not. You ...


16

Looking at the Trace of one which does work: x = Sin[Pi/5] (* Sqrt[5/8 - Sqrt[5]/8] *) Trace[ArcSin[x], TraceInternal -> True] It appears that Mathematica computes the ArcSin numerically and then recognises the result, 0.628319 as possibly equal to Pi/5. To check it computes Sin[Pi/5], and subtracts it from the original argument to see if it gets ...


15

The function you want for this kind of case is TrigReduce: TrigReduce[expr] rewrites products and powers of trigonometric functions in expr in terms of trigonometric functions with combined arguments. And it works:


14

Use the following representation of the Legendre polynomials: $$ P_n(x) = 2^n \sum_{k=0}^n x^k \binom{n}{k} \binom{\frac{n+k-1}{n}}{n} $$ Note that the sum effectively is over $k \equiv n \bmod 2$. Expand each Legendre polynomial into a sum. Integration with respect to $\theta$ is easy: $$ \int_0^{\pi} \sin^{k_1+k_2+k_3+1} \theta \mathrm{d}\theta ...


13

This is similar to my Log question and similar methods can be used. $PrePrint = # /. { Csc[z_] :> 1 / Defer@Sin[z], Sec[z_] :> 1 / Defer@Cos[z] } &; Example: (x + y) Csc[x] Sec[y] (x + y)/(Cos[y] Sin[x])


13

The proof of the original statement that $f(x)\equiv x\sin\frac{\pi}{x}$ is a monotonically increasing function of $x$ for $x>1$ can be done as follows: First, we show that the second derivative $f''(x)$ of the function is negative: Simplify[D[x Sin[\[Pi]/x], x, x] < 0, Assumptions -> x > 1] True This means that the first ...


12

Mathematica often responds well when provided a little expert assistance. Let's focus on techniques that have a wide application rather than just to this problem. Can the function be decomposed into simpler pieces? Yes, obviously: $f(x)$ is the product of $x$ and $\sin{\pi / x}$. Both are obviously increasing for $x \in [1,2]$. After that, $\sin{\pi / ...


12

General remarks These are are crucial aspects of solving equations symbolically: So far (in general) Mathematica cannot solve transcendental equations when two unknowns are involved, nevervetheless in some exceptional cases it may seem like it could (see e.g. How do I solve this equation?). This is also the case when some symbolic constants are involved ...


12

Removing the double angles (e.g. $\cos(2 \theta) = \cos^2(\theta) - \sin^2(\theta)$) with TrigExpand allows the elimination to be performed: eq = TrigExpand @ { Cos[θ] + Cos[ϕ] + Cos[ψ] == a, Sin[θ] + Sin[ϕ] + Sin[ψ] == b, Cos[2 θ] + Cos[2 ϕ] + Cos[2 ψ] == c, Sin[2 θ] + Sin[2 ϕ] + Sin[2 ψ] == d}; Eliminate[eq, {θ, ϕ, ψ}] $a^4+2 a^2 ...


11

One way to do this is: Sin[x]^8 + 2 Cos[x]^8 - 1/2 Cos[2 x]^2 + 4 Sin[x]^2 == 0 /. Solve[t == Cos[2 x], x] //FullSimplify // Expand // Union // Column // TraditionalForm It gives exactly your answer if you get rid of your denominator 16 (multiply both sides of your equation by 16). This will also work with more complex substitutions (for example t ...


11

In addition to Mr. Wizard's analysis, one can also avoid the indeterminacy by replacing ArcTan as follows: Compile[{}, With[{r = Range[-2, 2, 0.005]}, Table[Arg[Complex[x, y]], {x, r}, {y, r}]]][]; The fact that ArcTan[0,0] is undefined is a real nuisance, and I never saw the point of it because that form of the function is mainly used for ...


11

Here's another way: Assuming[Element[{i, j, k}, Integers], Refine[Cos[(i + j + k) Pi]]]


10

One way to induce Mathematica to simplify to Tan functions is to introduce the arguments as inverse tangents, as in $x\equiv \arctan a$ and $y\equiv \arctan b$. Then you could write for example Simplify[ TrigExpand@Tan[ArcTan[a] + ArcTan[b]]] /. {a -> Tan[x], b -> Tan[y]} (* ==> (Tan[x] + Tan[y])/(1 - Tan[x] Tan[y]) *) or more generally with ...


10

Plot[Sin[x], {x, -4 Pi, 4 Pi}, Mesh -> {{0, 2 Pi}}, MeshShading -> {ColorData[1][1], Red}] Update [@belisarius pointed out that another answer shows the built-in, but undocumented, function Period`PeriodicFunctionPeriod that returns the period of a periodic function with exact coefficients.] If you'd like more general functionality, one can ...


10

Try TrigExpand TrigExpand[Cos[2 ArcCos[A]]] -1 + 2 A^2


9

There is no best general way to check if any two trigonometric expressions are equal. One can use TrigReduce, TrigExpand, TrigFactor, TrigToExp, Together and Apart (especially with the Trig->True option), Simplify, FullSimplify, etc. All these functions have their advantages and we discuss some of them. For more complicated examples when using Simplify ...


9

A bit different approach : Simplify @ TrigReduce[ Sin[x]^8 + 2 Cos[x]^8 - 1/2 Cos[2 x]^2 + 4 Sin[x]^2 == 0 /. Solve[ t == Cos[2 x], x, InverseFunctions -> True][[1]]] 35 + 10 t^2 + 4 t^3 + 3 t^4 == 28 t or using Eliminate : Eliminate[ TrigToExp[{ Sin[x]^8 + 2 Cos[x]^8 - 1/2 Cos[2 x]^2 + 4 Sin[x]^2 == 0, t == Cos[2 x]}], x, ...


8

Short answer: no, ArcTan[2] is not fraction of $\pi$. But this is more of a mathematics question than pertaining to Mathematica. If you want to “check” that the result is not expressable as a fraction of $\pi$, you can check for the continued fraction reprentation of $\arctan(2)/\pi$, and see that it does not seem to converge: ...


8

Maybe this HoldForm[Pi] (1/Pi ArcTan@2.) or if you want a nicer way Rationalize /@ (HoldForm[Pi] N@(1/Pi ArcTan@Range[5])) Edit The latter method works well in cases when there is a rational fraction of $\pi$ : Rationalize /@ (HoldForm[Pi] N @ (1/Pi ArcTan @ { Sqrt[1 - 2/Sqrt[5]], 2 - Sqrt[3], ...


8

Expand doesn't work as you'd like even with Trig -> True. TrigReduce yields the experssion a bit different than expected. Instead, you can use Apart with the option Trig therein (by default Options[Apart, Trig] yields {Trig -> False}) to get exactly the expected output, e.g. : Apart[ Cos[x]^3 Sin[x]^2, Trig -> True] Cos[x]/8 - 1/16 Cos[3 x] - ...


8

FullSimplify[Cos[(i + j + k)*Pi], Assumptions -> Element[i + j + k, Integers], ComplexityFunction -> LeafCount] (-1)^(i + j + k) Simplify[Cos[t*Pi], Element[t, Integers]] /. t :> i + j + k (-1)^(i + j + k)


7

I'll answer with a more general module I've done for converting trig expressions. An overkill here, but anyway: trigSet[exp_, inTerm_] := Module[{trigSyms, rels, set, setRep, setRep1, toLow, oneInTermsOf, allInTermsOf, fq, ruleAll, convert}, trigSyms = {Sin, Cos, Tan, Cot, Sec, Csc}; rels = {csc sin == 1, cos^2 + sin^2 == 1, 1 == cos ...



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