# Difficulty using Conditional Expressions from Solve

Posted 9 years ago
11091 Views
|
2 Replies
|
2 Total Likes
|
 Hi all,I have only recently started using Mathematica through school and have run into a few problems when trying the following expression. Solve[Sin[(119 \[Pi])/730 - (2 \[Pi] t)/365] == 1/2, t] However when i do this i get the following conditional expression: {{t -> ConditionalExpression[( 119 \[Pi] + 730 (-(\[Pi]/6) + 2 \[Pi] C[1]))/(4 \[Pi]), C[1] \[Element] Integers]} and {t -> ConditionalExpression[(119 \[Pi] + 730 ((7 \[Pi])/6 + 2 \[Pi] C[1]))/(4 \[Pi]), C[1] \[Element] Integers]} I am trying to evaluate it so that i can get simple answers for t, and not conditional expressions. Is there a SIMPLE way that I can get around this for either the solve function or the reduce function.Thanks, James Attachments:
2 Replies
Sort By:
Posted 9 years ago
 Do you find this easier to read?In[2]:= Reduce[Sin[(119 [Pi])/730 - (2 [Pi] t)/365] == 1/2, t]Out[2]= C[1] [Element] Integers && (t == 119/4 - (365 ([Pi]/6 + 2 [Pi] C[1]))/(2 [Pi]) || t == 119/4 - (365 ((5 [Pi])/6 + 2 [Pi] C[1]))/(2 [Pi]))
Posted 9 years ago
 Dear James,the results that Mathematica gets {{t -> ConditionalExpression[(119 \[Pi] + 730 (-(\[Pi]/6) + 2 \[Pi] C[1]))/(4 \[Pi]), C[1] \[Element] Integers]}, {t -> ConditionalExpression[(119 \[Pi] + 730 ((7 \[Pi])/6 + 2 \[Pi] C[1]))/(4 \[Pi]), C[1] \[Element] Integers]}} are actually relatively easy to read. You see, in each of the two "branches" there is an expression which has a constant C[1]. The solution says that you are allowed to substitute any integer for C[1] and you will get a solution. That is an infinite number of solutions so Mathematica cannot just print all of them out. You can print out a list for any C[1] you want. First you find the solutions: sols = Solve[Sin[(119 \[Pi])/730 - (2 \[Pi] t)/365] == 1/2, t] and then you calculate a list of all solutions for which the constant C[1] ranges from say -5 to 5 Table[t /. sols /. C[1] -> k, {k, -5, 5,1}] //Flatten This gives {-(5477/3), -(4747/3), -(4382/3), -(3652/3), -(3287/3), -(2557/3), -(2192/3), -(1462/3), -(1097/3), -(367/3), -(2/3), 728/3, 1093/3, 1823/3, 2188/3, 2918/3, 3283/3, 4013/3, 4378/3, 5108/3, 5473/3, 6203/3} The command takes values t which fulfil the solutions. "/." can be read as "such that" the solutions hold. I then substitute the variable C[1] by a k which goes from -5 to 5 in steps of 1 using the Table command. The flatten command gets rid of some of the spare curly brackets. If you want approximate solutions you can wrap the last command in N[.] like so: N[Table[t /. sols /. C[1] -> k, {k, -5, 5, 1}] // Flatten] That triggers a numerical evaluation. Alternatively you can just look for instances of numbers that fulfil the equation: FindInstance[Sin[(119 \[Pi])/730 - (2 \[Pi] t)/365] == 1/2, t, 10] That is not as systematic, but gives some results:  {{t -> 284698/3}, {t -> 478148/3}, {t -> -(60592/3)}, {t -> -(531077/3)}, {t -> 544943/3}, {t -> 449678/3}, {t -> -(106582/3)}, {t -> -(183962/3)}, {t->405148/ 3}, {t -> 425588/3}} I hope this helps a bit.M.PS: If it helps you can also use the Simplify function: Solve[Sin[(119 \[Pi])/730 - (2 \[Pi] t)/365] == 1/2, t] // Simplify which makes the results look somewhat nicer: {{t -> ConditionalExpression[-(2/3) + 365 C[1], C[1] \[Element] Integers]}, {t -> ConditionalExpression[728/3 + 365 C[1], C[1] \[Element] Integers]}} 
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.