Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'mathematica for loop problem' topicStudent Support Forum > General > "mathematica for loop problem"

Next Comment >Help | Reply To Topic
Author Comment/Response
Tapan kumar Baishya
05/07/12 10:15am

For[c = -1, c <= 1, c = c + 0.2, Print[c]]
we should get the value of c as - 1, -0.8, -0.6, -0.4, -0.2, 0, .2,.4, .6, .8, 1
Mathematica actually gives us these values as
-1
-0.8`
-0.6000000000000001`
-0.4000000000000001`
-0.20000000000000007`
-5.551115123125783`*^-17
-0.20000000000000007`
0.39999999999999997`
0.6`
0.8`
so on
instead of - 1, -0.8, -0.6, -0.4, -0.2, 0, .2, .4, .6, .8, 1
How to solve this problem?


URL: ,

Subject (listing for 'mathematica for loop problem')
Author Date Posted
mathematica for loop problem Tapan kumar ... 05/07/12 10:15am
Re: mathematica for loop problem Bill Simpson 05/07/12 2:48pm
Next Comment >Help | Reply To Topic