Loading [MathJax]/jax/output/HTML-CSS/jax.js

First time here? Check out the FAQ!

Ask Your Question
0

Unexpected result for trigonometric function

asked 4 years ago

gg gravatar image

updated 4 years ago

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

sin(x)cos(x)=0

Hand calculation give me the result of: x=π4+nπ

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.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 4 years ago

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)
Preview: (hide)
link

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 ( 4 years ago )
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 ( 4 years ago )

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

gg gravatar imagegg ( 4 years ago )
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 ( 4 years ago )

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: 4 years ago

Seen: 361 times

Last updated: May 24 '20