0
$\begingroup$

due to this command "For i from X to XX do x*y end do ", I need to make a list of numbers. Since "x" and "y" are so large maple gives me the list of numbers in scientific format. But I need to get them in decimal form. how can I get them in decimal? after running the program, I have used "numeric formatting". Although In maple this causes that the numbers are displayed in decimal but I when I want to make a copy and paste them in Notepad, surprisingly, the decimal form return to scientific form again. how can I get rid of this trouble. I appreciate anyone who help me in this way. Thank you again.

$\endgroup$
1
  • $\begingroup$ Sorry friends I forgot to say the right command is "For i from X to XX do evalf(x*y) end do ". in fact I think the problem comes from "evalf". It is the reason of displayment the number in scientific format. $\endgroup$
    – Mohammad
    Apr 18, 2016 at 16:31

1 Answer 1

0
$\begingroup$

It would be better if you gave us at least one concrete example with an actual number.

Would either of S or P below suffice, which you could wrap around your individual scalar results from evalf?

restart;
y := 4/17 * 10^(-6):

for x from 1 to 7 do evalf(x*y) end do; # what you don't want?

                                -7
                  2.352941176 10  
                                -7
                  4.705882353 10  
                                -7
                  7.058823529 10  
                                -7
                  9.411764706 10  
                  0.000001176470588
                  0.000001411764706
                  0.000001647058824

P:=X->printf( cat("%",
                  sprintf("%d.%d",
                          abs(op(2,X)),abs(op(2,X))),"f\n"),
              X):

for x from 1 to 7 do P(evalf(x*y)) end do;

0.0000002352941176
0.0000004705882353
0.0000007058823529
0.0000009411764706
0.000001176470588
0.000001411764706
0.000001647058824

S:=X->nprintf( cat("%",
                   sprintf("%d.%d",
                           abs(op(2,X)),abs(op(2,X))),"f"),
               X):

for x from 1 to 7 do S(evalf(x*y)) end do;

                 0.0000002352941176
                 0.0000004705882353
                 0.0000007058823529
                 0.0000009411764706
                  0.000001176470588
                  0.000001411764706
                  0.000001647058824

restart;

y := 4/17 * 10^(6):

for x from 1 to 7 do evalf(x*y) end do; # what you don't want?

                                 5
                   2.352941176 10 
                                 5
                  4.705882353 10 
                                 5
                   7.058823529 10 
                                 5
                   9.411764706 10 
                                 6
                   1.176470588 10 
                                 6
                   1.411764706 10 
                                 6
                   1.647058824 10 

P:=X->printf( cat("%",
                  sprintf("%d.%d",
                          abs(op(2,X)),abs(op(2,X))),"f\n"),
              X):

for x from 1 to 7 do P(evalf(x*y)) end do;

235294.1176
470588.2353
705882.3529
941176.4706
1176470.588
1411764.706
1647058.824

S:=X->nprintf( cat("%",
                   sprintf("%d.%d",
                           abs(op(2,X)),abs(op(2,X))),"f"),
               X):

for x from 1 to 7 do S(evalf(x*y)) end do;

                     235294.1176
                     470588.2353
                     705882.3529
                     941176.4706
                     1176470.588
                     1411764.706
                     1647058.824
$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .