1
$\begingroup$

I am solving the following differential equation. I need to get the values of y[x] for x ranging from 1 to 30. I need to get this data into excel. How can I extract it from Mathematica ?

Stefan = 0.6929;
s = NDSolve[{y'[
     x] == (Stefan*((x/2) - (((x^2) - 1)/(4*x*Log[x])))) + (x*Log[x]),
    y[1.00000001] == 0}, y[x], x]
$\endgroup$
  • $\begingroup$ Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour and check the faqs! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. $\endgroup$ – Saurav Dec 12 '15 at 16:00
1
$\begingroup$

All your answers are right there in the documentation:

If you look into the NDSolve help, the first example gives you the correct way of writing the code. For your problem:

Stefan = 0.6929; 
s = NDSolve[{y'[x] == (Stefan*((x/2) - (((x^2) - 1)/(4*x Log[x])))) + (x Log[x]),y[1.00000001] == 0}, y[x], {x, 1, 30}];

You can form the data list using the command Table:

val = Table[Evaluate[y[x] /. s], {x, 1, 30}]

You can export the data to excel using the command Export:

Export["data.xls", val]
$\endgroup$
  • $\begingroup$ @Shaunak. Get very friendly with the Mathematica documentation, as suggested in this answer! $\endgroup$ – march Dec 10 '15 at 20:12
  • $\begingroup$ Yes I just checked the documentation ! Thank you very much Saurav and march. $\endgroup$ – Shaunak Dec 12 '15 at 2:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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