Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

Assuming that column separators consist of exactly five spaces as stipulated—the OP's example violates this—then we may use StringSplit(), as in:

restart;
A:=Array():
k:=1:
fid:=fopen("/tmp/data", READ):
line := readline(fid):
while line <>0 do
          L := StringTools:-StringSplit(line, "     ");
          A(k):= [ L[1], parse(L[2]), parse(L[3]) ];
          line:=readline(fid);
          k:=k+1;
od:
fclose(fid);
M:= Matrix(k-1,3, (i,j) -> A[i][j] );

which yields:

                            Mgreen beans5012potatoes2015red peppers1010tomatoes55

 

 

 

I haven't examined the details of your calculations, but I am alarmed by any numeric calculation that involves numbers such as 10^27 and 10^(-11).

In solving differential equations numerically, we have to be acutely aware of discretization and floating point truncation errors that are naturally associated with such procedures.  It's very easy to obtain nonsensical results if you ignore these.

How do we avoid such pitfalls?  Rule number 1 is that you should use appropriate units.  The meter is a horribly bad unit for expressing distances between planets.  In modeling the Solar System, a good unit of length is the Astronomical Unit (AU) which is the average distance between the Earth and the Sun.  One AU is approximately 1.5x10^11 meters.  When you express the differential equation of motion the planets in terms of AU units, the distances will be smallish numbers which will be treated much more kindly under discretization and floating point truncations of the numerical solver.

While you are at it, you should also choose appropriate units for mass and time.  A kilogram is a good unit if you want to weigh a bag of potatoes.  It's a totally wrong unit if you want to express the mass of a planet.  For the time unit choose the length of a typical orbital period which would be of the order of a year, rather than a second.

Having selected the units of length, mass, and time, convert the gravitational constant G into those units.  If all is well, G will be a moderate-sized number rather than something like 6x10^(-11).

You should worry about Maple only after you are done with these preliminary preparations.

 

You don't need Maple for such a trivial problem.  Just solve the equation by hand and see what the solution looks like.

@acer After you have calculated A and B, you may obtain the plot immediately through:

plot([solve(ee,T), x, x=A..B]);

No need to call plottools:-reflect.

 

@Ronan ...let's see how his blog develops.

@Vaporwave thank you very much for your help.  The page you have found is exactly what I was looking for.  I wish MaplePrime's web tools worked more intelligently.

@Ronan It was a false alarm.  What I had was correct.  I have posted a new version which exapnds some of the comments imbedded in the worksheet.

Look up the help page for DEplot in the DEtools package.  It contains several examples.

@leonardofernandez The problem with the file wrong.eps is that all decimal points have been written as "," (comma)..  You can fix it by replacing all occurrences of "," with ".".  I did, and was able to view the graphics.

No one has answered your question because it is not understandable as written.  You should clarify:

  1. Why do you expect evalf(Int(f(y),y=-b..b)) be an integer?
  2. What do you mean by g(sin(y) , cos(y) and exp(y))?
  3. What is the point of the product a*10^354*(b*10^-356)?  Isn't it just a*b/100?

@Thomas Dean Here is how one activates an animation in Maple in general, not specific to this particular example:

  1. Execute the code.
  2. Wait for the animation's initial frame to appear.
  3. Click on the image with the left mouse button.
  4. Wait for the animation toolbar to apprar along the top edge of the worksheet.

See the help page on the topic "animation toolbar" to see what the various buttons do.

@Preben Alsholm Your sol3A is a very nice solution to a rather nasty problem.

@vv You may have obseerved that setting Digits := 40 yields the correct minumm.

Here are three circles.  What do you mean by "calculate the intersection between three circles"?

Aside:  You may have noticed that the equations shown in your post are little pictures of the contents of your Maple worksheet.  Those are not very helpful because I cannot copy and paste them in my worksheet, and certainly I am not motivated enough to type them myself.  In the future, consider inserting the text, not the image, of your equations when asking questions on MaplePrimes.

 

@Kitonum This one does the same thing and is simpler:

A:=[1,1]:  B:=[3,2]:
plot([A,B], color=red, thickness=3, view=[0..4, 0..3], scaling=constrained);

 

First 78 79 80 81 82 83 84 Last Page 80 of 99