## 13416 Reputation

19 years, 91 days

## We still have no Maple 14...

After receiving your answer I thought that a fairly big customer like my university would receive Maple 14 more or less right away.

Instead the response from your UK representative (Adeptscience) was that if she could find time maybe we would get Maple 14 in 1 or 2 weeks.

However, we still have not received anything, and I'm not talking about tangibles like DVDs or manuals.

Preben Alsholm

## Undefined is OK...

Since plot and plot3d are not disturbed by undefined results there is no need for defining k for all values in the square [-1,1]x[-1,1].

With a definition of zero for points below the x-axis the plot is different and maybe not as intended.

Another minor comment. The two if- statements can be made into one by the use of 'elif' :

k := proc (x, y) if -1 <= x and x <= 0 and -1 <= y and y <= 0 then x^2+y^2 elif 0 <= x and x <= 1 and 0 <= y and y <= 1 then 3*x*y  end if end proc;
plot3d(k,  -1 .. 1,  -1 .. 1,axes=boxed);

And finally the answer to the original question: What is wrong with plot3d( k, x= -1..1,y=-1..1) is the same that is wrong with plot(sin, x = 0..2*Pi);

k and sin are procedures. So you have the choice between the variable free version plot(sin, 0..2*Pi) and the version plot(sin(x),x=0..2*Pi)

In your case you need unevaluation quotes around k(x,y), since your procedure doesn't handle symbolic input:

plot3d('k(x,y)', x= -1 .. 1, y= -1 .. 1,axes=boxed);

Preben Alsholm

## Undefined is OK...

Since plot and plot3d are not disturbed by undefined results there is no need for defining k for all values in the square [-1,1]x[-1,1].

With a definition of zero for points below the x-axis the plot is different and maybe not as intended.

Another minor comment. The two if- statements can be made into one by the use of 'elif' :

k := proc (x, y) if -1 <= x and x <= 0 and -1 <= y and y <= 0 then x^2+y^2 elif 0 <= x and x <= 1 and 0 <= y and y <= 1 then 3*x*y  end if end proc;
plot3d(k,  -1 .. 1,  -1 .. 1,axes=boxed);

And finally the answer to the original question: What is wrong with plot3d( k, x= -1..1,y=-1..1) is the same that is wrong with plot(sin, x = 0..2*Pi);

k and sin are procedures. So you have the choice between the variable free version plot(sin, 0..2*Pi) and the version plot(sin(x),x=0..2*Pi)

In your case you need unevaluation quotes around k(x,y), since your procedure doesn't handle symbolic input:

plot3d('k(x,y)', x= -1 .. 1, y= -1 .. 1,axes=boxed);

Preben Alsholm

## Use another letter...

There is nothing wrong with using (e.g.) s[1] and t together. The problem is with t[1] and t, i.e. the same letter 't' used in both names.

If you like the indexed name to resemble 't', you could use T[1] or tt[1], or whatever you like, just not t[1].

Preben Alsholm

## Use another letter...

There is nothing wrong with using (e.g.) s[1] and t together. The problem is with t[1] and t, i.e. the same letter 't' used in both names.

If you like the indexed name to resemble 't', you could use T[1] or tt[1], or whatever you like, just not t[1].

Preben Alsholm

## In Maple 14, I presume? ...

In Maple 13.02:

F:= c -> evalf(Int(3*c*x^2 + c^2*x, x = 0 .. 1)):
Optimization:-NLPSolve(F);

Error, (in Optimization:-NLPSolve) complex value encountered

Preben Alsholm

## In Maple 14, I presume? ...

In Maple 13.02:

F:= c -> evalf(Int(3*c*x^2 + c^2*x, x = 0 .. 1)):
Optimization:-NLPSolve(F);

Error, (in Optimization:-NLPSolve) complex value encountered

Preben Alsholm

## Yes!...

Yes, the straightforward solve gave the warning (Maple 13.02).

Preben Alsholm

## Yes!...

Yes, the straightforward solve gave the warning (Maple 13.02).

Preben Alsholm

## Elite Maintenance Plan?...

Is "Extended Maintenance Program" equivalent in this regard to  "Elite Maintenance Plan"?

```My university has received the following message from
"We are working with MapleSoft to make sure that Elite Maintenance Plan customers, like yourselves are sent the new version by the end of May. This will be provided as a download link with new purchase codes unless you have a Site licence, in which case you will also receive physical product. This will take longer to arrive."       Preben Alsholm ```

## Faster yes...

Thank you, indeed it does seem to be more efficient.

I tried in the previous simple example to compute the solution at t = 1 for 10000 values of (A, x0). The ratio between the times spent was roughly 3/1.
The actual test is below.

Preben Alsholm

restart;
ode := diff(x(t),t)=x(t)*(A-x(t)):
ic := x(0)=x0:
ivp:=unapply({ode,ic},A,x0):
sol := (A,x0)->dsolve( ivp(A,x0), numeric):
t0:=time():
for k from 1 to 100 do
for j from 1 to 100 do
sol(k,j)(1)
end do
end do:
time()-t0;
30.389
restart;
ode := diff(x(t),t)=x(t)*(A-x(t)):
ic := x(0)=x0:
sol := dsolve( {ode,ic}, numeric,parameters=[A,x0]):
t0:=time():
for k from 1 to 100 do
for j from 1 to 100 do
sol(parameters=[A=k,x0=j]);
sol(1)
end do
end do:
time()-t0;
8.783

## Why is it useful?...

I still haven't seen any need for using the parameters version of dsolve/numeric.

What is wrong with the following?

restart;
ode := diff(x(t),t)=x(t)*(A-x(t)):
ic := x(0)=x0:
ivp:=unapply({ode,ic},A,x0);
sol := (A,x0)->dsolve( ivp(A,x0), numeric):
sol(2,1);

Preben Alsholm

When using sum, test[1,j] is evaluated at the indices [1,j] with j being the symbol j, therefore the error message.

You are better off using add, but if you do use sum, then put apostrophes around test[1,j] to ensure that the evaluation taking place before sum just consists in removing the apostrophes.

test:=Matrix([[1,2,3],[4,5,6],[9,8,7]]);
sum('test[1,j]',j=1..3);

Preben Alsholm

When using sum, test[1,j] is evaluated at the indices [1,j] with j being the symbol j, therefore the error message.

You are better off using add, but if you do use sum, then put apostrophes around test[1,j] to ensure that the evaluation taking place before sum just consists in removing the apostrophes.

test:=Matrix([[1,2,3],[4,5,6],[9,8,7]]);
sum('test[1,j]',j=1..3);

Preben Alsholm

## Without actually seeing the...

Without actually seeing the system I don't have any other suggestions than the following.

Introduce g1 and g2 as new unknowns, so that the integration of f1 and f2 are done by dsolve directly.

restart;
sys:=diff(f1(t),t)=piecewise(t<=4,3*exp(-2*t),-1),diff(f2(t),t)=sin(t),diff(g1(t),t)=f1(t),diff(g2(t),t)=f2(t);
init:= f1(0)=1, f2(0)=1,g1(0)=0,g2(0)=0:
F:=dsolve({sys,init}, {f1(t), f2(t),g1(t),g2(t)}, numeric,output=listprocedure);
F1,F2,G1,G2:=op(subs(F,[f1(t),f2(t),g1(t),g2(t)]));
G2(5.5)/G1(5.5);