Re: [Scilab-users] function and vectorization

2018-11-07 Thread CRETE Denis
Hello,

If your matrices are not too big,

diag((M-C)*(N(:,1:2)-C)')
may do the job: it gives the same result as Stéphane's solution
HTH
Denis


[@@ THALES GROUP INTERNAL @@]

Unité Mixte de Physique CNRS / THALES
1 Avenue Augustin Fresnel
91767 Palaiseau CEDEx - France
Tel : +33 (0)1 69 41 58 52 Fax : +33 (0)1 69 41 58 78
e-mail :
 denis.cr...@thalesgroup.com<mailto:denis.cr...@thalesgroup.com> 
<mailto:%20denis.cr...@thalesgroup.com>
http://www.trt.thalesgroup.com/ump-cnrs-thales
http://www.research.thalesgroup.com

De : users [mailto:users-boun...@lists.scilab.org] De la part de Stéphane 
Mottelet
Envoyé : mercredi 7 novembre 2018 13:40
À : users@lists.scilab.org
Objet : Re: [Scilab-users] function and vectorization

Hello,

Try:

function [Scar_P]=Scalar_product(C, N, M) // Scalar product



Scar_P = (M(:,1) - C(:,1)).*(N(:,1) - C(:,1)) + (M(:,2) - C(:,2)).*(N(:,2) 
- C(:,2));



//printf("C = (%g,%g)\n",C(1),C(2)); printf("N = (%g,%g)\n",N(1),N(2)); 
printf("M = (%g,%g)\n",M(1),M(2));



endfunction



with (do not transpose N(i,1:2))
i = 1 : n;
Scal(i) = Scalar_product(C(i,:),N(i,1:2),M(i,:))

S.

Le 07/11/2018 à 12:35, Carrico, Paul a écrit :

#
mode(0)
clear

function [Scar_P]=Scalar_product(C, N, M) // Scalar product
Scar_P = (M(1) - C(1))*(N(1) - C(1)) + (M(2) - C(2))*(N(2) - C(2));
printf("C = (%g,%g)\n",C(1),C(2)); printf("N = (%g,%g)\n",N(1),N(2)); 
printf("M = (%g,%g)\n",M(1),M(2));
endfunction

n = 10;

C = rand(n,2);
M = rand(n,2);
N = rand(n,5);

Scal = zeros(n); Scal2 = Scal

printf(" \n");
i = 1 : n;
Scal(i) = Scalar_product(C(i,:),N(i,1:2)',M(i,:))

printf("\n \n");

for i = 1 : n
Scal2(i) = Scalar_product(C(i,:),N(i,1:2)',M(i,:));
end



--

Stéphane Mottelet

Ingénieur de recherche

EA 4297 Transformations Intégrées de la Matière Renouvelable

Département Génie des Procédés Industriels

Sorbonne Universités - Université de Technologie de Compiègne

CS 60319, 60203 Compiègne cedex

Tel : +33(0)344234688

http://www.utc.fr/~mottelet
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] function and vectorization

2018-11-07 Thread Stéphane Mottelet

Hello,

Try:

function  [Scar_P]=Scalar_product(C, N, M)  // Scalar product

Scar_P  =  (M(:,1)  -  C(:,1)).*(N(:,1)  -  C(:,1))  +  (M(:,2)  -  
C(:,2)).*(N(:,2)  -  C(:,2));

//printf("C = (%g,%g)\n",C(1),C(2)); printf("N = (%g,%g)\n",N(1),N(2)); 
printf("M = (%g,%g)\n",M(1),M(2));


endfunction with (do not transpose N(i,1:2))

i= 1 : n;

Scal(i)= _Scalar_product_(C(i,:),N(i,1:2),M(i,:))


S.

Le 07/11/2018 à 12:35, Carrico, Paul a écrit :


#

mode(0)

clear

function[*Scar_P*]=_Scalar_product_(*C*, *N*, *M*) /// Scalar product/

*Scar_P* = (*M*(1) - *C*(1))*(*N*(1) - *C*(1)) + (*M*(2) - 
*C*(2))*(*N*(2) - *C*(2));


printf("C = (%g,%g)\n",*C*(1),*C*(2)); printf("N = 
(%g,%g)\n",*N*(1),*N*(2)); printf("M = (%g,%g)\n",*M*(1),*M*(2));


endfunction

n= 10;

C= rand(n,2);

M= rand(n,2);

N= rand(n,5);

Scal= zeros(n); Scal2 = Scal

printf(" \n");

i= 1 : n;

Scal(i)= _Scalar_product_(C(i,:),N(i,1:2)',M(i,:))

printf("\n \n");

fori = 1 : n

Scal2(i) = _Scalar_product_(C(i,:),N(i,1:2)',M(i,:));

end



--
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] function and vectorization

2018-11-07 Thread Carrico, Paul
Dear All

Most of the time I've no issue in mixing functions and vectorization, but here 
I don't know why it does not work - one can see that using a vector I, the loop 
is called only ounce and I do not understand why?

I've spent hours in such case  showing I'm not fully at ease with it :-) :-)

Any explanation?

Thanks for your support

Paul

#
mode(0)
clear

function [Scar_P]=Scalar_product(C, N, M) // Scalar product
Scar_P = (M(1) - C(1))*(N(1) - C(1)) + (M(2) - C(2))*(N(2) - C(2));
printf("C = (%g,%g)\n",C(1),C(2)); printf("N = (%g,%g)\n",N(1),N(2)); 
printf("M = (%g,%g)\n",M(1),M(2));
endfunction

n = 10;

C = rand(n,2);
M = rand(n,2);
N = rand(n,5);

Scal = zeros(n); Scal2 = Scal

printf(" \n");
i = 1 : n;
Scal(i) = Scalar_product(C(i,:),N(i,1:2)',M(i,:))

printf("\n \n");

for i = 1 : n
Scal2(i) = Scalar_product(C(i,:),N(i,1:2)',M(i,:));
end

EXPORT CONTROL :
Cet email ne contient pas de données techniques
This email does not contain technical data

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function "locate" for 3d graphs

2018-07-20 Thread Samuel Gougeon

Le 20/07/2018 à 12:20, Izabela Wójcik-Grząba a écrit :
As Samuel GOUGEON suggested I reported a wish to upgrede function 
locate for 3d graphs on Bugzilla:


https://bugzilla.scilab.org/show_bug.cgi?id=15674


This could be implemented for Scilab 6.1 after the commit fixing 
locate() in 2D, pending for 80 days still without review is validated, 
integrated in Scilab 6.0.2, and transfered to Scilab 6.1.



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function "locate" for 3d graphs

2018-07-20 Thread Izabela Wójcik-Grząba
As Samuel GOUGEON suggested I reported a wish to upgrede function locate 
for 3d graphs on Bugzilla:


https://bugzilla.scilab.org/show_bug.cgi?id=15674

Iza
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function "locate" for 3d graphs

2018-07-19 Thread Izabela Wójcik-Grząba

Hi Rafael,

Thank you very much. This code is great, but I don't know how to use 
datatipManagerMode when my param3d plot is in the frame inside the 
graphic window. It seems that it's not working in such situation.


Regards,
Iza
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function "locate" for 3d graphs

2018-06-17 Thread Rafael Guerra
Hi Iza,


Not sure if this is what you need but I wrote the following code you can try on:


// START OF CODE
//From param3d datatips to data vector
clear
clf
param3d()
datatipManagerMode(gcf())
// Edit --> Start Datatip manager --> Stop Datatip manager
input("ENTER to continue after stopping datatips","string")
e = gce()
n = size(e.datatips,1);
x = zeros(n,3);
for i=1:n
x(i,:) = e.datatips(i).data;
end
// END OF CODE


Regards,

Rafael
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function "locate" for 3d graphs

2018-06-15 Thread Samuel Gougeon

Hello Izabela,

locate() is being fixed against 3 bugs in 2D @ 
https://codereview.scilab.org/#/c/20018/
But beyond this, you are right, it could deserve to be upgraded in order 
to become

usable in 3D.
Please do not hesitate to post a report for this wish, on bugzilla.

The interactive java curve editor is already able to edit 3D curves:
param3d() + right-click on the curve and edit its points.

But locate() and xchange() presently work only in 2D.

Regards
Samuel

Le 14/06/2018 à 13:28, Izabela Wójcik-Grząba a écrit :

Hello,

I've got another question. Is there a function like "locate" but 
appropriate for param3d plot. I would like to pick some points from my 
param3d plot.


Regards,
Iza
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function "locate" for 3d graphs

2018-06-15 Thread Stéphane Mottelet
Hello,

Your 3D graphics is projected on 2D. How could you get points in 3D ?

S.

> Le 15 juin 2018 à 04:12, André FS  a écrit :
> 
> Hi Iza,
> 
> What if you use the linear_interpn [1]?
> 
> [1] https://help.scilab.org/doc/5.3.3/en_US/linear_interpn.html
> 
> Regards,
> 
> André
> 
>> Em qui, 14 de jun de 2018 às 08:30, Izabela Wójcik-Grząba 
>>  escreveu:
>> Hello,
>> 
>> I've got another question. Is there a function like "locate" but 
>> appropriate for param3d plot. I would like to pick some points from my 
>> param3d plot.
>> 
>> Regards,
>> Iza
>> ___
>> users mailing list
>> users@lists.scilab.org
>> http://lists.scilab.org/mailman/listinfo/users
> ___
> users mailing list
> users@lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function "locate" for 3d graphs

2018-06-14 Thread André FS
Hi Iza,

What if you use the linear_interpn [1]?

[1] https://help.scilab.org/doc/5.3.3/en_US/linear_interpn.html

Regards,

André

Em qui, 14 de jun de 2018 às 08:30, Izabela Wójcik-Grząba 
escreveu:

> Hello,
>
> I've got another question. Is there a function like "locate" but
> appropriate for param3d plot. I would like to pick some points from my
> param3d plot.
>
> Regards,
> Iza
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Function "locate" for 3d graphs

2018-06-14 Thread Izabela Wójcik-Grząba

Hello,

I've got another question. Is there a function like "locate" but 
appropriate for param3d plot. I would like to pick some points from my 
param3d plot.


Regards,
Iza
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function to read Excel xlsx file into SCILAB

2018-03-16 Thread Samuel Gougeon

Hello Samuel,

https://atoms.scilab.org/toolboxes/xls_link is the module likely the 
most fitting to your need.


There is no indication in the description about the support to .xlsx.
But if you did not do it yet, you may try using it.

Best regards
Samuel Gougeon

Le 13/03/2018 à 18:18, Samuel Enibe a écrit :

Dear SCILAB users,

is there a direct function available in SCILAB to read an Excel .xlsx 
file (Excel 2007 or later) into SCILAB.


I know I could open it in Excel and use the SaveAs menu to first 
convert it to .xls file, but a direct SCILAB function would be faster 
when handling many files.


Thank you very much.

God bless you.

Samuel  Enibe
University of Nigeria, Nsukka, Nigeria



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Hello Samuel

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function to read Excel xlsx file into SCILAB

2018-03-13 Thread Rafael Guerra
I am not aware of such direct function.

A trick that I find quite useful is the possibility to copy data from Excel 
directly into Scilab via the Windows clipboard.
See ones example below.

// First copy an Excel data range to clipboard then run Scilab commands:
str = clipboard("paste");
M = evstr(strsplit(str,ascii(10)));

Regards,
Rafael

From: users [mailto:users-boun...@lists.scilab.org] On Behalf Of Samuel Enibe
Sent: Tuesday, March 13, 2018 6:19 PM
To: users@lists.scilab.org
Subject: [Scilab-users] Function to read Excel xlsx file into SCILAB

Dear SCILAB users,

is there a direct function available in SCILAB to read an Excel .xlsx file 
(Excel 2007 or later) into SCILAB.
I know I could open it in Excel and use the SaveAs menu to first convert it to 
.xls file, but a direct SCILAB function would be faster when handling many 
files.
Thank you very much.
God bless you.

Samuel  Enibe
University of Nigeria, Nsukka, Nigeria
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Function to read Excel xlsx file into SCILAB

2018-03-13 Thread Samuel Enibe
Dear SCILAB users,

is there a direct function available in SCILAB to read an Excel .xlsx file
(Excel 2007 or later) into SCILAB.

I know I could open it in Excel and use the SaveAs menu to first convert it
to .xls file, but a direct SCILAB function would be faster when handling
many files.

Thank you very much.

God bless you.

Samuel  Enibe
University of Nigeria, Nsukka, Nigeria
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] function with more result variables, how?

2017-02-13 Thread Erhy
Thank you Samuel!
Erhy



--
View this message in context: 
http://mailinglists.scilab.org/function-with-more-result-variables-how-tp4035470p4035476.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] function with more result variables, how?

2017-02-12 Thread Samuel Gougeon

Le 12/02/2017 à 23:34, Erhy a écrit :

Hello!
I declared a function
e.g.
function [ DifT, FByReal, FR ] = MyXYZ(koeff)
DifT = 33.0; FByReal = [ 1.0 , 55.7 ]; FR = [ 1 2 3; 4 5 6; 7 8 9; 10 -11
-12 ];
endfunction

but only the first result is delivered.

In help:  stands for the output argument list.

How to have more result variables with different type*?*

Thank you
Erhy



I get:
--> function [ DifT, FByReal, FR ] = MyXYZ(koeff)
  > DifT = 33.0;
  > FByReal = [ 1.0 , 55.7 ];
  > FR = [ 1 2 3; 4 5 6; 7 8 9; 10 -11 -12 ];
  > endfunction

--> [a,b,c] = MyXYZ(1)
 c  =
   1.2.3.
   4.5.6.
   7.8.9.
   10.  -11.  -12.

 b  =
   1.   55.7

 a  =
   33.

All is right.

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] function with public variables possible?

2017-02-10 Thread Tim Wescott
Sorry -- just re-read your question and realized what you actually
meant.

I just double-checked this -- if you hit a breakpoint inside a
function, the variable browser shows that functions variables.  Once
you exit the function, the variables that only exist within the
function disappear.

On Fri, 2017-02-10 at 07:48 -0700, Erhy wrote:
> Hello!
> In may first exercises with SCILab functions I was disappointed that
> I cannot see the variables declared and used in the function with
> Variable
> Browser.
> 
> I tried the global statement, but I cannot browse the global
> variables in
> the usual way.
> 
> Is there a way to have all variables public?
> 
> Thank you
> Erhy
> 
> 
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/function
> -with-public-variables-possible-tp4035458.html
> Sent from the Scilab users - Mailing Lists Archives mailing list
> archive at Nabble.com.
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
> 
> 
-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] function with public variables possible?

2017-02-10 Thread Tim Wescott
What exactly do you want?

Are you trying to modify global variables from within a function?

Are you trying to pass values from the function to the outside world?

Are you trying to use (but not modify) global variables from within a
function?

Or do you disagree with the way that the variable browser displays
variables?

On Fri, 2017-02-10 at 07:48 -0700, Erhy wrote:
> Hello!
> In may first exercises with SCILab functions I was disappointed that
> I cannot see the variables declared and used in the function with
> Variable
> Browser.
> 
> I tried the global statement, but I cannot browse the global
> variables in
> the usual way.
> 
> Is there a way to have all variables public?
> 
> Thank you
> Erhy
> 
> 
> 
> 
> 
> --
> View this message in context: http://mailinglists.scilab.org/function
> -with-public-variables-possible-tp4035458.html
> Sent from the Scilab users - Mailing Lists Archives mailing list
> archive at Nabble.com.
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
> 
> 
-- 

Tim Wescott
www.wescottdesign.com
Control & Communications systems, circuit & software design.
Phone: 503.631.7815
Cell:  503.349.8432



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] function with public variables possible?

2017-02-10 Thread Erhy
Hello!
In may first exercises with SCILab functions I was disappointed that
I cannot see the variables declared and used in the function with Variable
Browser.

I tried the global statement, but I cannot browse the global variables in
the usual way.

Is there a way to have all variables public?

Thank you
Erhy





--
View this message in context: 
http://mailinglists.scilab.org/function-with-public-variables-possible-tp4035458.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function int() strange behavior

2016-04-18 Thread ol.bond
Thank you Samuel, I got it also

2016-04-18 15:13 GMT+09:00 Samuel GOUGEON [via Scilab / Xcos - Mailing
Lists Archives] :

> Hello,
>
> Le 18/04/2016 08:03, ol.bond a écrit :
>
> .../...
>
> *but:*
>
> int(1.45/0.025)
>  ans  =
>
> 57.
>
> Can anyone explain what is going on?
>
> .
> --> 1.45/0.025 - 58
>  ans  =
>
>   -7.105D-15
>
> is the round-off error
> SG
>
>
> ___
> users mailing list
> [hidden email] 
> http://lists.scilab.org/mailman/listinfo/users
>
>
> --
> If you reply to this email, your message will be added to the discussion
> below:
>
> http://mailinglists.scilab.org/Function-int-strange-behavior-tp4033993p4033994.html
> To start a new topic under Scilab users - Mailing Lists Archives, email
> ml-node+s994242n2602246...@n3.nabble.com
> To unsubscribe from Scilab users - Mailing Lists Archives, click here
> 
> .
> NAML
> 
>




--
View this message in context: 
http://mailinglists.scilab.org/Function-int-strange-behavior-tp4033993p4033995.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Function int() strange behavior

2016-04-18 Thread ol.bond
Hello,

I have found some weird behavior of int() function in SciLab 5.5.2:

-->1.45/0.025
 ans  =

58.

-->round(1.45/0.025)
 ans  =

58.

*but:*

int(1.45/0.025)
 ans  =

57.

Can anyone explain what is going on?




--
View this message in context: 
http://mailinglists.scilab.org/Function-int-strange-behavior-tp4033993.html
Sent from the Scilab users - Mailing Lists Archives mailing list archive at 
Nabble.com.___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-10-01 Thread Stéphane Mottelet

Le 01/10/2015 12:36, Rafael Guerra a écrit :
I can only think of Da Vinci's wise words: "simplicity is the ultimate 
sophistication"

+1, definitively


> To: users@lists.scilab.org
> From: cfutt...@gmail.com
> Date: Wed, 30 Sep 2015 23:51:11 +0200
> Subject: Re: [Scilab-users] Function
>
> Hi Christophe, et al.
>
> Sarcasm can create an unpleasant atmosphere, which is generally not
> desirable in a forum. Just ot be clear, I don't see any sarcasm in my
> own response. If you see it otherwise, please explain.
>
> When it comes to my points, please bear in mind that I did find the
> question by Peter Q highly suspicious. I think that very simple
> questions needs to be turned over and studied further. Also please be
> aware that if young people show up and need answers, it could interfere
> with educational programs. Therefore skepticism may be just right under
> certain circumstances.
>
> An approach for helpers in the forum could be, that if a question is
> very simple, consider asking questions, like for example "what is the
> general purpose?" - and/or - "can you explain more about the problem
> you're trying to solve?"
>
> I appreciate Samuels reply in that the answer may not be so simple, if
> the space is not a simple cartesian space. This was also part of the
> thoughts underlying my response. I was thinking, "where's the catch?"
>
> I do think that the forum members should be concerned with interfering
> with educational programs (like classes in school).
>
> Best regards,
> Claus
>
> On 30-09-2015 10:18, Dang, Christophe wrote:
> > Hello,
> >
> >> De : users [mailto:users-boun...@lists.scilab.org] De la part de 
Peter Q.

> >> Envoyé : mardi 29 septembre 2015 21:34
> >>
> >> Thanks guys for answer.
> > You're welcome.
> >
> > I personally think that we should sometimes simply answer 
elementary questions without sarcasm, as it is good news: the 
popularity of Scilab increases and people start using it without being 
senior calculators (this is also for myself, as I confess I have been 
myself sometimes sarcastic).

> >
> > If we suspect some lazy student, maybe we could discuss to have a 
common and adapted answer, such as asking first for the formulas 
before helping coding it.

> >
> > Regards
> >
> > --
> > 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.

> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
>
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users



--
Département de Génie Informatique
EA 4297 Transformations Intégrées de la Matière Renouvelable
Université de Technologie de Compiègne -  CS 60319
60203 Compiègne cedex

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-10-01 Thread Rafael Guerra
I can only think of Da Vinci's wise words: "simplicity is the ultimate 
sophistication"

> To: users@lists.scilab.org
> From: cfutt...@gmail.com
> Date: Wed, 30 Sep 2015 23:51:11 +0200
> Subject: Re: [Scilab-users] Function
> 
> Hi Christophe, et al.
> 
> Sarcasm can create an unpleasant atmosphere, which is generally not 
> desirable in a forum. Just ot be clear, I don't see any sarcasm in my 
> own response. If you see it otherwise, please explain.
> 
> When it comes to my points, please bear in mind that I did find the 
> question by Peter Q highly suspicious. I think that very simple 
> questions needs to be turned over and studied further. Also please be 
> aware that if young people show up and need answers, it could interfere 
> with educational programs. Therefore skepticism may be just right under 
> certain circumstances.
> 
> An approach for helpers in the forum could be, that if a question is 
> very simple, consider asking questions, like for example "what is the 
> general purpose?" - and/or - "can you explain more about the problem 
> you're trying to solve?"
> 
> I appreciate Samuels reply in that the answer may not be so simple, if 
> the space is not a simple cartesian space. This was also part of the 
> thoughts underlying my response. I was thinking, "where's the catch?"
> 
> I do think that the forum members should be concerned with interfering 
> with educational programs (like classes in school).
> 
> Best regards,
> Claus
> 
> On 30-09-2015 10:18, Dang, Christophe wrote:
> > Hello,
> >
> >> De : users [mailto:users-boun...@lists.scilab.org] De la part de Peter Q.
> >> Envoyé : mardi 29 septembre 2015 21:34
> >>
> >> Thanks guys for answer.
> > You're welcome.
> >
> > I personally think that we should sometimes simply answer elementary 
> > questions without sarcasm, as it is good news: the popularity of Scilab 
> > increases and people start using it without being senior calculators (this 
> > is also for myself, as I confess I have been myself sometimes sarcastic).
> >
> > If we suspect some lazy student, maybe we could discuss to have a common 
> > and adapted answer, such as asking first for the formulas before helping 
> > coding it.
> >
> > Regards
> >
> > --
> > 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.
> > ___
> > users mailing list
> > users@lists.scilab.org
> > http://lists.scilab.org/mailman/listinfo/users
> 
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
  ___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-09-30 Thread Dang, Christophe
Hello,

> De : users [mailto:users-boun...@lists.scilab.org] De la part de Peter Q.
> Envoyé : mardi 29 septembre 2015 21:34
>
> Thanks guys for answer.

You're welcome.

I personally think that we should sometimes simply answer elementary questions 
without sarcasm, as it is good news: the popularity of Scilab increases and 
people start using it without being senior calculators (this is also for 
myself, as I confess I have been myself sometimes sarcastic).

If we suspect some lazy student, maybe we could discuss to have a common and 
adapted answer, such as asking first for the formulas before helping coding it.

Regards

--
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.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-09-30 Thread Claus Futtrup

Hi Christophe, et al.

Sarcasm can create an unpleasant atmosphere, which is generally not 
desirable in a forum. Just ot be clear, I don't see any sarcasm in my 
own response. If you see it otherwise, please explain.


When it comes to my points, please bear in mind that I did find the 
question by Peter Q highly suspicious. I think that very simple 
questions needs to be turned over and studied further. Also please be 
aware that if young people show up and need answers, it could interfere 
with educational programs. Therefore skepticism may be just right under 
certain circumstances.


An approach for helpers in the forum could be, that if a question is 
very simple, consider asking questions, like for example "what is the 
general purpose?" - and/or - "can you explain more about the problem 
you're trying to solve?"


I appreciate Samuels reply in that the answer may not be so simple, if 
the space is not a simple cartesian space. This was also part of the 
thoughts underlying my response. I was thinking, "where's the catch?"


I do think that the forum members should be concerned with interfering 
with educational programs (like classes in school).


Best regards,
Claus

On 30-09-2015 10:18, Dang, Christophe wrote:

Hello,


De : users [mailto:users-boun...@lists.scilab.org] De la part de Peter Q.
Envoyé : mardi 29 septembre 2015 21:34

Thanks guys for answer.

You're welcome.

I personally think that we should sometimes simply answer elementary questions 
without sarcasm, as it is good news: the popularity of Scilab increases and 
people start using it without being senior calculators (this is also for 
myself, as I confess I have been myself sometimes sarcastic).

If we suspect some lazy student, maybe we could discuss to have a common and 
adapted answer, such as asking first for the formulas before helping coding it.

Regards

--
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.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


[Scilab-users] Function

2015-09-29 Thread Peter Q.
Hi.
I need your help.
Is there a function for distance between two points?
Thanks in advance.
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-09-29 Thread Claus Futtrup

Hi Peter Q

This question is just the strangest question I have ever seen on the 
Scilab forum. I'm not sure whether I shall think this is spam? ... 
alternatively, consider reading a Calculus book from high school. 
Possibly come back with a more well-defined question.


Best regards,
Claus

On 29-09-2015 15:58, Peter Q. wrote:


Hi.
I need your help.
Is there a function for distance between two points?
Thanks in advance.



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-09-29 Thread jasper van baten

sqrt(sum((a-b).^2))

if your points are stored in vectors a and b.

Best wishes,

Jasper

On 9/29/2015 15:58, Peter Q. wrote:


Hi.
I need your help.
Is there a function for distance between two points?
Thanks in advance.



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-09-29 Thread Serge Steer
Le 29/09/2015 15:58, Peter Q. a écrit :
>
> Hi.
> I need your help.
> Is there a function for distance between two points?
>
If your points are given by cartesian coordinates stored in 2 arrays  p1
and p2
you can compute the distance between these 2 points with
norm(p2-p1)
or equivalently by
sqrt(sum(p2-p1).^2)
Serge Steer
>
> Thanks in advance.
>
>
>
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-09-29 Thread jasper van baten
I think you are missing brackets there, presuming .^ now operates on the 
sum?


Best wishes,

Jasper.

On 9/29/2015 16:20, Serge Steer wrote:

Le 29/09/2015 15:58, Peter Q. a écrit :


Hi.
I need your help.
Is there a function for distance between two points?

If your points are given by cartesian coordinates stored in 2 arrays  
p1 and p2

you can compute the distance between these 2 points with
norm(p2-p1)
or equivalently by
sqrt(sum(p2-p1).^2)
Serge Steer


Thanks in advance.



___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users




___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-09-29 Thread Peter Q.
Thanks guys for answer.
Two points on plane; norm and sqrt work.
On Sep 29, 2015 9:26 AM, "Claus Futtrup"  wrote:

> Hi Peter Q
>
> This question is just the strangest question I have ever seen on the
> Scilab forum. I'm not sure whether I shall think this is spam? ...
> alternatively, consider reading a Calculus book from high school. Possibly
> come back with a more well-defined question.
>
> Best regards,
> Claus
>
> On 29-09-2015 15:58, Peter Q. wrote:
>
> Hi.
> I need your help.
> Is there a function for distance between two points?
> Thanks in advance.
>
>
> ___
> users mailing 
> listusers@lists.scilab.orghttp://lists.scilab.org/mailman/listinfo/users
>
>
>
> ___
> users mailing list
> users@lists.scilab.org
> http://lists.scilab.org/mailman/listinfo/users
>
>
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] Function

2015-09-29 Thread Samuel Gougeon

Hi,
Le 29/09/2015 15:58, Peter Q. a écrit :


Hi.
I need your help.
Is there a function for distance between two points?
Thanks in advance.


.
Sharing the thoughtful skepticism of Claus, i would say: If the points 
are lying on a sphere and you are looking for the shortest direct arc 
linking them along the sphere, the Wikipedia page about spherical 
trigonometry might help you: 
https://en.wikipedia.org/wiki/Spherical_trigonometry
Then, the usual cos(), and sin() Scilab functions will allow you 
implementing the relevant spherical formula.

;)
Samuel Gougeon

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] function find()

2014-05-28 Thread grivet
Thank you all for your suggestions concerning pair-wise distances. The 
motivation behind my
question is that I am writing a simplistic molecular dynamics program, 
where hard disks move
freely inside a plane region, except when colliding with boudaries or 
with other disks. I hoped
that my program could be as fast as the beautiful Python program of Jake 
Vanderplas
(http://jakevdp.github.com) but, up to now, the Python code is still 
significantly faster.

JP Grive
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] function find()

2014-05-27 Thread Pierre-Aimé Agnel

Hi,

You are computing operator over complex number (which is not defined) 
because your distance matrix has an error


Try with this change
distance(i,j) = sqrt((etat(i,1)-etat(j,1))**2+(etat(i,2)-etat(j,2)**2));
=
distance(i,j) = sqrt((etat(i,1)-etat(j,1))**2+(etat(i,2)-etat(j,2))**2);

Full script:
// initialisation
diam = 0.2;
nd = 10;
etat = (rand(nd,2) -0.5)*4;
distance = zeros(nd,nd);
//compute distance matrix
for i = 1:(nd-1)
for j = (i+1):nd
distance(i,j) = 
sqrt((etat(i,1)-etat(j,1))**2+(etat(i,2)-etat(j,2))**2);

end
end
//find close pairs
[li,lj] = find(distancediam)

Best,

On 05/27/2014 01:49 PM, grivet wrote:

Hello,
While trying to compute pairwise distances between random points, I 
have come across
a behavior of function find() that I don't understand. I do the 
following:


// initialisation
diam = 0.2;
nd = 10;
etat = (rand(nd,2) -0.5)*4;
distance = zeros(nd,nd);
//compute distance matrix
for i = 1:(nd-1)
for j = (i+1):nd
distance(i,j) = 
sqrt((etat(i,1)-etat(j,1))**2+(etat(i,2)-etat(j,2)**2));

end
end
//find close pairs
[li,lj] = find(distancediam)

With both Scilab 5.4.1 and Scilab 5.5, the last line raises the error 
message:

 !--error 144
Opération non définie pour les opérandes données.

I will be grateful to anybody who spots my error.

Thank your for your time,
JP Grivet
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


--
Pierre-Aimé Agnel
Development Team
---
Scilab Enterprises
143bis rue Yves Le Coz - 78000 Versailles, France
Phone: +33.1.80.77.04.68
http://www.scilab-enterprises.com

___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users


Re: [Scilab-users] function find()

2014-05-27 Thread sgougeon
Hello,

// initialisation
diam = 0.2;
nd = 10;
etat = (rand(nd,2) -0.5)*4;
distance = zeros(nd,nd);
//compute distance matrix
for i = 1:(nd-1)
 for j = (i+1):nd
 distance(i,j) = 
 sqrt((etat(i,1)-etat(j,1))**2+(etat(i,2)-etat(j,2)**2));
 end
end

You may do without explicit nested loops:

[X,Y] = meshgrid(etat(:,1), etat(:,2));
distance = sqrt((X-X.').^2 + (Y-Y.').^2)

Samuel
___
users mailing list
users@lists.scilab.org
http://lists.scilab.org/mailman/listinfo/users