A possible solution,
we compare "diffcode_jacobian" and "numderivative". in this case seem to
calculate with the same accuracy
function val = HH(z)
x=z(1);
y=z(2);
val=(1.25*y-sqrt(abs(x))).^2+x.^2-1;
endfunction;
function z=f(x)
z(1,1:2)=diffcode_jacobian(HH,x)
Hi Philippe:
Where this error?
// The function to differentiate
function val = HH(z)
x=z(1);
y=z(2);
val=(1.25*y-sqrt(abs(x))).^2+x.^2-1;
endfunction;
// The exact gradient
function Sys=ge(x)
gx=x(:,1);
gy=x(:,2);
g1=2*gx-(gx.*(1.25*gy-sqrt(abs(gx./abs(gx).^(3/2);
Right, and if one follows the thread till the end, how does that apply to
diffcode_jacobian ?
-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of philippe
Sent: Tuesday, October 10, 2017 8:56 AM
To: users@lists.scilab.org
Subject: Re: [Scilab-users
Hi,
Le 07/10/2017 à 13:05, Hermes a écrit :
> how do I declare the functions to be able to evaluate a matrix
> variable(Multiple evaluation of a function). Where the first column
> corresponds to the first variable of the function. And so on.
> is only possible within a "for" cycle? how to
-Original Message-
From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Hermes
Sent: Saturday, October 07, 2017 8:10 PM
To: users@lists.scilab.org
Subject: Re: [Scilab-users] evaluate matrix in a function
Hello
The H and g functions work. But the diffcode_jacobian (H, r
Hello
The H and g functions work. But the diffcode_jacobian (H, r) evaluation does
not accept the dot operator. Only redefining the H function (without dot
operators) will achieve the results
function val = HH(z)
x=z(1);
y=z(2);
val=(1.25*y-sqrt(abs(x)))^2+x^2-1; // switched *.^* to
...@lists.scilab.org] On Behalf Of Hermes
Sent: Saturday, October 07, 2017 6:44 PM
To: users@lists.scilab.org
Subject: Re: [Scilab-users] evaluate matrix in a function
Hello
The H function works. the other two evaluations I can not solve the problem.
function val = H(z)
x=z(:,1);
y=z(:,2
Hello
The H function works. the other two evaluations I can not solve the problem.
function val = H(z)
x=z(:,1);
y=z(:,2);
val=(1.25*y-sqrt(abs(x))).^2+x.^2-1;
endfunction;
function Sys=g(x)
gx=x(:,1);
gy=x(:,2);
g1=2*gx-(gx *(1.25*gy-sqrt(abs(gx/abs(gx).^(3/2);
Hello
The H function works. the other two evaluations did not solve the problem.
function val = H(z)
x=z(:,1);
y=z(:,2);
val=(1.25*y-sqrt(abs(x))).^2+x.^2-1; // switched ^ to .^ to handle
vectors
endfunction;
function Sys=g(x)
gx=x(:,1);
gy=x(:,2);
g1=2*gx-(gx
Your code has the solution (for the matrix function output).
Do the same for input:
r=[3 1;4 2;3 5;8 2];
function val=H(z)
x=z(:,1);
y=z(:,2);
val=(1.25*y-sqrt(abs(x))).^2 + x.^2 - 1;
endfunction;
Regards,
Rafael
-Original Message-
From: users
10 matches
Mail list logo