[Scilab-users] evaluate matrix in a function
Rafael Guerra
jrafaelbguerra at hotmail.com
Sat Oct 7 21:48:27 CEST 2017
diffcode_jacobian does not seem to accept multiple input points, but only one N-dimension point X:
// Calling Sequence:
// J = diffcode_jacobian(f,x)
// x : a n-by-1 matrix of doubles, real, the point where to compute the derivatives
You cannot compare g and J, because the former is a function and the latter has type constant.
However you can compare J and V but the answer is false because of tiny numerical difference:
J==V
ans =
T T
T T
F T
T T
J-V
ans =
0. 0.
0. 0.
- 4.441D-16 0.
0. 0.
Rgds,
Rafael
-----Original Message-----
From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Hermes
Sent: Saturday, October 07, 2017 8:10 PM
To: users at 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) 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 *^*
endfunction;
t=[3. 1.]
disp(diffcode_jacobian(HH,t));
-->6.2783122
-1.205127
J=[];
for k=1:size(r,"r")
J(k,:)=diffcode_jacobian(HH,r(k,:));
end
disp(J, "Jacobian");
-->Jacobian
6.2783122 -1.205127
7.75 1.25
3.3915608 11.294873
16.116117 -0.8210678
disp(and(J==g))
-->F Why? The results of J and g look the same !!
g
6.2783122 -1.205127
7.75 1.25
3.3915608 11.294873
16.116117 -0.8210678
J
6.2783122 -1.205127
7.75 1.25
3.3915608 11.294873
16.116117 -0.8210678
Gracias
--
Sent from: http://mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
_______________________________________________
users mailing list
users at lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users
More information about the users
mailing list