Preben Alsholm

MaplePrimes Activity


These are replies submitted by Preben Alsholm

@Lal p is just the length of the interval a..b. The code is written so it can be used for any function h defined on a..b.

The argument  x-floor( (x-a)/p)*p) will lie in the interval a..b for any real x. To be precise it will lie in the half-open interval [a,b).
Try
plot(x-floor( (x-a)/p)*p,x=-4*Pi..4*Pi,scaling=constrained,discont=true);

You may also want to look at the help page for floor:
?floor

@sssMMM To continue where I left off after having defined Fdiff and F1diff I did:

Sysq := ((9/10)*F1(x)*F(x)*F1diff(x)-(3/10)*Fdiff(x)*F1(x)*F1(x)+(3/2)*F1(x))*F(x) = (1/5)*F(x)*delta1(x)-(3/10)*u1(x);
Sysqq := u1(x)*Fdiff(x)+F1(x)*(diff(delta1(x), x))+delta1(x)*F1diff(x)+F(x)*(diff(u1(x), x)) = 0;

sbs1:={diff(u0(x),x)=F1diff(x),diff(delta0(x),x)=Fdiff(x),delta0(x)=F(x),u0(x)=F1(x)};
Fdiff2:=unapply(subs(diff(EQS,x),sbs1,diff(delta0(x),x,x)),x,numeric);
F1diff2:=unapply(subs(diff(EQS,x),sbs1,diff(u0(x),x,x)),x,numeric);

sbs2:={diff(F(x),x)=Fdiff(x),diff(F1(x),x)=F1diff(x),diff(Fdiff(x),x)=Fdiff2(x),diff(F1diff(x),x)=F1diff2(x)};
Sysqdiff:=subs(sbs2,diff(Sysq,x));

sol:=dsolve({Sysqdiff,Sysqq,delta1(0) = 10^(-8), u1(0) = 10^(-8)},numeric,known=[F,F1,Fdiff,F1diff,Fdiff2,F1diff2]);
odeplot(sol,[[x,u1(x)],[x,delta1(x)]],0..10);




@J4James I think that Allan Wittkopf's second reply answers that completely.

What is in that html file you have at the bottom? I cannot access it.

Try again, but this time after a restart.
Thus do

restart;
int(x^2+3*x, x);

@J4James Your headline is "Method of Steps" and the content is "I'm wondering maybe Maple can still handle DDEs with a Proc.".

I fail to understand your question.

############
Do you mean:
How does the procedure (when using procedural input) have to look for a delay differential equation if it is at all available to the user?
As you will understand from Allan Wittkopf's reply the feature is still under development and is so far undocumented.
So I don't know how it is or how it will become.

To make clear what I'm trying to say. Consider a usual ode:
ode:=diff(x(t),t,t)+t*x(t)=0;
sol:=dsolve({ode,x(0)=1,D(x)(0)=0},numeric);
plots:-odeplot(sol,[t,x(t)],0..15);
#Now use procedural input:
p:=proc(n,t,Y,YP)
  YP[1]:=Y[2];
  YP[2]:=-t*Y[1]
end proc;
res:=dsolve(numeric,number=2,procedure=p,start=0,initial=Array([1,0]),procvars=[x(t),diff(x(t),t)]);
plots:-odeplot(res,[t,x(t)],0..15);

So is there an analogue or will there be?
There is no point in me guessing.

@Allan Wittkopf Thanks for the info. Good to hear!

@J4James My version is Maple 18.02.

And sorry for the confusing edits, but it came as a real surprise to me that Maple 18 can handle DDEs.

I shall experiment with this, but I just noticed that it appears to handle time-dependent delays too.

@J4James I didn't see the problem, since I just let Maple 18 do it it as stated.
It replied with [Length of output exceeds limit of 1000000], which didn't disturb me. I proceeded with
plots:-odeplot(res,[t,x(t)],0..100);

which produced the following

This morning somewhat more clear-headed (apparently not much more) I noticed the delay, and as I was pretty sure that dsolve cannot handle DDEs I was sure something was wrong.
I tried your system on my own ddesolve assuming that the history for t=-10..0 is given by the constant values in the ics (tell me if the history should be something else).
The graph produced for x on the same interval was to the eye exactly the same!

Then I tried Maple 17 and I got the same error as reported by you.

Conclusion:
This feature is new in Maple 18.

As far as I know this is not documented. If I'm wrong I should like to know.

Try this simple example:
restart;
ode:=diff(x(t), t)=x(t-1);
infolevel[`dsolve/numeric`]:=1;
res:=dsolve({ode,x(0)=1},numeric);
plots:-odeplot(res,[t,x(t)],t=0..5);
#The assumption made by dsolve/numeric apparently is that the history is given by x(t)=1 for -1<t<=0.


Could you show us what you did with text, please, not images.
I'm confused about your use of x,y,x1,y1 in your vector equation. Which represents x' and y'?

@GPY Your sys_ode should be:


sys_ode:=diff(x(t),t,t)=d2v_x,diff(y(t),t,t)=d2v_y;

Besides that you need to give the radius r, rho, and C_d values, as Kitonum has already pointed out.

The initial conditions for the velocity should be given this way:
D(x)(0)=v0/sqrt(2),D(y)(0)=v0/sqrt(2)

@Kitonum I think that d2v_x is supposed to be diff(x(t),t,t) thus equal to diff(v_x,t) .

This appears to be odes for the flight of a ball shaped object including air resistance proportional to the square of the speed.

@chrtzstn I noticed that you changed the problem. p is gone.

@Chris_45 In my answer the function is assigned to q, so it is available, but q is a piecewise defined function consisting of a lot of cubic polynomials. If you want a single cubic polynomial there is no better way than LeastSquares.

@Kitonum That is nice. The same idea works on integrals:

map(simplify@Int, op(Int(a*u(k)+b*v(k), k=1..n)));

but there we also have

IntegrationTools:-Expand(Int(a*u(k)+b*v(k), k=1..n));

It would be nice with tools for sums similar to the ones in IntegrationTools. The existing SumTools has a very different purpose.


First 127 128 129 130 131 132 133 Last Page 129 of 231