215 Reputation

9 Badges

15 years, 320 days
PhD in Numerical Optimization.

MaplePrimes Activity

These are questions asked by Konstantin@

Maple easily solves multi-points problems for an ODE, if the equation can be integrated analytically.

For example, the following 3-points problem  is solvable:

dsolve([diff(y(x), x$3)+diff(y(x), x$2)+y(x)=1, y(0)=0, y(1)=0, y(2)=1], [y(x)]);

But a similar problem cannot be solved numerically.

For example,

dsolve([diff(y(x), x$3)+diff(y(x), x$2)+y(x)=1, y(0)=0, y(1)=0, y(2)=1], [y(x)], type = numeric, 'output' = Array([seq(k/5, k=0..5)]));

generates: Error, (in dsolve/numeric/process_input) boundary conditions specified at too many points: {0, 1, 2}, can only solve two-point boundary value problems

I need to solve a certain number of multi-points problems for ODE systems numerically. Maybe, for this there are some workaround?

Dear friends,

I have to solve the BVP of the following type:

(x-1)*y''(x)+y'(x)=1+x, y(0)=1, y(1)=1

Expressing the highest derivative (y''(x)), we get a singularity at x=1.

So, as recommended, the method bvp[middefer] (or bvp[midrich]) is used:

dsolve({(x-1)*diff(y(x), x$2)+diff(y(x),x) = 1+x, y(0)=0, y(1)=1}, type = numeric, method = bvp[middefer], y(x), 'output' = Array([seq(k/10, k=0..10)]), 'abserr'=1.0e-3, 'maxmesh'=100)

Maple generates the following error:

Error, (in dsolve/numeric/bvp) unable to achieve requested accuracy of 0.10e-2 with maximum 100 point mesh (was able to get 0.82e3), consider increasing `maxmesh` or using larger `abserr`
But as I increase maxmesh, the achievable accuracy (reported in "(was able to get XXX)") decreases:


maxmesh = 200: 0.19e4

maxmesh = 500: 0.54e4

maxmesh = 1000: 0.12e5

maxmesh = 5000: 0.73e5

and so on.....

How to solve this equation with desirable accurancy and usage of Array as output?

Hi, friends

I need to calculate the double integral over a non-rectangular domain.

Say, the domain is the triangle (in red)

When I enter

int(int((x^2+y^2)*`if`((y-x-1/2 <= 0) and (y+2*x-2<=0) and (y+x/2-1/2>=0), 1, 0), x=0..1, numeric = true), y=0..1, numeric = true);


int(int((x^2+y^2)*eval(`if`((y-x-1/2 <= 0) and (y+2*x-2<=0) and (y+x/2-1/2>=0), 1, 0)), x=0..1, numeric = true), y=0..1, numeric = true);

an error occur (Error, (in int) cannot determine if this expression is true or false: y-x <= 1/2 and y+2*x <= 2 and 0 <= y+(1/2)*x-1/2)

For me, it is desirable to write boundary conditions in the int operator itself, not as a separate expession.


Dear friend,

please suggest a way for manipulation of derivative of a function symbolically. Assume

Ex1 :=expand(diff(f(x+y)+x*f(x-y), x)^2)+expand(diff(f(x-y)-y*f(x+y), x)^2);

Result is as needed:

Ex1 := (D(f))(x+y)^2+2*(D(f))(x+y)*f(x-y)+2*(D(f))(x+y)*x*(D(f))(x-y)+f(x-y)^2+2*f(x-y)*x*(D(f))(x-y)+x^2*(D(f))(x-y)^2+(D(f))(x-y)^2-2*(D(f))(x-y)*y*(D(f))(x+y)+y^2*(D(f))(x+y)^2

But later I cannot use D(f) as a function. Expressions

subs((D(f)) = (t -> 1-t), Ex1);
subs(diff(f(x),x) = (t -> 1-t), Ex1);

do not handle it as a function.

I recently encontered a very strange result.

Lets define the procedure:

Fg := proc(x0,y0)
if (x0>=0)and(x0<=3) and (y0<=x0+2) and (y0>=x0-1) and (y0>=0) and (y0 <=3) then
return y0*(3-y0)*x0*(3-x0)*(x0+2-y0)*(y0-x0+1);
return 0;
end if:
end proc:

The plot looks like needed:

plot3d('Fg'(x,y), x=0..3, y=0..3);

But integration returns weird result:

evalf(Int('Fg'(x,y), [x=0..1, y=0..2.1]));


evalf(Int('Fg'(x,y), [x=0..1, y=0..2.2]));

Error, (in evalf/int) when calling 'Fg'. Received: 'cannot determine if this expression is true or false: 0 <= x and x <= 3 and y <= x+2 and x-1 <= y and 0 <= y and y <= 3'

1 2 3 4 5 6 Page 2 of 6