Konstantin@

215 Reputation

9 Badges

14 years, 166 days
Kharkov, Ukraine
PhD in Numerical Optimization.

MaplePrimes Activity


These are questions asked by Konstantin@

I solve numerically very simple boundary value problem for the following ordinary diff. equation:

-1.2*y''(t)+0.8*y(t)=2,

y(0)=1, y(1)=0.

So := dsolve([-1.2*diff(y(x), x$2)+0.8*y(x) = 2, y(0)=1, y(1)=0], y(x), 'numeric', 'output' = listprocedure);

Solution looks as needed

u := unapply(rhs(So[2])(x), x): plot(u(t), t=0 .. 1);
pic

and can be numerically integrated in usual way:

evalf(int(u(t), t = 0..1));

0.6041717543123311

But integral of u^2(t)  (evalf(int(u(t)^2, t = 0..1))) returns:

pic1

How to avoid this issue?

Cannot calculate derivative (gradient) of a procedure returned by dsolve.

Say, I solve the equation:

S1 := dsolve([diff(y(x), x$2)-1.0325*diff(y(x), x)+1.36*y(x)=sin(2*x), y(0)=0, y(1)=1], numeric, y(x), 'output' = listprocedure);

Its solution easily can be retrieved and looks fine:

H:=rhs(S1[2]); 

plot(H(t), t = 0..1, thickness = 4);

3

But when I try to calculate the gradient of H, I receive the error:

H1 := codegen[GRADIENT](H);

Error, (in intrep/statement) unable to translate Array(1..4, {(1) = proc (outpoint) local X, Y, YP, yout, errproc, L, V, i; option `Copyright (c) 2000 by Waterloo Maple Inc. All rights reserved.`; X := Vector(8, {(1) = .0, (2) = .14817993189456188, (3) = .31785812820433257, (4) = .47163479035679234, (5) = .6130306894371967, (6) = .7460958115245858, (7) = .8741894219027533, (8) = 1.0}, datatype = float[8], order = C_order); Y := Matrix(8, 2, {(1, 1) = .0, (1, 2) = .47692145669848085, (2, 1) = 0.7710429970702501e-1, (2, 2) = .5707930170882397, (3, 1) = .1866916935738028, (3, 2) = .7299040171277492, (4, 1) = .3128649714509215, (4, 2) = .9171936...

Gradient of procedures defined by  ":= proc()" is calculated properly.

I experienced strange operation of "union" for sets of vectors.

Mt1:=Matrix(2, 4, [[ 0,1, 0, 0], [ 0,  0,  1, 1]]); Ms := Vector[column](4, [8,4,2,1]); St1 := {}:

St1:= `union`(St1, {Mt1 . Ms});

I am surprised, because each execution of union adds new and the same vector <4 | 3> to set St1:

1

But after copying any set in the clipboard and pasting the set St1 has only one instance of vector <4 | 3>:

2

What does it mean?

Dear friends,

Recently I was surprised when discovered the following error in using the function solve. If I run the simlest example from the help system for the first time (or after restarting), the following error occurs:

If I run this example repeatedly, this brings the following:

1

Previously in earlier versions I used solve many times for very complex computations and have never seen something similar.

Any suggestions are welcomed.

Hi all

Can anybody suggest an algorithm allowing to detect, that two matrices of the same size can be obtained each from other by permutations of rows and columns? Maybe, such an algorithm there exists in LinearAlgebra package?

1 2 3 4 5 6 Page 5 of 6