Ask Your Question
0

Unexpected result for trigonometric function

asked 2020-05-24 03:39:24 +0100

gg gravatar image

updated 2020-05-24 03:39:53 +0100

I'm trying to solve the following trig eqn using sage.

$$sin(x)-cos(x) = 0$$

Hand calculation give me the result of: $$x=\frac{\pi}{4} + n\pi$$

However, the solve() function gives me a different result, why is that?:

sage: 
sage: solve(sin(x)-cos(x) == 0, x, to_poly_solve=True)
[x == 1/4*pi + pi*z25]
sage:

Also, what's z in the answer? I haven't defined any such variable.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2020-05-24 04:00:24 +0100

tmonteil gravatar image

It is not z to be considered, but z25, which is a free parameter that plays the role of $n$ in your own solution. Note that free variables are generated on demand, so if you run the same solve command at the beginning of a Sage session, you will get z1.

It is indeed a symbolic variable (defined by the system), as you can see with:

sage: solve(sin(x)-cos(x) == 0, x, to_poly_solve=True)[0].variables()
(x, z25)
edit flag offensive delete link more

Comments

Thanks for the reply. BTW, I was trying to post this question since yesterday, but it was being flagged as spam. Why is that? I am not behind proxy or anything.

gg gravatar imagegg ( 2020-05-24 05:18:06 +0100 )edit
1

We get a lot of spam, so as a way to mitigate when you make your first contribution, it must be approved by one administrator, then you will not be moderated anymore. However, this is not your first contribution, and i do not see any suspect keyword in your post, so this should not happen, weird. Do you have any screenshot of what actually happened ?

tmonteil gravatar imagetmonteil ( 2020-05-24 15:23:46 +0100 )edit

Sorry, I didn't take a screenshot. But admins can look at the logs.

gg gravatar imagegg ( 2020-05-24 17:24:24 +0100 )edit
1

Also, as explained in the documentation of solve?, if the arbitrary constant r1 starts with r it is a real number in R and if the arbitrary constant z1 starts with z it is a integer in Z.

Sébastien gravatar imageSébastien ( 2020-05-25 12:29:59 +0100 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-05-24 03:39:24 +0100

Seen: 308 times

Last updated: May 24 '20