Robert Israel

6577 Reputation

21 Badges

18 years, 217 days
University of British Columbia
Associate Professor Emeritus
North York, Ontario, Canada

MaplePrimes Activity


These are replies submitted by Robert Israel

That 227 indicates that 227 bytes were written to the file.  However, before you look at the file, you should either close the file

> close("D:/Data/Data6/My_File8.txt");

or exit Maple.  The file should look like this:

4.000000 2.500000 1.000000 -0.500000 -2.000000
5.000000 3.500000 2.000000 0.500000 -1.000000
6.000000 4.500000 3.000000 1.500000 0.000000
7.000000 5.500000 4.000000 2.500000 1.000000
8.000000 6.500000 5.000000 3.500000 2.000000

OK, let's try a simpler example.

> eq := x/sqrt((1-t)^2+x^2) + (x-1)/sqrt((1+t)^2 + (x-1)^2);

> S := [solve(eq, x)];

  S := [1/2*(t-1)/t, -1/2*t+1/2]

The <maple> tag seems to be acting up again: that should be

S := [1/2*(t-1)/t, -1/2*t+1/2]

If you or I were doing this by hand, we'd put one term on each side of the equation and square both sides, getting a quadratic in x, and these are the roots of that quadratic.

Consider e.g. the solution x = -1/2*t + 1/2.  If you substitute this in to eq, you get

-(t-1)/sqrt(5*(t-1)^2) - (t+1)/sqrt(5*(t+1)^2)

Now the problem is that sqrt(A^2) can be either A or -A, depending on sign.  This case works out to 0 if -1 < t < 1, but not if t < -1 or t > 1.  Similarly, the solution x = 1/2*(t-1)/t works if t < -1 or t > 1, but not if -1 < t < 1.

OK, let's try a simpler example.

> eq := x/sqrt((1-t)^2+x^2) + (x-1)/sqrt((1+t)^2 + (x-1)^2);

> S := [solve(eq, x)];

  S := [1/2*(t-1)/t, -1/2*t+1/2]

The <maple> tag seems to be acting up again: that should be

S := [1/2*(t-1)/t, -1/2*t+1/2]

If you or I were doing this by hand, we'd put one term on each side of the equation and square both sides, getting a quadratic in x, and these are the roots of that quadratic.

Consider e.g. the solution x = -1/2*t + 1/2.  If you substitute this in to eq, you get

-(t-1)/sqrt(5*(t-1)^2) - (t+1)/sqrt(5*(t+1)^2)

Now the problem is that sqrt(A^2) can be either A or -A, depending on sign.  This case works out to 0 if -1 < t < 1, but not if t < -1 or t > 1.  Similarly, the solution x = 1/2*(t-1)/t works if t < -1 or t > 1, but not if -1 < t < 1.

This comes from the line

 h := igcd(y, `sqrt/primes`);

where `sqrt/primes` is the product of primes from 2 to 149.

Try this:

> `sqrt/primes`:= `sqrt/primes`*151;
   sqrt(151^3);

 

Doug neglected to correct one more error: he didn't have a multiplication sign * after the 0.06.  Unfortunately this is one of the cases where 1D input (which I suspect Doug was using) and 2D input (which I suspect you are using) act differently, as was discussed here a number of times.

Doug neglected to correct one more error: he didn't have a multiplication sign * after the 0.06.  Unfortunately this is one of the cases where 1D input (which I suspect Doug was using) and 2D input (which I suspect you are using) act differently, as was discussed here a number of times.

Where is "inline" documented as an option for map?  The help page only has evalhf and inplace.  Or did you mean inplace? 

Where is "inline" documented as an option for map?  The help page only has evalhf and inplace.  Or did you mean inplace? 

Or slightly simpler

p := (L::evaln) -> map2(cat,L,eval(L));

and similarly in the other versions.

Or slightly simpler

p := (L::evaln) -> map2(cat,L,eval(L));

and similarly in the other versions.

You can tell odeplot what you want to plot against what.  I happened to use

[t,x(t),y(t)]

which gives a 3d plot of t, x and y.  If you want a 2d plot with separate curves for x(t) and y(t), you could use

[[t, x(t)], [t, y(t)]]

Thus:

> display(pointplot(Data[1..N,1..2],symbol=box),
   pointplot(Data[1..N,[1,3]],symbol=circle),
  odeplot(Sol,[[t,x(t)],[t,y(t)]],t=0..5));

 

You can tell odeplot what you want to plot against what.  I happened to use

[t,x(t),y(t)]

which gives a 3d plot of t, x and y.  If you want a 2d plot with separate curves for x(t) and y(t), you could use

[[t, x(t)], [t, y(t)]]

Thus:

> display(pointplot(Data[1..N,1..2],symbol=box),
   pointplot(Data[1..N,[1,3]],symbol=circle),
  odeplot(Sol,[[t,x(t)],[t,y(t)]],t=0..5));

 

You may not be able to edit Maple's own help page, but you can make a copy of it, edit and save the copy to a writable database.  To avoid confusion, you might want to change the topic name slightly.


You may not be able to edit Maple's own help page, but you can make a copy of it, edit and save the copy to a writable database.  To avoid confusion, you might want to change the topic name slightly.


One of the best ways to smoothly connect data points is with a spline curve.  You can get that with Spline in the CurveFitting package.  For example:

> Data := [[0,3],[1,1],[2,4],[3,1],[4,5],[5,9]];
   S := CurveFitting[Spline](Data, t);
   with(plots):
   display([ plot(S, t = 0 .. 5), 
       pointplot(Data)]);

 

First 124 125 126 127 128 129 130 Last Page 126 of 187