Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

I encountered this weird output when solving this differential equation.

The problem:

Solve y' + y tan(x) = sin(2 x) given y=2 when x=0 and verify the solution.

My code:

In: DSolve[{y'[x] + y[x] tan[x] == sin[2 x], y[0] == 2}, y,x]
Out: DSolve[{tan[x] y[x] + y'[x] == sin[2 x], True}, y,x]

But there is an error message saying: Equation or list of equations expected instead of True in the first argument {tan[x]y[x]+y'[x]==sin[2x],True}.

However, when I solved it without using the initial condition it worked! I don't understand the reason why.

DSolve[{y'[x] + y[x] tan[x] == sin[2 x]}, y,x]

I have checked all the relevant documentations about syntax etc, but still I couldn't figure out what were the mistakes I had made for both cases.

I will really appreciate if anyone could help me figure these out. Many thanks!

share|improve this question
You are aware that the trigonometric functions are Sin[] and Tan[], and not what you've written? Capitalization matters here. –  J. M. Jun 5 '13 at 2:39
@0x4A4D. Thanks! you are right, how could I have been so careless.. –  user71346 Jun 5 '13 at 2:47
add comment

closed as too localized by Oleksandr R., Sjoerd C. de Vries, Artes, chris, Silvia Jun 5 '13 at 12:32

This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 1 down vote accepted

y[0] == 2 is evaluating to True. You can test this by evaluating y[0] == 2 in a new cell. This is because y has been defined.

Please try clearing y by running Clear[y] and then rerunning the DSolve command. If this doesn't work, evaluate the command Quit and then run the DSolve command.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.