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 would work in Maple 12.  You must be using an earlier version of Maple.  Try this:

> ode := {diff(y(t), t) = -3*y(t), y(0) = 2};
  soln := dsolve(ode, y(t), numeric, method = classical[foreuler], stepsize = .2);
  soln(0.2);
  plots[odeplot](soln,[t,y(t)],0 .. 5, numpoints = 25, style=point);

Note that I used the numpoints option here, otherwise odeplot would in effect use a smaller step size to get a smoother curve.

Here's how I might do it.

with(plots):
ode:= diff(y(t),t) = A*y(t) + a*sin(w*t);
ics:= y(0)=1;
yexa:= unapply(rhs(dsolve({eval(ode,{A=I,a=50,w=100}), ics}, y(t))), t);
complexplot(yexa, 0 .. 2*Pi, numpoints = 1000, scaling=constrained);

 

Here's how I might do it.

with(plots):
ode:= diff(y(t),t) = A*y(t) + a*sin(w*t);
ics:= y(0)=1;
yexa:= unapply(rhs(dsolve({eval(ode,{A=I,a=50,w=100}), ics}, y(t))), t);
complexplot(yexa, 0 .. 2*Pi, numpoints = 1000, scaling=constrained);

 

You're using the delay-evaluation quote ' rather than the name-making back-quote `.  Change that, and you can get your F[1] in textplot.  Of course you could get the same effect with

> textplot([1,2,F[1]]);

 

But nether of these work in a 3d plot.

You're using the delay-evaluation quote ' rather than the name-making back-quote `.  Change that, and you can get your F[1] in textplot.  Of course you could get the same effect with

> textplot([1,2,F[1]]);

 

But nether of these work in a 3d plot.

> subs(1 .. 20 = 180 .. 360, 1 .. 40 = -50 .. 50, matrixplot(...));
> subs(1 .. 20 = 180 .. 360, 1 .. 40 = -50 .. 50, matrixplot(...));

The random variable counts the number of heads.  A fraction .445 of N tosses would be heads if the number of heads was .445 * N.

The random variable counts the number of heads.  A fraction .445 of N tosses would be heads if the number of heads was .445 * N.

I assume you mean either odeplot or DEplot.

I assume you mean either odeplot or DEplot.

Rather than editing html or XML, I just looked at the web page (with numbers of births) in my browser (Firefox), chose "Select All" and "Copy", and pasted into Notepad.
In Notepad, I used Replace... to remove all the commas.  I removed a few lines at the top and bottom, leaving the table, and saved the file as a text file.  Then I read it in to Maple with

> A:=op(fscanf("names.txt","%{1000,5}am"));

the result being a 1000 x 5 Matrix, of which the first, third and fifth columns are integers and the second and fourth are names

It might be a bit more complicated if the baby names included spaces or punctuation, or such names as Digits that have values in Maple.

 

If the integral in question is something like

F(z) = Int(f(t),t = a .. z)

Doug's method will amount to the differential equation/initial value problem

{f(g(t))*diff(g(t),t) = 1, g(0)=a}

But typically dsolve won't be able to solve this except in an implicit form, which just amounts to  F(g(t)) = t.  If the integral can't be done in closed form, there's not much hope for a closed form of the inverse.  However, you could use a numerical solution.

For example:

> F:= unapply(int(cos(x+x^3),x=0..z), z);

Find the interval around 0 on which it is increasing:

 > diff(F(z),z);

cos(z+z^3)

> z0 := fsolve(z + z^3 = Pi/2); x0 := F(z0);

z0 := .8827995948

x0 := .6574763482

So F is monotone on [-z0, z0], with an inverse defined on [-x0, x0].

> de:= diff(F(g(t)),t) = 1; 

de := diff(g(t),t)*cos(g(t)+g(t)^3) = 1

> S := dsolve({de, g(0)= 0}, numeric);

> plots[odeplot](S, [t,g(t)], t=-x0..x0);

 

Note that near the endpoints (where g' goes to infinity), this plot is not as nice as the parametric plot

> plot([F(z), z, z = -z0 .. z0]);

 

If the integral in question is something like

F(z) = Int(f(t),t = a .. z)

Doug's method will amount to the differential equation/initial value problem

{f(g(t))*diff(g(t),t) = 1, g(0)=a}

But typically dsolve won't be able to solve this except in an implicit form, which just amounts to  F(g(t)) = t.  If the integral can't be done in closed form, there's not much hope for a closed form of the inverse.  However, you could use a numerical solution.

For example:

> F:= unapply(int(cos(x+x^3),x=0..z), z);

Find the interval around 0 on which it is increasing:

 > diff(F(z),z);

cos(z+z^3)

> z0 := fsolve(z + z^3 = Pi/2); x0 := F(z0);

z0 := .8827995948

x0 := .6574763482

So F is monotone on [-z0, z0], with an inverse defined on [-x0, x0].

> de:= diff(F(g(t)),t) = 1; 

de := diff(g(t),t)*cos(g(t)+g(t)^3) = 1

> S := dsolve({de, g(0)= 0}, numeric);

> plots[odeplot](S, [t,g(t)], t=-x0..x0);

 

Note that near the endpoints (where g' goes to infinity), this plot is not as nice as the parametric plot

> plot([F(z), z, z = -z0 .. z0]);

 

I guess you're using an earlier version of Maple: in Maple 12 it would work, but in some earlier versions PDEtools is still a table-based package.  So:

> PDEtools[declare](u(x));

 

 

First 106 107 108 109 110 111 112 Last Page 108 of 187