The Stack Overflow podcast is back! Listen to an interview with our new CEO.

# Tag Info

55

A shorter introduction to working with Root objects is in the below answer. 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 ...

47

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

37

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, ... 37 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}, ... 33 You can check out this one. I don't know how well it works PeriodicPeriodicFunctionPeriod[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 32 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}]}, Rotate[... 26 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 (... 24 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])

24

A transformation function is just any function that will take an expression to another expression you consider equivalent. For example, we can make one that takes Sin to Sinc. sinctrans[expr_] := expr /. Sin[x_] :> x Sinc[x] You could just use that by itself to do this substitution, but you can also add it to the TransformationFunctions of Simplify to ...

22

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

21

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]

21

Disclaimer: This is not a full answer, but perhaps it's a start. From an algebraic stand point this seems like a very hard problem. I attacked it with a more brute force approach. I guess a basis and use LatticeReduce to try to find a Diophantine relation. Note this code only tries to identify roots as the product of integral powers of trig. If it returns ...

21

I. $\sqrt{z}$ Quick, what's the square root of $4$? If you said $2$, you're right! If you said $-2$, you're right! Wait, what? Solve[x^2 == 4, x] {{x -> -2}, {x -> 2}} A lot of functions have the problem of not having a unique inverse. That is, if you ask what are the possible values an inverse can take, you might end up with two, three, maybe ...

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

19

This answer is to summarize the most important points about working with Root objects. Essential reading: Algebraic Numbers in the documentation. What are Root objects? Root is primarily used to symbolically represent roots of polynomials. In general, roots of polynomials of order $\ge 5$ do not have an explicit expression in terms of radicals, as ...

18

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

18

Mathematica auto simplifies simple trig expressions like these, but you can turn off this setting via SystemOptions: SetSystemOptions["SimplificationOptions" -> "AutosimplifyTrigs" -> False]; Now we see your change is left untouched without the need of HoldForm and friends. (1 - Tan[x])/(Sin[x] - Cos[x]) /. Tan[x] -> Sin[x]/Cos[x] (1 - Sin[x]/...

17

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[π/x], x, x] < 0, Assumptions -> x > 1] True This means that the first derivative $f'(x)$ is ...

17

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

16

I have to thank you for leading me down a fascinating rabbit hole! I have always found airfoil shapes enormously pleasing, but I was not aware of the NACA system. For those who, like me, did not know much about the story, NACA was the predecessor of NASA. They established some of the first airfoil definitions codified through mathematical relationships. For ...

15

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 / x}... 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: 15 In the course of answering this question, I ran into a little bit of weirdness that doesn't square with my experience with previous versions of Mathematica. I think writing this answer is as good a time as any to bring it up. Firstly, there is this tantalizing line from the internal implementation notes: FunctionExpand uses an extension of Gauss's ... 15 We know that FullSimplify[ArcTan[k] + ArcTan[1/k], k > 0] does not do it. But by first converting to exponentials, now Mathematica does it FullSimplify[ TrigToExp[ArcTan[k] + ArcTan[1/k]] , k > 0] Gives as output$\frac{\pi}{2}$14 First, you better use NonlinearModelFit, Fit and FindFit haven't updated in a while, so newly introduced LinearModelFit and NonlinearModelFit will have greater accuracy and better performance. Second, for arbitrary curve the initial values for parameters can lead to a local minimum for fitting, thus producing wrong curve fit. The best approach would be to ... 13 Here's two possibilities: Simplify[TrigExpand[Tan[ArcTan[a] - ArcTan[b]]]] (a - b)/(1 + a b) FullSimplify[Tan[ArcTan[a] - ArcTan[b]], ComplexityFunction -> (LeafCount[#] + 1000 Count[#, ArcTan[_], Infinity] &)] (a - b)/(1 + a b) 13 A little bit of trickery: ArcTanh[x] + ArcTanh[y] // Tanh // TrigExpand // FullSimplify // ArcTanh (* ArcTanh[(x + y)/(1 + x y)] *) Note the parentheses. 13 Possibly a bad idea for the reasons mentioned in previous messages, but you could do something like the following: SetAttributes[trigMode, HoldAllComplete]; trigMode[expr_] := Unevaluated[expr] /. {(f : ArcSin | ArcCos | ArcTan | ArcCot | ArcSec | ArcCsc)[x_] :> 180 f[x]/π, (f : Sin | Cos | Tan | Cot | Sec | Csc)[x_] :> f[x °]};$Pre = ...

12

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

12

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

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