[Scilab-users] Queries about vector and complex numbers

Dang, Christophe Christophe.Dang at sidel.com
Mon Jul 7 10:00:14 CEST 2014


Hello, 

> De abhi24394
> Envoyé : vendredi 4 juillet 2014 23:23
>
> i am just asking about the simple problems these are listed below...
> 1.A=2ax+ay+2az and B=ax+2ay+az then Vector A*B=?

[...]

Do you mean you want symbolic calculation, and not numerical?

If it's ust numerical, then define your vectors as column or line matrices, e.g.

A = [2 ; 1 ; 2];

B = [1 ; 2 ; 1];

and define a function

function V = crossproduct(A, B) // in 5.5.0, cross() exist
    V(1) = A(2)*B(3) - A(3)*B(2);
    V(2) = A(3)*B(1) - A(1)*B(3);
    V(3) = A(1)*B(2) - A(2)*B(1);
endfunction

> if A=3xax+yay+5zaz then find curl of yhe vectoe A

something like

function V = A(X)
    V(1) = 3*X(1);
    V(2) = X(2)
    V(3) = 5*X(3)
endfunction

function V = curl(f, X)
    J = numderivative(f, X)
    V(1) = J(3, 2) - J(2, 3);
    V(2) = J(1, 3) - J(3, 1);
    V(3) = J(2, 1) - J(1, 2);
endfunction

you can then use curl(A, X) where X is a given vector.

Mind that these functions do not check anything.

-- 
Christophe Dang Ngoc Chan
Mechanical calculation engineer

______________________________________________________________________

This e-mail may contain confidential and/or privileged information. If you are not the intended recipient (or have received this e-mail in error), please notify the sender immediately and destroy this e-mail. Any unauthorized copying, disclosure or distribution of the material in this e-mail is strictly forbidden.
______________________________________________________________________



More information about the users mailing list