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'm making a program where i need to plot the soluton of an ODE and ,if possible, obtain the analytical solution. My idea was to use DSolve, check the output, and if it failed use NDsolve.

Now, i know i can set a time limit using TimeConstrained[] , but how do i check when DSolve instantly return the input because the alculation is too complex or there is no analytical solution?

sorry if this was answered elsewere, i tried to search but i couldn't find anything related.

share|improve this question

closed as off-topic by Michael E2, m_goldberg, Pickett, bobthechemist, halirutan Feb 16 at 22:59

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Michael E2, Pickett, bobthechemist, halirutan
If this question can be reworded to fit the rules in the help center, please edit the question.

    
That's really too vague .. You may want to check the answer describing sms/mail sending after computation –  Sektor Feb 15 at 17:32
    
Hi lorenz! and welcome to Mma.SE. I would consider this question to be possibly off topic because it is too basic (a question should be based on "minimal Mathematica knowledge: be familiar with the language, its syntax, and the ways you can look for help" -- from the link). There is some controversy over where the line should be drawn. I gave a CW answer, just to help and since comments are not supposed to be answers. This is not meant to criticize the question per se, but to explain why I think it should be marked "on hold." –  Michael E2 Feb 15 at 17:36
    
As you said, it all depends what you consider "be familiar with the language,it's syntax". I'm no expert in Mathematica,i usually know enought to get the job done most of the times. I probably don't know enough about the inner workings of mathematica syntax, but i saw here plenty of other questions that i thought were easy or already answered so, again, it depends what you consider off-topic. You can't expect an user to know all the mathematica functions before asking questions but if there is a list of basic functions that should be known before posting i'll be happy to read it :) . –  lorenz Feb 15 at 18:05
    
Opinions will probably vary, but to me that an expression consists of a Head and Parts is basic. I wasn't thinking in terms of basic functions but of the language. If you're interested, there's Language Overview; its linked guide to Expressions is relevant here, too. (On the front page of the documentation center, they're under "Core Language".) –  Michael E2 Feb 15 at 21:06

1 Answer 1

up vote 1 down vote accepted

If sol = DSolve[..] returns the input, then Head[sol] === DSolve will be True (otherwise, sol would be a list of Rule).

For more explanation, this elementary aspect of Mathematica is covered in the tutorials ExpressionsOverview. The test === is covered in SameQ.

share|improve this answer
    
Thanks, i knew there had to be a function, but i couldn't find it. –  lorenz Feb 15 at 17:39

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