From b.v.pirovano at hva.nl Mon Jan 2 11:26:28 2017 From: b.v.pirovano at hva.nl (Pirovano, Bart) Date: Mon, 2 Jan 2017 10:26:28 +0000 Subject: [Scilab-users] Plotting 2 functions & integrate 1 definitive Message-ID: Goodday, I would like to add a second function to the underneath little program. I suppose something I haven't done correct where I address 'b'. Can somebody put me in the good direction with integrating the x,y curve? clf; // y-axis GZ (m) // x-axis degrees x=[0,2,5,10,12,15,20,25,30,40,50,60]'; y=[0,0.065,0.10,0.136,0.159,0.19,0.29,0.382,0.50,0.84,0.91,0.85]'; b=['2x']; xtitle("GZ kromme Elandsgracht / departure Singapore") xlabel('? (degrees)'); ylabel('GZ (m)'); plot2d (x,y); integ('x,y','x',0,30); Bart -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.bignier at scilab-enterprises.com Mon Jan 2 11:50:11 2017 From: paul.bignier at scilab-enterprises.com (Paul Bignier) Date: Mon, 2 Jan 2017 11:50:11 +0100 Subject: [Scilab-users] Plotting 2 functions & integrate 1 definitive In-Reply-To: References: Message-ID: <89e35b78-6257-65a5-920e-88bf7ea65eba@scilab-enterprises.com> Hello Bart, I suppose you want to use the int2d function? Then you should define b as a function, like in the example. Regards, Paul On 01/02/2017 11:26 AM, Pirovano, Bart wrote: > > Goodday, I would like to add a second function to the underneath > little program. I suppose something I haven?t done correct where I > address ?b?. Can somebody put me in the good direction with > integrating the x,y curve? > > clf; > > // y-axis GZ (m) > > // x-axis degrees > > x=[0,2,5,10,12,15,20,25,30,40,50,60]'; > > y=[0,0.065,0.10,0.136,0.159,0.19,0.29,0.382,0.50,0.84,0.91,0.85]'; > > b=['2x']; > > xtitle("GZ kromme Elandsgracht / departure Singapore") xlabel('? > (degrees)'); ylabel('GZ (m)'); plot2d (x,y); integ('x,y','x',0,30); > > Bart > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -- Paul BIGNIER Development engineer ----------------------------------------------------------- Scilab Enterprises 143bis rue Yves Le Coz - 78000 Versailles, France Phone: +33.1.80.77.04.68 http://www.scilab-enterprises.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephane.mottelet at utc.fr Mon Jan 2 12:04:23 2017 From: stephane.mottelet at utc.fr (=?UTF-8?Q?St=c3=a9phane_Mottelet?=) Date: Mon, 2 Jan 2017 12:04:23 +0100 Subject: [Scilab-users] Plotting 2 functions & integrate 1 definitive In-Reply-To: References: Message-ID: Hi, Le 02/01/2017 ? 11:26, Pirovano, Bart a ?crit : > > Goodday, I would like to add a second function to the underneath > little program. I suppose something I haven?t done correct where I > address ?b?. Can somebody put me in the good direction with > integrating the x,y curve? > you want to compute a line integral or a double integral on the interior of polygon ? S. > > clf; > > // y-axis GZ (m) > > // x-axis degrees > > x=[0,2,5,10,12,15,20,25,30,40,50,60]'; > > y=[0,0.065,0.10,0.136,0.159,0.19,0.29,0.382,0.50,0.84,0.91,0.85]'; > > b=['2x']; > > xtitle("GZ kromme Elandsgracht / departure Singapore") xlabel('? > (degrees)'); ylabel('GZ (m)'); plot2d (x,y); integ('x,y','x',0,30); > > Bart > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Mon Jan 2 16:32:44 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Mon, 2 Jan 2017 16:32:44 +0100 Subject: [Scilab-users] Instruction to move an existing datatip Message-ID: <586A729C.80708@free.fr> Hello, I am trying to move an existing datatip with some instruction instead of by hand interactively, but all my attempts failed: 1. datatipMove(datatip) allows to move the given datatip, but only interactively. It does not accept a second argument providing the new coordinates where to move the datatip (and a third one indicating the method to compute the actual anchor position) 2. assigning directly datatip.data=... yields an error : http://bugzilla.scilab.org/14936 3. The only way that i found is to delete the datatip and to create a new one at the new position. Not really proper... By the way, i have not really found any proper code to delete a datatip with Scilab 6 : datatipRemove(..) is no longer available (only its page), and delete(datatip) leaves a ghost in the curve.datatips vector of datatips : http://bugzilla.scilab.org/14934 So, am i missing anything trivial -- or less trivial -- to simply move a datatip with some instruction? Thanks Happy new year 2017 to all Scilabers! Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From Christophe.Dang at sidel.com Tue Jan 3 13:28:47 2017 From: Christophe.Dang at sidel.com (Dang Ngoc Chan, Christophe) Date: Tue, 3 Jan 2017 12:28:47 +0000 Subject: [Scilab-users] Using lsqrsolve with a certain kind of function Message-ID: Hello, Happy new year to everyone and : > De : Viktor Goryainov > Envoy? : vendredi 23 d?cembre 2016 22:51 > > s = vr3(C_inh); In the former messages, vr3 needed two arguments: >> De : Viktor Goryainov >> Envoy? : mercredi 21 d?cembre 2016 16:43 >> >> function r = vr3(C, mu) so I'm a bit puzzled. Maybe you should provide us a complete and minimal example, i.e. a small script that is supposed to work and reproduce the error. (BTW, in my former answer, the correct spelling is "zeros" and not "zeroes".) 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. From al_exquemelin at yahoo.com Tue Jan 3 22:54:09 2017 From: al_exquemelin at yahoo.com (Viktor Goryainov) Date: Wed, 4 Jan 2017 00:54:09 +0300 Subject: [Scilab-users] Using lsqrsolve with a certain kind of function In-Reply-To: References: Message-ID: <69c0bf61-3f4b-6ce0-3eff-a43d12616ee1@yahoo.com> Happy 2017 and season's greetings! 03.01.2017 15:28, Dang Ngoc Chan, Christophe ?????: > In the former messages, vr3 needed two arguments I just moved mu to the beginning of the script. It only changes between the runs, so I suppose there is no real need to provide it as a parameter for the function. 03.01.2017 15:28, Dang Ngoc Chan, Christophe ?????: > Maybe you should provide us a complete and minimal example, > i.e. a small script that is supposed to work and reproduce the error. All right, here's what works. aw15 = linspace(0.038, 0.016, 15)'; achl15 = linspace(0.0162, 0.5, 15)'; asm15 = linspace(0.265, 0.125, 15)'; adoc15 = linspace(0.28, 0.05, 15)'; bw15 = linspace(0.0052, 0.0006, 15)'; bchl15 = linspace(0.00124, 0.00108, 15)'; bsm15 = linspace(0.023, 0.025, 15)'; mu = 0.93; function r = vr3(C) a = aw15 + achl15 * C(1) + asm15 * C(2) + adoc15 * C(3); bb = bw15 + bchl15 * C(1) + bsm15 * C(2); dd = bb ./ a; if dd < 0.25 then r = 0.319 * dd / mu; else r = (0.267 * dd + 0.013) / mu; end endfunction C_inh = [0.5 0.6 0.7]; s = vr3(C_inh); Then, I wrote a function to be used with lsqrsolve(), as the help page suggests (under the "Data fitting problem" section): function e = err(C2) e = s - vr3(C2); endfunction Now, if I make an initial guess and try to solve the problem as follows: C_init = [1 1 1]; [C_s, v] = lsqrsolve(C_init, err, 15); I then get error 58: "Function has no input argument". So what am I doing wrong? Best regards, Viktor From Christophe.Dang at sidel.com Wed Jan 4 10:41:30 2017 From: Christophe.Dang at sidel.com (Dang Ngoc Chan, Christophe) Date: Wed, 4 Jan 2017 09:41:30 +0000 Subject: [Scilab-users] {EXT} Re: Using lsqrsolve with a certain kind of function In-Reply-To: <69c0bf61-3f4b-6ce0-3eff-a43d12616ee1@yahoo.com> References: <69c0bf61-3f4b-6ce0-3eff-a43d12616ee1@yahoo.com> Message-ID: Hello, > De : Viktor Goryainov > Envoy? : mardi 3 janvier 2017 22:54 > > So what am I doing wrong? Unfortunately I never used lsqrsolve but I used leastsq. The two functions should do the same thing (i.e. least square regression) but the syntax is very different. Nevertheless, in the help page https://help.scilab.org/docs/6.0.0/en_US/lsqrsolve.html I read that: "fct is function from R^n to R^m? a Scilab function whose syntax is v=fct(x,m) given x and m." So err() should have two input arguments which is not the case here. 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. From al_exquemelin at yahoo.com Fri Jan 6 01:13:47 2017 From: al_exquemelin at yahoo.com (Viktor Goryainov) Date: Fri, 6 Jan 2017 03:13:47 +0300 Subject: [Scilab-users] {EXT} Re: Using lsqrsolve with a certain kind of function In-Reply-To: References: <69c0bf61-3f4b-6ce0-3eff-a43d12616ee1@yahoo.com> Message-ID: <4378bf85-effb-08c5-3941-6ae35257a580@yahoo.com> 04.01.2017 12:41, Dang Ngoc Chan, Christophe ?????: > So err() should have two input arguments > which is not the case here. Thank you very much for your help, e = err(C2, m) finally made it all work. Can't believe I only missed this one step. I'd like also to add some constraints to the solution, so that computation stops once the result gets out of range. I know optim() has an option for this, but it doesn't use the Levenberg-Marquardt algorithm. The latter matters, since this is in fact an educational task. Any ideas on this? Best regards, Viktor From jlhb1984 at gmail.com Fri Jan 6 16:42:38 2017 From: jlhb1984 at gmail.com (Jose Luis Hurtado Balcazar) Date: Fri, 6 Jan 2017 10:42:38 -0500 Subject: [Scilab-users] Ploting rational function. Message-ID: Hi. Can you help me with tutorial to graph rational functions. I have troubles with y=(x+1)/x. SCILAB only is graphing a number like a constant. T=1.1:0.1:5; -->Y=(T+1)/T; -->plot(T,Y) What am I doing bad? Thank you by your help! -------------- next part -------------- An HTML attachment was scrubbed... URL: From n.strelkov at gmail.com Fri Jan 6 16:48:05 2017 From: n.strelkov at gmail.com (Nikolay Strelkov) Date: Fri, 6 Jan 2017 18:48:05 +0300 Subject: [Scilab-users] Ploting rational function. In-Reply-To: References: Message-ID: Dear Jose! T is a vector, so you should use "./" instead of "/": T=1.1:0.1:5; Y=(T+1)./T; // T is a vector. plot(T,Y); -- *With best regards,Ph.D., assistant professor at MPEI ,IEEE member,maintainer of Mathieu functions toolbox for Scilab ,Nikolay Strelkov.* 2017-01-06 18:42 GMT+03:00 Jose Luis Hurtado Balcazar : > Hi. > > Can you help me with tutorial to graph rational functions. I have troubles > with y=(x+1)/x. SCILAB only is graphing a number like a constant. > > T=1.1:0.1:5; > > -->Y=(T+1)/T; > > -->plot(T,Y) > > What am I doing bad? > > Thank you by your help! > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.s.strom at hslmg.de Fri Jan 6 23:07:28 2017 From: j.s.strom at hslmg.de (Jens Simon Strom) Date: Fri, 06 Jan 2017 23:07:28 +0100 Subject: [Scilab-users] surf with isoview Message-ID: <58701520.7000405@hslmg.de> Hallo, When I switch isoview on after a surf plot I don't get an isometric plot. One can work around by defining cube shape data_bounds. Is that the method of first choice? Kind regards Jens From wegunterjr at gmail.com Fri Jan 6 23:28:26 2017 From: wegunterjr at gmail.com (wegunterjr) Date: Fri, 6 Jan 2017 15:28:26 -0700 (MST) Subject: [Scilab-users] is there a fast way to plot multiple plots? Message-ID: <1483741706094-4035323.post@n3.nabble.com> Right now I am reading a folder and getting some plot logs. I have about 95 of them, and then I parse the log and plot2d and then animate a block over the positions in the log. It is taking a few minutes to get all of the plot windows to open. I am currently using the scf to open a new plot window. It isn't getting to the 95th plot and not doing any animation, so it appears to be dying right before the end, but there is no output on teh console. I am using Scilab 6.0 scf(newFolderIndex); plot2d(xPosition,yPosition) xtitle(logFolders(newFolderIndex)) -- View this message in context: http://mailinglists.scilab.org/is-there-a-fast-way-to-plot-multiple-plots-tp4035323.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From jrafaelbguerra at hotmail.com Fri Jan 6 23:28:57 2017 From: jrafaelbguerra at hotmail.com (Rafael Guerra) Date: Fri, 6 Jan 2017 22:28:57 +0000 Subject: [Scilab-users] surf with isoview In-Reply-To: <58701520.7000405@hslmg.de> References: <58701520.7000405@hslmg.de> Message-ID: Hi Jens, Please check this out: // START OF CODE clf; X = repmat([1 2 3 5],4,1); Y = repmat([10 20 30 50]',1,4); Z = X + exp(-Y/50); surf(X,Y,Z) h=gca(); h.cube_scaling="off"; h.isoview="on"; //END OF CODE Result seems isometric enough to me. Regards, Rafael -----Original Message----- From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Jens Simon Strom Sent: Friday, January 06, 2017 11:07 PM To: International users mailing list for Scilab. Subject: [Scilab-users] surf with isoview Hallo, When I switch isoview on after a surf plot I don't get an isometric plot. One can work around by defining cube shape data_bounds. Is that the method of first choice? Kind regards Jens _______________________________________________ users mailing list users at lists.scilab.org http://lists.scilab.org/mailman/listinfo/users From sgougeon at free.fr Fri Jan 6 23:39:01 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Fri, 6 Jan 2017 23:39:01 +0100 Subject: [Scilab-users] surf with isoview In-Reply-To: <58701520.7000405@hslmg.de> References: <58701520.7000405@hslmg.de> Message-ID: <58701C85.5040206@free.fr> Hello Jens, Le 06/01/2017 23:07, Jens Simon Strom a ?crit : > Hallo, > When I switch isoview on after a surf plot I don't get an isometric > plot. One can work around by defining cube shape data_bounds. Is that > the method of first choice? It looks like a bug: the cube_scaling property has presently the priority over the isoview one. IMO, * switching .isoview="on" should automatically set .cube_scaling="off", and * switching .cube_scaling="on" should automatically set .isoview="off", and whatever is gca().view Let's implement the first setting at least in isoview(). Regards Samuel From sgougeon at free.fr Fri Jan 6 23:56:42 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Fri, 6 Jan 2017 23:56:42 +0100 Subject: [Scilab-users] surf with isoview In-Reply-To: <58701C85.5040206@free.fr> References: <58701520.7000405@hslmg.de> <58701C85.5040206@free.fr> Message-ID: <587020AA.6020303@free.fr> Le 06/01/2017 23:39, Samuel Gougeon a ?crit : > Hello Jens, > > Le 06/01/2017 23:07, Jens Simon Strom a ?crit : >> Hallo, >> When I switch isoview on after a surf plot I don't get an isometric >> plot. One can work around by defining cube shape data_bounds. Is that >> the method of first choice? > > It looks like a bug: the cube_scaling property has presently the > priority over the isoview one. > IMO, > * switching .isoview="on" should automatically set > .cube_scaling="off", and > * switching .cube_scaling="on" should automatically set > .isoview="off", and > whatever is gca().view > > Let's implement the first setting at least in isoview(). Proposal on review: https://codereview.scilab.org/#/c/18857/2/scilab/modules/graphics/macros/isoview.sci SG From jlhb1984 at gmail.com Sat Jan 7 03:34:39 2017 From: jlhb1984 at gmail.com (electrocrow) Date: Fri, 6 Jan 2017 19:34:39 -0700 (MST) Subject: [Scilab-users] Ploting rational function. In-Reply-To: References: Message-ID: <1483756479980-4035327.post@n3.nabble.com> Thank you Mr. Strelkov. I am graphing very well with SCILAB. Thank's a lot!!! -- View this message in context: http://mailinglists.scilab.org/Scilab-users-Ploting-rational-function-tp4035319p4035327.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From j.s.strom at hslmg.de Sat Jan 7 10:49:11 2017 From: j.s.strom at hslmg.de (Jens Simon Strom) Date: Sat, 07 Jan 2017 10:49:11 +0100 Subject: [Scilab-users] surf with isoview In-Reply-To: References: <58701520.7000405@hslmg.de> Message-ID: <5870B997.4080708@hslmg.de> Hallo Rafael, Very effective solution! It works with plot3D too, e. g.: // START OF CODE xdel(); plot3d([1 0 0]',[0 0 5]',[0 25 0]') h=gca(); h.cube_scaling="off"; h.isoview="on"; //END OF CODE Kind regards and thanks for your competent assistance Jens -------------------------------------------------------------------------------------------- Am 06.01.2017 23:28, schrieb Rafael Guerra: > Hi Jens, > > Please check this out: > > // START OF CODE > clf; > X = repmat([1 2 3 5],4,1); > Y = repmat([10 20 30 50]',1,4); > Z = X + exp(-Y/50); > surf(X,Y,Z) > h=gca(); > h.cube_scaling="off"; > h.isoview="on"; > //END OF CODE > > Result seems isometric enough to me. > > Regards, > Rafael > > -----Original Message----- > From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Jens Simon Strom > Sent: Friday, January 06, 2017 11:07 PM > To: International users mailing list for Scilab. > Subject: [Scilab-users] surf with isoview > > Hallo, > When I switch isoview on after a surf plot I don't get an isometric > plot. One can work around by defining cube shape data_bounds. Is that > the method of first choice? > Kind regards > Jens > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From clement.david at scilab-enterprises.com Sat Jan 7 11:39:55 2017 From: clement.david at scilab-enterprises.com (=?ISO-8859-1?Q?Cl=E9ment?= David) Date: Sat, 07 Jan 2017 11:39:55 +0100 Subject: [Scilab-users] is there a fast way to plot multiple plots? In-Reply-To: <1483741706094-4035323.post@n3.nabble.com> References: <1483741706094-4035323.post@n3.nabble.com> Message-ID: <1483785595.1981.15.camel@scilab-enterprises.com> Hi, Do you use the `.data` field of the polylines ? This is way faster than reset-ing all the properties on each draw. You could probably also use xpolys() rather than plot2d() to draw multiple polylines at a time. Thanks, -- Cl?ment Le vendredi 06 janvier 2017 ? 15:28 -0700, wegunterjr a ?crit?: > Right now I am reading a folder and getting some plot logs. I have about 95 > of them, and then I parse the log and plot2d and then animate a block over > the positions in the log.????It is taking a few minutes to get all of the > plot windows to open. I am currently using the scf to open a new plot > window. > It isn't getting to the 95th plot and not doing any animation, so it appears > to be dying right before the end, but there is no output on teh console. > I am using Scilab 6.0 > scf(newFolderIndex); > ????????????plot2d(xPosition,yPosition) > ????????????xtitle(logFolders(newFolderIndex))?? > > > > -- > View this message in context: http://mailinglists.scilab.org/is-there-a-fast-way-to-plot-multiple- > plots-tp4035323.html > Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users From J_Holland at msn.com Sat Jan 7 23:01:11 2017 From: J_Holland at msn.com (James Holland) Date: Sat, 7 Jan 2017 22:01:11 +0000 Subject: [Scilab-users] Interfacing to third party DLLs Message-ID: I'm new to Scilab but I have some experience with MATLAB. I'm trying to port some code that calls functions in a third party DLL. From what I've read I can't do this if the function returns a value however that article was a couple of years old, is there now an equivalent of loadlibrary? I have seen comments referring to the API_Scilab but that seems to be only for calling Scilab functions. TYI James -------------- next part -------------- An HTML attachment was scrubbed... URL: From tim at wescottdesign.com Sun Jan 8 02:02:00 2017 From: tim at wescottdesign.com (Tim Wescott) Date: Sat, 07 Jan 2017 17:02:00 -0800 Subject: [Scilab-users] Interfacing to third party DLLs In-Reply-To: References: Message-ID: <1483837320.9853.1.camel@wescottdesign.com> On Sat, 2017-01-07 at 22:01 +0000, James Holland wrote: > I'm new to Scilab but I have some experience with MATLAB. I'm trying > to port some code that calls functions in a third party DLL. From > what I've read I can't do this if the function returns a value > however?that article was a couple of years old, is there now an > equivalent of loadlibrary? I have seen comments referring to the > API_Scilab but that seems to be only for calling Scilab functions. > TYI > James? >? I don't know if there's a better way, but you could always write C functions using the Scilab API that talk to the DLL. It'd be a pain, and it would be nice if someone would make it more? painless. But -- the possibility is there. -- Tim Wescott www.wescottdesign.com Control & Communications systems, circuit & software design. Phone: 503.631.7815 Cell: 503.349.8432 From j_holland at msn.com Sun Jan 8 11:35:01 2017 From: j_holland at msn.com (James Holland) Date: Sun, 8 Jan 2017 03:35:01 -0700 (MST) Subject: [Scilab-users] Interfacing to third party DLLs In-Reply-To: <1483837320.9853.1.camel@wescottdesign.com> References: <1483837320.9853.1.camel@wescottdesign.com> Message-ID: <1483871701187-4035332.post@n3.nabble.com> That's a bit beyond my abilities at present. I saw another post where someone wrote a DLL to talk to the third party DLL, I'll give that a try although I've never had to write a DLL I think I could manage it. I was planning on porting this code as an introductory exercise to learn Scilab but I've stumbled at the first hurdle. I'm a hardware designer with experience of software and control engineering rather than being a software or control engineer. -- View this message in context: http://mailinglists.scilab.org/Scilab-users-Interfacing-to-third-party-DLLs-tp4035330p4035332.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From sgougeon at free.fr Sun Jan 8 18:56:06 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Sun, 8 Jan 2017 18:56:06 +0100 Subject: [Scilab-users] Instruction to move an existing datatip In-Reply-To: <586A729C.80708@free.fr> References: <586A729C.80708@free.fr> Message-ID: <58727D36.6000405@free.fr> Le 02/01/2017 16:32, Samuel Gougeon a ?crit : > Hello, > > I am trying to move an existing datatip with some instruction instead > of by hand interactively, but all my attempts failed: > > 1. datatipMove(datatip) allows to move the given datatip, but only > interactively. It does not accept a second argument providing the > new coordinates where to move the datatip (and a third one > indicating the method to compute the actual anchor position) > > 2. assigning directly datatip.data=... yields an error : > http://bugzilla.scilab.org/14936 > > 3. The only way that i found is to delete the datatip and to create a > new one at the new position. Not really proper... By the way, i > have not really found any proper code to delete a datatip with > Scilab 6 : datatipRemove(..) is no longer available (only its > page), and delete(datatip) leaves a ghost in the curve.datatips > vector of datatips : http://bugzilla.scilab.org/14934 > > So, am i missing anything trivial -- or less trivial -- to simply move > a datatip with some instruction? > This missing feature is now reported there: http://bugzilla.scilab.org/14943 SG -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Sun Jan 8 20:29:54 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Sun, 8 Jan 2017 20:29:54 +0100 Subject: [Scilab-users] Interfacing to third party DLLs In-Reply-To: References: Message-ID: <58729332.6050508@free.fr> Hello James, Le 07/01/2017 23:01, James Holland a ?crit : > > I'm new to Scilab but I have some experience with MATLAB. I'm trying > to port some code that calls functions in a third party DLL. From what > I've read I can't do this if the function returns a value however that > article was a couple of years old, > It would be interesting to have a pointer to this article. It looks very unlikely, or even wrong. A requirement indicated in Scilab documentation is about the calling convention: --> uman call d Limitations to Shared Library Support ------------------------------------- .../... Scilab shared library interface (call function) supports only C and fortran libraries routines. In others cases, we recommend to use api_scilab interfaces. Troubleshooting Shared Library Applications (Windows) ---------------------------------------------------- Some shared libraries, compiled as Microsoft Windows 32 or 64 bit libraries, use a calling convention that is incompatible with the default Scilab calling convention. The default calling convention for Scilab and for Microsoft C and C++ compilers is cdecl. For more information, see the MSDN? Calling Conventions and Wikipedia articles. For a broader overview : https://help.scilab.org/docs/6.0.0/en_US/section_eb691bc0a443eb3a95bc5db4d1be2102.html HTH Samuel Gougeon -------------- next part -------------- An HTML attachment was scrubbed... URL: From j_holland at msn.com Mon Jan 9 09:49:44 2017 From: j_holland at msn.com (James Holland) Date: Mon, 9 Jan 2017 01:49:44 -0700 (MST) Subject: [Scilab-users] Interfacing to third party DLLs In-Reply-To: References: Message-ID: <1483951784272-4035335.post@n3.nabble.com> Not an article as such, it was a reply to a post on here: http://mailinglists.scilab.org/Scilab-users-Linking-DLL-from-MS-Visual-C-to-SciLab-td4028800.html -- View this message in context: http://mailinglists.scilab.org/Scilab-users-Interfacing-to-third-party-DLLs-tp4035330p4035335.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From sgougeon at free.fr Mon Jan 9 10:01:23 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Mon, 9 Jan 2017 10:01:23 +0100 Subject: [Scilab-users] Interfacing to third party DLLs In-Reply-To: <1483951784272-4035335.post@n3.nabble.com> References: <1483951784272-4035335.post@n3.nabble.com> Message-ID: <58735163.6090800@free.fr> Le 09/01/2017 09:49, James Holland a ?crit : > Not an article as such, it was a reply to a post on here: > > http://mailinglists.scilab.org/Scilab-users-Linking-DLL-from-MS-Visual-C-to-SciLab-td4028800.html As you may see in the "call" help page, it is fortunately possible to call functions returning things. May be the author spoke about a specific case or circumstance of its own. From j_holland at msn.com Mon Jan 9 20:42:51 2017 From: j_holland at msn.com (James Holland) Date: Mon, 9 Jan 2017 12:42:51 -0700 (MST) Subject: [Scilab-users] Interfacing to third party DLLs In-Reply-To: <58735163.6090800@free.fr> References: <1483951784272-4035335.post@n3.nabble.com> <58735163.6090800@free.fr> Message-ID: <1483990971838-4035337.post@n3.nabble.com> OK that helps, thank you. I'm now struggling with the data types, I'm currently trying to interface to the FTDI D2XX DLL but I have several other scripts that I will also need to port to Scilab. The function call is: FT_STATUS FT_CreateDeviceInfoList (LPDWORD lpdwNumDevs) where FT_Status is a double and lpdwNumDevs is a long pointer. In matlab I used a libpointer but I can't find a good example of how to do this in Scilab. Should I be using a pointer from the API_Scilab? the example seems to be for a C routing calling a Scilab function, not the other way round. My code at present is: ft_status=0; NumDevices = 0; x = call("FT_CreateDeviceInfoList", NumDevices, 1, "d", "out", ft_status,1,"d"); I get the error message "call: Wrong type for argument #8: Real or complex matrix expected at line 21 of exec file called by : exec('C:\Users\RhinoPower\Documents\Scilab\FTDI\FTDI_Test_OK.sce', -1)" I would have thought that #8 would be the second "d" but surely its more likely to be complaining about the lack of a pointer. Regards James -- View this message in context: http://mailinglists.scilab.org/Scilab-users-Interfacing-to-third-party-DLLs-tp4035330p4035337.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From paul.carrico at free.fr Tue Jan 10 22:27:30 2017 From: paul.carrico at free.fr (paul.carrico at free.fr) Date: Tue, 10 Jan 2017 22:27:30 +0100 Subject: [Scilab-users] derivative vs numderivative Message-ID: <3aeb606307e617376f1258cc1ad89dc0@free.fr> Hi all I've not been using Scilab for optimization tasks for years and I decided to dig up my old codes; I didn't follow such items in the mailing list so the current questionning has probably ever been treated (?!?!): why numderivative leads to different result than derivative (since derivative will be removed in the next release)? ... algorithms + step calculation are probably different (while they are using finite difference method ... I don't know) To myself first, I've made a (very) basic example based on the famous Rosembrock function to perform tests Thanks for any support Paul ###############################################################################" mode(0) clear // function function f = rosembrock(x) f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2; endfunction // cost function function [f,g,ind] = cost(x,ind) f = rosembrock(x); // g = derivative(rosembrock, x.',order = 4); g = numderivative(rosembrock, x.',order = 4); endfunction //initial_parameters = [10 10] initial_parameters = [100 100] //lower_bounds = [90 90]; lower_bounds = [0 0]; upper_bounds = [1000 1000]; //[fopt , xopt] = optim(cost,initial_parameters) [fopt , xopt] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'ar',100,100) -------------- next part -------------- An HTML attachment was scrubbed... URL: From kingcreole1337 at gmail.com Fri Jan 13 11:45:23 2017 From: kingcreole1337 at gmail.com (Werner) Date: Fri, 13 Jan 2017 03:45:23 -0700 (MST) Subject: [Scilab-users] Multiple 2D Plots in 3D Plane Message-ID: <1484304323619-4035339.post@n3.nabble.com> Dear members, I want to put a few FFT results for different cases into one 3D plot. I searched the whole forum but cant find a solution. The final result have to look like this(without the circles at each point). Thank you for our help. -- View this message in context: http://mailinglists.scilab.org/Multiple-2D-Plots-in-3D-Plane-tp4035339.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From paul.carrico at free.fr Fri Jan 13 14:39:06 2017 From: paul.carrico at free.fr (paul.carrico at free.fr) Date: Fri, 13 Jan 2017 14:39:06 +0100 Subject: [Scilab-users] Optim use and 'err' flag Message-ID: <9e5678541fe2780181db9bcb00246d16@free.fr> Hi all I?m trying to improve how to use Optim in Scilab, so I?m still using the basic Rosembrock function; in the example hereafter, one can see that Optim goes back the Error flag to 3 and I do not understand why? The goal is to be able to check all the values of this flag in order to validate the result ; while the values are the optimized ones, the calculation indicates that the optimization fails ? I?m a bit loss ? so any feedback will be appreciated Thanks Paul ################################################################################### In my understanding: - err = 9 : everything went well ? ok - err = 3 : Optimization stops because of too small variations for x - err=1 : Norm of projected gradient lower than ? - err=2 : At last iteration f decreases by less than ? - err=4 : Optim stops: maximum number of calls to f is reached ==> increase nocf - err=5 : Optim stops: maximum number of iterations is reached. ==> increase niter - err=6 : Optim stops: too small variations in gradient direction. - err=7 : Stop during calculation of descent direction. - err=8 : Stop during calculation of estimated hessian. - err=10 : End of optimization (linear search fails). // Rosembrock function function f=rosembrock(x) f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2; endfunction // Cost function function [f, g, ind]=cost(x, ind) f = rosembrock(x); // g = derivative(rosembrock, x.',order = 4); // g = numderivative(rosembrock, x.',order = 4); g = numderivative(rosembrock, x.',0.1, order = 4); endfunction initial_parameters = [10 100] lower_bounds = [0 0]; upper_bounds = [1000 1000]; nocf = 100000; // number of call of f niter = 100000; // number of iterations [fopt, xopt, gopt, work, iters, evals, err] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter); xopt fopt iters evals err From paul.bignier at scilab-enterprises.com Fri Jan 13 17:11:44 2017 From: paul.bignier at scilab-enterprises.com (Paul Bignier) Date: Fri, 13 Jan 2017 17:11:44 +0100 Subject: [Scilab-users] Optim use and 'err' flag In-Reply-To: <9e5678541fe2780181db9bcb00246d16@free.fr> References: <9e5678541fe2780181db9bcb00246d16@free.fr> Message-ID: Hello Paul, Running your script gives me "err=12", which is not documented but I don't get how you got 3? I see though that you reached 'evals' & 'iters', perhaps optim wanted to continue but was capped by those. Feel free to use the format function to get more on-screen precision to your values. I will surely commit something soon in order to fix the "12" flag. Have a good evening, Paul On 01/13/2017 02:39 PM, paul.carrico at free.fr wrote: > Hi all > > I?m trying to improve how to use Optim in Scilab, so I?m still using > the basic Rosembrock function; in the example hereafter, one can see > that Optim goes back the Error flag to 3 and I do not understand why? > > The goal is to be able to check all the values of this flag in order > to validate the result ; while the values are the optimized ones, the > calculation indicates that the optimization fails ? > > I?m a bit loss ? so any feedback will be appreciated > > Thanks > > Paul > > ################################################################################### > > In my understanding: > - err = 9 : everything went well ? ok > > - err = 3 : Optimization stops because of too small variations for x > - err=1 : Norm of projected gradient lower than ? > - err=2 : At last iteration f decreases by less than ? > - err=4 : Optim stops: maximum number of calls to f is reached ==> > increase nocf > - err=5 : Optim stops: maximum number of iterations is reached. ==> > increase niter > - err=6 : Optim stops: too small variations in gradient direction. > - err=7 : Stop during calculation of descent direction. > - err=8 : Stop during calculation of estimated hessian. > - err=10 : End of optimization (linear search fails). > > > > // Rosembrock function > function f=rosembrock(x) > f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2; > endfunction > > // Cost function > function [f, g, ind]=cost(x, ind) > f = rosembrock(x); > // g = derivative(rosembrock, x.',order = 4); > // g = numderivative(rosembrock, x.',order = 4); > g = numderivative(rosembrock, x.',0.1, order = 4); > endfunction > > initial_parameters = [10 100] > lower_bounds = [0 0]; > upper_bounds = [1000 1000]; > nocf = 100000; // number of call of f > niter = 100000; // number of iterations > [fopt, xopt, gopt, work, iters, evals, err] = > optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter); > xopt > fopt > iters > evals > err > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -- Paul BIGNIER Development engineer ----------------------------------------------------------- Scilab Enterprises 143bis rue Yves Le Coz - 78000 Versailles, France Phone: +33.1.80.77.04.68 http://www.scilab-enterprises.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.bignier at scilab-enterprises.com Fri Jan 13 18:06:54 2017 From: paul.bignier at scilab-enterprises.com (Paul Bignier) Date: Fri, 13 Jan 2017 18:06:54 +0100 Subject: [Scilab-users] Optim use and 'err' flag In-Reply-To: References: <9e5678541fe2780181db9bcb00246d16@free.fr> Message-ID: <102039fa-74b3-5175-5dd1-6f7383e6b901@scilab-enterprises.com> To complete my previous answer, the error arose from the built-in line search algorithm (err>10 means different flavors of it failing). In your case, it is pointing to a "too small deltaT", so yes it looks like your algorithm is converging but it has trouble finishing. You can get more info by using "imp=3" in your call to optim (as documented). If you are using a nightly build then use "iprint=3" (the online doc hasn't been updated yet). Best regards, Paul On 01/13/2017 05:11 PM, Paul Bignier wrote: > > > Hello Paul, > > Running your script gives me "err=12", which is not documented but I > don't get how you got 3? > > I see though that you reached 'evals' & 'iters', perhaps optim wanted > to continue but was capped by those. > > Feel free to use the format > function to get > more on-screen precision to your values. > > I will surely commit something soon in order to fix the "12" flag. > > Have a good evening, > > Paul > > > On 01/13/2017 02:39 PM, paul.carrico at free.fr wrote: >> Hi all >> >> I?m trying to improve how to use Optim in Scilab, so I?m still using >> the basic Rosembrock function; in the example hereafter, one can see >> that Optim goes back the Error flag to 3 and I do not understand why? >> >> The goal is to be able to check all the values of this flag in order >> to validate the result ; while the values are the optimized ones, the >> calculation indicates that the optimization fails ? >> >> I?m a bit loss ? so any feedback will be appreciated >> >> Thanks >> >> Paul >> >> ################################################################################### >> >> In my understanding: >> - err = 9 : everything went well ? ok >> >> - err = 3 : Optimization stops because of too small variations for x >> - err=1 : Norm of projected gradient lower than ? >> - err=2 : At last iteration f decreases by less than ? >> - err=4 : Optim stops: maximum number of calls to f is reached ==> >> increase nocf >> - err=5 : Optim stops: maximum number of iterations is reached. >> ==> increase niter >> - err=6 : Optim stops: too small variations in gradient direction. >> - err=7 : Stop during calculation of descent direction. >> - err=8 : Stop during calculation of estimated hessian. >> - err=10 : End of optimization (linear search fails). >> >> >> >> // Rosembrock function >> function f=rosembrock(x) >> f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2; >> endfunction >> >> // Cost function >> function [f, g, ind]=cost(x, ind) >> f = rosembrock(x); >> // g = derivative(rosembrock, x.',order = 4); >> // g = numderivative(rosembrock, x.',order = 4); >> g = numderivative(rosembrock, x.',0.1, order = 4); >> endfunction >> >> initial_parameters = [10 100] >> lower_bounds = [0 0]; >> upper_bounds = [1000 1000]; >> nocf = 100000; // number of call of f >> niter = 100000; // number of iterations >> [fopt, xopt, gopt, work, iters, evals, err] = >> optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter); >> xopt >> fopt >> iters >> evals >> err >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > > -- > Paul BIGNIER > Development engineer > ----------------------------------------------------------- > 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 at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -- Paul BIGNIER Development engineer ----------------------------------------------------------- Scilab Enterprises 143bis rue Yves Le Coz - 78000 Versailles, France Phone: +33.1.80.77.04.68 http://www.scilab-enterprises.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.carrico at free.fr Fri Jan 13 22:15:58 2017 From: paul.carrico at free.fr (paul.carrico at free.fr) Date: Fri, 13 Jan 2017 22:15:58 +0100 Subject: [Scilab-users] Optim use and 'err' flag In-Reply-To: References: <9e5678541fe2780181db9bcb00246d16@free.fr> Message-ID: Hi Paul I've been using the latest Scilab stable release on my working station; nevertheless you're right I get 12 when running the code on my laptop (same release but under Linux). Paul Le 2017-01-13 17:11, Paul Bignier a ?crit : > Hello Paul, > > Running your script gives me "err=12", which is not documented but I > don't get how you got 3? > > I see though that you reached 'evals' & 'iters', perhaps optim wanted > to continue but was capped by those. > > Feel free to use the format [1 [1]] function to get more on-screen > precision to your values. > > I will surely commit something soon in order to fix the "12" flag. > > Have a good evening, > > Paul > > On 01/13/2017 02:39 PM, paul.carrico at free.fr wrote: > >> Hi all >> >> I'm trying to improve how to use Optim in Scilab, so I'm still >> using the basic Rosembrock function; in the example hereafter, one >> can see that Optim goes back the Error flag to 3 and I do not >> understand why? >> >> The goal is to be able to check all the values of this flag in order >> to validate the result ; while the values are the optimized ones, >> the calculation indicates that the optimization fails ? >> >> I'm a bit loss ? so any feedback will be appreciated >> >> Thanks >> >> Paul > ################################################################################### > >> In my understanding: >> - err = 9 : everything went well ? ok >> >> - err = 3 : Optimization stops because of too small variations >> for x >> - err=1 : Norm of projected gradient lower than ? >> - err=2 : At last iteration f decreases by less than ? >> - err=4 : Optim stops: maximum number of calls to f is reached >> ==> increase nocf >> - err=5 : Optim stops: maximum number of iterations is reached. >> ==> increase niter >> - err=6 : Optim stops: too small variations in gradient >> direction. >> - err=7 : Stop during calculation of descent direction. >> - err=8 : Stop during calculation of estimated hessian. >> - err=10 : End of optimization (linear search fails). >> >> // Rosembrock function >> function f=rosembrock(x) >> f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2; >> endfunction >> >> // Cost function >> function [f, g, ind]=cost(x, ind) >> f = rosembrock(x); >> // g = derivative(rosembrock, x.',order = 4); >> // g = numderivative(rosembrock, x.',order = 4); >> g = numderivative(rosembrock, x.',0.1, order = 4); >> endfunction >> >> initial_parameters = [10 100] >> lower_bounds = [0 0]; >> upper_bounds = [1000 1000]; >> nocf = 100000; // number of call of f >> niter = 100000; // number of iterations >> [fopt, xopt, gopt, work, iters, evals, err] = > optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter); > >> xopt >> fopt >> iters >> evals >> err >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > > -- > Paul BIGNIER > Development engineer > ----------------------------------------------------------- > Scilab Enterprises > 143bis rue Yves Le Coz - 78000 Versailles, France > Phone: +33.1.80.77.04.68 > http://www.scilab-enterprises.com > > Links: > ------ > [1] https://help.scilab.org/docs/6.0.0/en_US/format.html > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users Links: ------ [1] https://help.scilab.org/docs/6.0.0/en_US/format.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.carrico at free.fr Fri Jan 13 22:22:27 2017 From: paul.carrico at free.fr (paul.carrico at free.fr) Date: Fri, 13 Jan 2017 22:22:27 +0100 Subject: [Scilab-users] Optim use and 'err' flag In-Reply-To: <102039fa-74b3-5175-5dd1-6f7383e6b901@scilab-enterprises.com> References: <9e5678541fe2780181db9bcb00246d16@free.fr> <102039fa-74b3-5175-5dd1-6f7383e6b901@scilab-enterprises.com> Message-ID: <63d455c838bfaf5fabe806b25c94edc3@free.fr> Paul, When using imp=3, I can see that 'iters' returns in fact the value of niter (ditto for evals and nocf): am I right ? [fopt, xopt, gopt, work, iters, evals, err] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,imp=3); (thanks for the support) Paul Le 2017-01-13 18:06, Paul Bignier a ?crit : > To complete my previous answer, the error arose from the built-in line > search algorithm (err>10 means different flavors of it failing). In > your case, it is pointing to a "too small deltaT", so yes it looks > like your algorithm is converging but it has trouble finishing. > > You can get more info by using "imp=3" in your call to optim (as > documented). If you are using a nightly build then use "iprint=3" (the > online doc hasn't been updated yet). > > Best regards, > > Paul > On 01/13/2017 05:11 PM, Paul Bignier wrote: > > Hello Paul, > > Running your script gives me "err=12", which is not documented but I > don't get how you got 3? > > I see though that you reached 'evals' & 'iters', perhaps optim > wanted to continue but was capped by those. > > Feel free to use the format [1 [1]] function to get more on-screen > precision to your values. > > I will surely commit something soon in order to fix the "12" flag. > > Have a good evening, > > Paul > > On 01/13/2017 02:39 PM, paul.carrico at free.fr wrote: > > Hi all > > I'm trying to improve how to use Optim in Scilab, so I'm still > using the basic Rosembrock function; in the example hereafter, one > can see that Optim goes back the Error flag to 3 and I do not > understand why? > > The goal is to be able to check all the values of this flag in > order to validate the result ; while the values are the optimized > ones, the calculation indicates that the optimization fails ? > > I'm a bit loss ? so any feedback will be appreciated > > Thanks > > Paul ################################################################################### >> In my understanding: >> - err = 9 : everything went well ? ok >> >> - err = 3 : Optimization stops because of too small variations >> for x >> - err=1 : Norm of projected gradient lower than ? >> - err=2 : At last iteration f decreases by less than ? >> - err=4 : Optim stops: maximum number of calls to f is reached >> ==> increase nocf >> - err=5 : Optim stops: maximum number of iterations is reached. >> ==> increase niter >> - err=6 : Optim stops: too small variations in gradient >> direction. >> - err=7 : Stop during calculation of descent direction. >> - err=8 : Stop during calculation of estimated hessian. >> - err=10 : End of optimization (linear search fails). >> >> // Rosembrock function >> function f=rosembrock(x) >> f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2; >> endfunction >> >> // Cost function >> function [f, g, ind]=cost(x, ind) >> f = rosembrock(x); >> // g = derivative(rosembrock, x.',order = 4); >> // g = numderivative(rosembrock, x.',order = 4); >> g = numderivative(rosembrock, x.',0.1, order = 4); >> endfunction >> >> initial_parameters = [10 100] >> lower_bounds = [0 0]; >> upper_bounds = [1000 1000]; >> nocf = 100000; // number of call of f >> niter = 100000; // number of iterations >> [fopt, xopt, gopt, work, iters, evals, err] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter); >> xopt >> fopt >> iters >> evals >> err >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > > -- > Paul BIGNIER > Development engineer > ----------------------------------------------------------- > 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 at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -- Paul BIGNIER Development engineer ----------------------------------------------------------- Scilab Enterprises 143bis rue Yves Le Coz - 78000 Versailles, France Phone: +33.1.80.77.04.68 http://www.scilab-enterprises.com Links: ------ [1] https://help.scilab.org/docs/6.0.0/en_US/format.html _______________________________________________ users mailing list users at lists.scilab.org http://lists.scilab.org/mailman/listinfo/users Links: ------ [1] https://help.scilab.org/docs/6.0.0/en_US/format.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Fri Jan 13 23:13:01 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Fri, 13 Jan 2017 23:13:01 +0100 Subject: [Scilab-users] Multiple 2D Plots in 3D Plane In-Reply-To: <1484304323619-4035339.post@n3.nabble.com> References: <1484304323619-4035339.post@n3.nabble.com> Message-ID: <587950ED.1050704@free.fr> Hello Werner, Le 13/01/2017 11:45, Werner a ?crit : > Dear members, > I want to put a few FFT results for different cases into one 3D plot. I > searched the whole forum but cant find a solution. > The final result have to look like this(without the circles at each point). > > You may use for instance plot3d3(), like in the following example: [X, Y] = meshgrid(0:0.3:10, 0:0.1:10); clf plot3d3(X,Y,5*cos(X.*Y/3).*exp(-abs(Y/3))) ax = gca(); ax.children(1).visible = "off"; HTH Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: ffecjibi.png Type: image/png Size: 13307 bytes Desc: not available URL: From paul.carrico at free.fr Sat Jan 14 11:52:15 2017 From: paul.carrico at free.fr (paul.carrico at free.fr) Date: Sat, 14 Jan 2017 11:52:15 +0100 Subject: [Scilab-users] Optim use and 'err' flag In-Reply-To: References: <9e5678541fe2780181db9bcb00246d16@free.fr> Message-ID: <16a0a17dfaadd73c5fe4c2d7d91172dc@free.fr> Hi Paul I found why I had err=3: I was "playing" with the step value of numderivative and I sent the last trial; neveryheless if you remove it of use a low value such as 0.01 instead of 0.1, the err value becomes 3 CQFD :-) Paul Le 2017-01-13 22:15, paul.carrico at free.fr a ?crit : > Hi Paul > > I've been using the latest Scilab stable release on my working > station; nevertheless you're right I get 12 when running the code on > my laptop (same release but under Linux). > > Paul > > Le 2017-01-13 17:11, Paul Bignier a ?crit : > > Hello Paul, > > Running your script gives me "err=12", which is not documented but I > don't get how you got 3? > > I see though that you reached 'evals' & 'iters', perhaps optim > wanted > to continue but was capped by those. > > Feel free to use the format [1 [1]] function to get more on-screen > precision to your values. > > I will surely commit something soon in order to fix the "12" flag. > > Have a good evening, > > Paul > > On 01/13/2017 02:39 PM, paul.carrico at free.fr wrote: > > Hi all > > I'm trying to improve how to use Optim in Scilab, so I'm still > using the basic Rosembrock function; in the example hereafter, one > can see that Optim goes back the Error flag to 3 and I do not > understand why? > > The goal is to be able to check all the values of this flag in > order > to validate the result ; while the values are the optimized ones, > the calculation indicates that the optimization fails ? > > I'm a bit loss ? so any feedback will be appreciated > > Thanks > > Paul ################################################################################### >> In my understanding: >> - err = 9 : everything went well ? ok >> >> - err = 3 : Optimization stops because of too small variations >> for x >> - err=1 : Norm of projected gradient lower than ? >> - err=2 : At last iteration f decreases by less than ? >> - err=4 : Optim stops: maximum number of calls to f is reached >> ==> increase nocf >> - err=5 : Optim stops: maximum number of iterations is reached. >> ==> increase niter >> - err=6 : Optim stops: too small variations in gradient >> direction. >> - err=7 : Stop during calculation of descent direction. >> - err=8 : Stop during calculation of estimated hessian. >> - err=10 : End of optimization (linear search fails). >> >> // Rosembrock function >> function f=rosembrock(x) >> f = ( 1 - x(1))^2 + 100*( x(2)-x(1)^2 )^2; >> endfunction >> >> // Cost function >> function [f, g, ind]=cost(x, ind) >> f = rosembrock(x); >> // g = derivative(rosembrock, x.',order = 4); >> // g = numderivative(rosembrock, x.',order = 4); >> g = numderivative(rosembrock, x.',0.1, order = 4); >> endfunction >> >> initial_parameters = [10 100] >> lower_bounds = [0 0]; >> upper_bounds = [1000 1000]; >> nocf = 100000; // number of call of f >> niter = 100000; // number of iterations >> [fopt, xopt, gopt, work, iters, evals, err] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter); >> xopt >> fopt >> iters >> evals >> err >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > > -- > Paul BIGNIER > Development engineer > ----------------------------------------------------------- > Scilab Enterprises > 143bis rue Yves Le Coz - 78000 Versailles, France > Phone: +33.1.80.77.04.68 > http://www.scilab-enterprises.com > > Links: > ------ > [1] https://help.scilab.org/docs/6.0.0/en_US/format.html > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users Links: ------ [1] https://help.scilab.org/docs/6.0.0/en_US/format.html _______________________________________________ users mailing list users at lists.scilab.org http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Sat Jan 14 15:50:21 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Sat, 14 Jan 2017 15:50:21 +0100 Subject: [Scilab-users] Redirecting the console output into a file Message-ID: <587A3AAD.6020107@free.fr> Hello, I am wondering if there is any way to temporarily redirect the console output into a file. I mean, not copying the stream as diary() does, but getting in a file the contents that are usually displayed, without displaying them. I tried to change %io(2) with the id of a file opened with mopen(). Even when unprotecting %io with predef("clear") before changing %io(2), it does not work. The best i did up to now is using diary, and then using clc(n) to clear the displayed contents. But it is an awful (and slow) solution. Any hint would be appreciated Regards Samuel Gougeon -------------- next part -------------- An HTML attachment was scrubbed... URL: From Serge.Steer at inria.fr Sat Jan 14 18:17:41 2017 From: Serge.Steer at inria.fr (Serge Steer) Date: Sat, 14 Jan 2017 18:17:41 +0100 Subject: [Scilab-users] Redirecting the console output into a file In-Reply-To: <587A3AAD.6020107@free.fr> References: <587A3AAD.6020107@free.fr> Message-ID: <3538e49f-285f-f2f6-a151-e1a02c8a94c0@inria.fr> You can use the diary function... Serge On 14/01/2017 15:50, Samuel Gougeon wrote: > Hello, > > I am wondering if there is any way to temporarily redirect the console > output into a file. > I mean, not copying the stream as diary() does, but getting in a file > the contents that are usually displayed, without displaying them. > > I tried to change %io(2) with the id of a file opened with mopen(). > Even when unprotecting %io with predef("clear") before changing > %io(2), it does not work. > > The best i did up to now is using diary, and then using clc(n) to > clear the displayed contents. > But it is an awful (and slow) solution. > > Any hint would be appreciated > Regards > Samuel Gougeon > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From Serge.Steer at inria.fr Sat Jan 14 18:19:06 2017 From: Serge.Steer at inria.fr (Serge Steer) Date: Sat, 14 Jan 2017 18:19:06 +0100 Subject: [Scilab-users] Redirecting the console output into a file In-Reply-To: <587A3AAD.6020107@free.fr> References: <587A3AAD.6020107@free.fr> Message-ID: <739cf6da-01d0-9434-7d93-bc93b59846e5@inria.fr> Sorry , forgot my answer, I read your mail too quickly... Serge On 14/01/2017 15:50, Samuel Gougeon wrote: > Hello, > > I am wondering if there is any way to temporarily redirect the console > output into a file. > I mean, not copying the stream as diary() does, but getting in a file > the contents that are usually displayed, without displaying them. > > I tried to change %io(2) with the id of a file opened with mopen(). > Even when unprotecting %io with predef("clear") before changing > %io(2), it does not work. > > The best i did up to now is using diary, and then using clc(n) to > clear the displayed contents. > But it is an awful (and slow) solution. > > Any hint would be appreciated > Regards > Samuel Gougeon > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From kingcreole1337 at gmail.com Sat Jan 14 20:37:00 2017 From: kingcreole1337 at gmail.com (Werner) Date: Sat, 14 Jan 2017 12:37:00 -0700 (MST) Subject: [Scilab-users] Multiple 2D Plots in 3D Plane In-Reply-To: <587950ED.1050704@free.fr> References: <1484304323619-4035339.post@n3.nabble.com> <587950ED.1050704@free.fr> Message-ID: <1484422620695-4035350.post@n3.nabble.com> Hi Samuel, thank you for your answer. I tried to implement your idea but I dont get the results I want. For a start I tried to do a 3D plot with only one FFT computation. So my data looks like: f= 1x256 - the frequency axis y=1x256 - the amplitude z=1x256 - the investigated case (the field consists of only ones) plot3d3(f,y,z) What I do here wrong? -- View this message in context: http://mailinglists.scilab.org/Multiple-2D-Plots-in-3D-Plane-tp4035339p4035350.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From sgougeon at free.fr Sat Jan 14 23:09:17 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Sat, 14 Jan 2017 23:09:17 +0100 Subject: [Scilab-users] Multiple 2D Plots in 3D Plane In-Reply-To: <1484422620695-4035350.post@n3.nabble.com> References: <1484304323619-4035339.post@n3.nabble.com> <587950ED.1050704@free.fr> <1484422620695-4035350.post@n3.nabble.com> Message-ID: <587AA18D.6040005@free.fr> Le 14/01/2017 20:37, Werner a ?crit : > Hi Samuel, > thank you for your answer. > I tried to implement your idea but I dont get the results I want. > For a start I tried to do a 3D plot with only one FFT computation. > So my data looks like: > f= 1x256 - the frequency axis > y=1x256 - the amplitude > z=1x256 - the investigated case (the field consists of only ones) > > plot3d3(f,y,z) > > Hard to help without knowing how/what you set in f, y and z. Here is a working example with inputs having the format of your (f,y,z): x = 1:100; plot3d3(x,x,x) e = gce(); e.thickness = 3; Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: hbigcicg.png Type: image/png Size: 4561 bytes Desc: not available URL: From sgougeon at free.fr Sat Jan 14 23:32:54 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Sat, 14 Jan 2017 23:32:54 +0100 Subject: [Scilab-users] Multiple 2D Plots in 3D Plane In-Reply-To: <1484422620695-4035350.post@n3.nabble.com> References: <1484304323619-4035339.post@n3.nabble.com> <587950ED.1050704@free.fr> <1484422620695-4035350.post@n3.nabble.com> Message-ID: <587AA715.3010207@free.fr> Le 14/01/2017 20:37, Werner a ?crit : > Hi Samuel, > thank you for your answer. > I tried to implement your idea but I dont get the results I want. > For a start I tried to do a 3D plot with only one FFT computation. > So my data looks like: > f= 1x256 - the frequency axis > y=1x256 - the amplitude > z=1x256 - the investigated case (the field consists of only ones) > > plot3d3(f,y,z) Another example, with f(x) at constant y=1: x=1:100; clf plot3d3(x,ones(x),x) e = gce(); e.thickness = 3; ax = gca(); ax.rotation_angles = [78 181]; -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: dbcjgacj.png Type: image/png Size: 5294 bytes Desc: not available URL: From kingcreole1337 at gmail.com Sun Jan 15 10:06:32 2017 From: kingcreole1337 at gmail.com (Werner) Date: Sun, 15 Jan 2017 02:06:32 -0700 (MST) Subject: [Scilab-users] Multiple 2D Plots in 3D Plane In-Reply-To: <587AA715.3010207@free.fr> References: <1484304323619-4035339.post@n3.nabble.com> <587950ED.1050704@free.fr> <1484422620695-4035350.post@n3.nabble.com> <587AA715.3010207@free.fr> Message-ID: <1484471192915-4035354.post@n3.nabble.com> Thank you so much Samuel. I got this thing done. My fault was in the plot3d3 parameter . I put the y-data of the 2D-Plot into the z-axis and I got what I wanted. Cheers! -- View this message in context: http://mailinglists.scilab.org/Multiple-2D-Plots-in-3D-Plane-tp4035339p4035354.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From paul.carrico at free.fr Sun Jan 15 11:39:41 2017 From: paul.carrico at free.fr (paul.carrico at free.fr) Date: Sun, 15 Jan 2017 11:39:41 +0100 Subject: [Scilab-users] 'optim' vs 'Nelder-Mead' ... or difficulties to use 'optim' Message-ID: <64d0946649ef949ed9e8c5b735c87ba1@free.fr> Hi all Well, from a "macro" point of view, gradient based methods (order 1 method) should be more efficient than Nelder-Mead one (order 0) especially for 1D topic, shouldn't be? In the case here bellow, when I use 'Optim' it is not the case in comparison to 'NelderMead'... I don'y know what I'm doing wrong but I decide to frop off 'optim' in favor tp Nelder-Mead - nevertheless the later method requires much more iterations :-( I'll be interested by some feedback on such topic, either in the mailing list (or in MP in order to not pollute it). Paul ########################################" 'optim' ######################################## mode(0) function f=lineaire(x, a2, b2) f = a2*x+b2; endfunction function g=racine(x, a1, b1) g = sqrt(a1*x) + b1; endfunction function f=target(x) val_lin = lineaire(x,1,2); val_rac = racine(x,10,6); f = abs(val_lin - val_rac); endfunction // Cost function : function [f, g, ind]=cost(x, ind) f = target(x); // g = numderivative(target, x.'); // g = numderivative(target, x.',0.1,order = 2); g = numderivative(target, x.',order = 2); // better but why ??? h automatic works better ??? // g = numderivative(target, x.',order = 4); // g = numderivative(target, x.',0.1, order = 4); endfunction // optimisation avec optim initial_parameters = [50] lower_bounds = [0]; upper_bounds = [1000]; nocf = 1000; // number of call of f niter = 1000; // number of iterations [fopt, xopt, gopt, work, iters, evals, err] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,imp=3); xopt fopt err // tra?age courbes x = linspace(0,50,1000)'; plot_raci = racine(x,10,6); plot_lin = lineaire(x,1,2); scf(1); drawlater(); xgrid(3); f = gcf(); //f f.figure_size = [1000, 1000]; f.background = color(255,255,255); a = gca(); //a a.font_size = 2; a.x_label.text = "X axis" ; a.x_location="bottom"; a.x_label.font_angle=0; a.x_label.font_size = 4; a.y_label.text = "Y axis"; a.y_location="left"; a.y_label.font_angle=-90; a.Y_label.font_size = 4; a.title.text = "Title"; a.title.font_size = 5; a.line_style = 1; // d?but des courbes plot(x,plot_lin); e1 = gce(); p1 = e1.children; p1.thickness = 1; p1.line_style = 1; p1.foreground = 3; plot(x,plot_raci); e2 = gce(); p2 = e2.children; p2.thickness = 1; p2.line_style = 1; p2.foreground = 2; drawnow(); ####################################### Nelder Mead ####################################### mode(0) function f=lineaire(x, a2, b2) f = a2*x+b2; endfunction function g=racine(x, a1, b1) g = sqrt(a1*x) + b1; endfunction function [f, index]=target(x, index) val_lin = lineaire(x,1,2); val_rac = racine(x,10,6); f = abs(val_lin - val_rac); endfunction // optimisation avec optim initial_parameters = [50] lower_bounds = [0]; upper_bounds = [1000]; nm = neldermead_new (); nm = neldermead_configure(nm,"-numberofvariables",1); nm = neldermead_configure(nm,"-function",target); nm = neldermead_configure(nm,"-x0",initial_parameters); nm = neldermead_configure(nm,"-maxiter",1000); nm = neldermead_configure(nm,"-maxfunevals",1000); nm = neldermead_configure(nm,"-tolfunrelative",10*%eps); nm = neldermead_configure(nm,"-tolxrelative",10*%eps); nm = neldermead_configure(nm,"-method","box"); nm = neldermead_configure(nm,"-boundsmin",lower_bounds); nm = neldermead_configure(nm,"-boundsmax", upper_bounds); nm = neldermead_search(nm); nm = neldermead_restart(nm); xopt = neldermead_get(nm,"-xopt") fopt = neldermead_get(nm,"-fopt") nm = neldermead_destroy(nm); // tra?age courbes x = linspace(0,50,1000)'; a1 = 10; b1 = 6; // b1 > b2 here a2 = 1; b2 = 2; plot_raci = racine(x,a1,b1); plot_lin = lineaire(x,a2,b2); scf(1); drawlater(); xgrid(3); f = gcf(); //f f.figure_size = [1000, 1000]; f.background = color(255,255,255); a = gca(); //a a.font_size = 2; a.x_label.text = "X axis" ; a.x_location="bottom"; a.x_label.font_angle=0; a.x_label.font_size = 4; a.y_label.text = "Y axis"; a.y_location="left"; a.y_label.font_angle=-90; a.Y_label.font_size = 4; a.title.text = "Title"; a.title.font_size = 5; a.line_style = 1; // d?but des courbes plot(x,plot_lin); e1 = gce(); p1 = e1.children; p1.thickness = 1; p1.line_style = 1; p1.foreground = 3; plot(x,plot_raci); e2 = gce(); p2 = e2.children; p2.thickness = 1; p2.line_style = 1; p2.foreground = 2; drawnow(); -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephane.mottelet at utc.fr Sun Jan 15 12:59:43 2017 From: stephane.mottelet at utc.fr (=?utf-8?Q?St=C3=A9phane_Mottelet?=) Date: Sun, 15 Jan 2017 12:59:43 +0100 Subject: [Scilab-users] 'optim' vs 'Nelder-Mead' ... or difficulties to use 'optim' In-Reply-To: <64d0946649ef949ed9e8c5b735c87ba1@free.fr> References: <64d0946649ef949ed9e8c5b735c87ba1@free.fr> Message-ID: Hello Your target function is not differrentiable (Because of the absolute value). That explains why optim has some difficulties. Using a square instead should give the advantage to optim against nelder-mead. S. > Le 15 janv. 2017 ? 11:39, paul.carrico at free.fr a ?crit : > > Hi all > > Well, from a "macro" point of view, gradient based methods (order 1 method) should be more efficient than Nelder-Mead one (order 0) especially for 1D topic, shouldn't be? > > In the case here bellow, when I use 'Optim' it is not the case in comparison to 'NelderMead'... I don'y know what I'm doing wrong but I decide to frop off 'optim' in favor tp Nelder-Mead - nevertheless the later method requires much more iterations :-( > > I'll be interested by some feedback on such topic, either in the mailing list (or in MP in order to not pollute it). > > Paul > ########################################" > 'optim' > ######################################## > mode(0) > > function f=lineaire(x, a2, b2) > f = a2*x+b2; > endfunction > > function g=racine(x, a1, b1) > g = sqrt(a1*x) + b1; > endfunction > > function f=target(x) > val_lin = lineaire(x,1,2); > val_rac = racine(x,10,6); > f = abs(val_lin - val_rac); > endfunction > > // Cost function : > function [f, g, ind]=cost(x, ind) > f = target(x); > // g = numderivative(target, x.'); > // g = numderivative(target, x.',0.1,order = 2); > g = numderivative(target, x.',order = 2); // better but why ??? h automatic works better ??? > // g = numderivative(target, x.',order = 4); > // g = numderivative(target, x.',0.1, order = 4); > endfunction > > // optimisation avec optim > initial_parameters = [50] > lower_bounds = [0]; > upper_bounds = [1000]; > nocf = 1000; // number of call of f > niter = 1000; // number of iterations > [fopt, xopt, gopt, work, iters, evals, err] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,imp=3); > xopt > fopt > err > > // tra?age courbes > x = linspace(0,50,1000)'; > plot_raci = racine(x,10,6); > plot_lin = lineaire(x,1,2); > > scf(1); > drawlater(); > xgrid(3); > f = gcf(); > //f > f.figure_size = [1000, 1000]; > f.background = color(255,255,255); > a = gca(); > //a > a.font_size = 2; > a.x_label.text = "X axis" ; > a.x_location="bottom"; > a.x_label.font_angle=0; > a.x_label.font_size = 4; > a.y_label.text = "Y axis"; > a.y_location="left"; > a.y_label.font_angle=-90; > a.Y_label.font_size = 4; > a.title.text = "Title"; > a.title.font_size = 5; > a.line_style = 1; > > // d?but des courbes > plot(x,plot_lin); > e1 = gce(); > p1 = e1.children; > p1.thickness = 1; > p1.line_style = 1; > p1.foreground = 3; > > plot(x,plot_raci); > e2 = gce(); > p2 = e2.children; > p2.thickness = 1; > p2.line_style = 1; > p2.foreground = 2; > drawnow(); > > ####################################### > Nelder Mead > ####################################### > mode(0) > > function f=lineaire(x, a2, b2) > f = a2*x+b2; > endfunction > > function g=racine(x, a1, b1) > g = sqrt(a1*x) + b1; > endfunction > > function [f, index]=target(x, index) > val_lin = lineaire(x,1,2); > val_rac = racine(x,10,6); > f = abs(val_lin - val_rac); > endfunction > > // optimisation avec optim > initial_parameters = [50] > lower_bounds = [0]; > upper_bounds = [1000]; > > nm = neldermead_new (); > nm = neldermead_configure(nm,"-numberofvariables",1); > nm = neldermead_configure(nm,"-function",target); > nm = neldermead_configure(nm,"-x0",initial_parameters); > nm = neldermead_configure(nm,"-maxiter",1000); > nm = neldermead_configure(nm,"-maxfunevals",1000); > nm = neldermead_configure(nm,"-tolfunrelative",10*%eps); > nm = neldermead_configure(nm,"-tolxrelative",10*%eps); > nm = neldermead_configure(nm,"-method","box"); > nm = neldermead_configure(nm,"-boundsmin",lower_bounds); > nm = neldermead_configure(nm,"-boundsmax", upper_bounds); > nm = neldermead_search(nm); > nm = neldermead_restart(nm); > xopt = neldermead_get(nm,"-xopt") > fopt = neldermead_get(nm,"-fopt") > nm = neldermead_destroy(nm); > > // tra?age courbes > x = linspace(0,50,1000)'; > a1 = 10; b1 = 6; // b1 > b2 here > a2 = 1; b2 = 2; > > plot_raci = racine(x,a1,b1); > plot_lin = lineaire(x,a2,b2); > > scf(1); > drawlater(); > xgrid(3); > f = gcf(); > //f > f.figure_size = [1000, 1000]; > f.background = color(255,255,255); > a = gca(); > //a > a.font_size = 2; > a.x_label.text = "X axis" ; > a.x_location="bottom"; > a.x_label.font_angle=0; > a.x_label.font_size = 4; > a.y_label.text = "Y axis"; > a.y_location="left"; > a.y_label.font_angle=-90; > a.Y_label.font_size = 4; > a.title.text = "Title"; > a.title.font_size = 5; > a.line_style = 1; > > // d?but des courbes > plot(x,plot_lin); > e1 = gce(); > p1 = e1.children; > p1.thickness = 1; > p1.line_style = 1; > p1.foreground = 3; > > plot(x,plot_raci); > e2 = gce(); > p2 = e2.children; > p2.thickness = 1; > p2.line_style = 1; > p2.foreground = 2; > drawnow(); > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users From paul.carrico at free.fr Sun Jan 15 18:04:14 2017 From: paul.carrico at free.fr (paul.carrico at free.fr) Date: Sun, 15 Jan 2017 18:04:14 +0100 Subject: [Scilab-users] 'optim' vs 'Nelder-Mead' ... or difficulties to use 'optim' In-Reply-To: References: <64d0946649ef949ed9e8c5b735c87ba1@free.fr> Message-ID: <4ccec3f1dd562124523b7f9b02bbe5d8@free.fr> Hi Stephane, You're right, I forgot my basis :-) Nevertheless when I re-write the target function as the following, it fails after some iterations and I do not understand the origin (??) Paul ####################################### function f=target(x) val_lin = lineaire(x,1,2); val_rac = racine(x,10,6); // f = abs(val_lin - val_rac); f = sqrt((val_lin - val_rac)^2); printf("f = %g\n",f); endfunction ###################################### Console message: *********** qnbd (with bound cstr) **************** dimension= 1, epsq= 0.2220446049250313E-15, verbosity level: imp= 3 max number of iterations allowed: iter= 1000 max number of calls to costf allowed: nap= 1000 ------------------------------------------------ f = 23.6393 f = 25.1965 f = 22.0911 qnbd : iter= 1 f= 0.2363932D+02 qnbd : nbre fact 1 defact 0 total var factorisees 1 rlbd tp= 0.6440E+02 tmax= 0.1000E+11 dh0/dt=-0.6027E+00 f = 21.6468 f = 23.1924 f = 20.111 es t= 0.3318E+01 h=-0.1992E+01 dh/dt=-0.5981E+00 dfh/dt=-0.6005E+00 dt 0.3E+01 f = 4 f = 6.47214 f = 6 al_parameters,'qn','ar',nocf,niter,imp=3) !--error 98 La variable retourn?e par la fonction Scilab pass?e en argument n'est pas valide. at line 36 of exec file called by : RFACE/Rosembrock/fonctions_test.sce', -1 t= 0.6440E+02 h=-0.1992E+01 dh/dt=-0.5981E+00 dfh/dt= 0.0000E+00 dt 0.6E+02 qnbd : indqn= 0 Le 2017-01-15 12:59, St?phane Mottelet a ?crit : > Hello > > Your target function is not differrentiable (Because of the absolute > value). That explains why optim has some difficulties. Using a square > instead should give the advantage to optim against nelder-mead. > > S. > >> Le 15 janv. 2017 ? 11:39, paul.carrico at free.fr a ?crit : >> >> Hi all >> >> Well, from a "macro" point of view, gradient based methods (order 1 method) should be more efficient than Nelder-Mead one (order 0) especially for 1D topic, shouldn't be? >> >> In the case here bellow, when I use 'Optim' it is not the case in comparison to 'NelderMead'... I don'y know what I'm doing wrong but I decide to frop off 'optim' in favor tp Nelder-Mead - nevertheless the later method requires much more iterations :-( >> >> I'll be interested by some feedback on such topic, either in the mailing list (or in MP in order to not pollute it). >> >> Paul >> ########################################" >> 'optim' >> ######################################## >> mode(0) >> >> function f=lineaire(x, a2, b2) >> f = a2*x+b2; >> endfunction >> >> function g=racine(x, a1, b1) >> g = sqrt(a1*x) + b1; >> endfunction >> >> function f=target(x) >> val_lin = lineaire(x,1,2); >> val_rac = racine(x,10,6); >> f = abs(val_lin - val_rac); >> endfunction >> >> // Cost function : >> function [f, g, ind]=cost(x, ind) >> f = target(x); >> // g = numderivative(target, x.'); >> // g = numderivative(target, x.',0.1,order = 2); >> g = numderivative(target, x.',order = 2); // better but why ??? h automatic works better ??? >> // g = numderivative(target, x.',order = 4); >> // g = numderivative(target, x.',0.1, order = 4); >> endfunction >> >> // optimisation avec optim >> initial_parameters = [50] >> lower_bounds = [0]; >> upper_bounds = [1000]; >> nocf = 1000; // number of call of f >> niter = 1000; // number of iterations >> [fopt, xopt, gopt, work, iters, evals, err] = optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,imp=3); >> xopt >> fopt >> err >> >> // tra?age courbes >> x = linspace(0,50,1000)'; >> plot_raci = racine(x,10,6); >> plot_lin = lineaire(x,1,2); >> >> scf(1); >> drawlater(); >> xgrid(3); >> f = gcf(); >> //f >> f.figure_size = [1000, 1000]; >> f.background = color(255,255,255); >> a = gca(); >> //a >> a.font_size = 2; >> a.x_label.text = "X axis" ; >> a.x_location="bottom"; >> a.x_label.font_angle=0; >> a.x_label.font_size = 4; >> a.y_label.text = "Y axis"; >> a.y_location="left"; >> a.y_label.font_angle=-90; >> a.Y_label.font_size = 4; >> a.title.text = "Title"; >> a.title.font_size = 5; >> a.line_style = 1; >> >> // d?but des courbes >> plot(x,plot_lin); >> e1 = gce(); >> p1 = e1.children; >> p1.thickness = 1; >> p1.line_style = 1; >> p1.foreground = 3; >> >> plot(x,plot_raci); >> e2 = gce(); >> p2 = e2.children; >> p2.thickness = 1; >> p2.line_style = 1; >> p2.foreground = 2; >> drawnow(); >> >> ####################################### >> Nelder Mead >> ####################################### >> mode(0) >> >> function f=lineaire(x, a2, b2) >> f = a2*x+b2; >> endfunction >> >> function g=racine(x, a1, b1) >> g = sqrt(a1*x) + b1; >> endfunction >> >> function [f, index]=target(x, index) >> val_lin = lineaire(x,1,2); >> val_rac = racine(x,10,6); >> f = abs(val_lin - val_rac); >> endfunction >> >> // optimisation avec optim >> initial_parameters = [50] >> lower_bounds = [0]; >> upper_bounds = [1000]; >> >> nm = neldermead_new (); >> nm = neldermead_configure(nm,"-numberofvariables",1); >> nm = neldermead_configure(nm,"-function",target); >> nm = neldermead_configure(nm,"-x0",initial_parameters); >> nm = neldermead_configure(nm,"-maxiter",1000); >> nm = neldermead_configure(nm,"-maxfunevals",1000); >> nm = neldermead_configure(nm,"-tolfunrelative",10*%eps); >> nm = neldermead_configure(nm,"-tolxrelative",10*%eps); >> nm = neldermead_configure(nm,"-method","box"); >> nm = neldermead_configure(nm,"-boundsmin",lower_bounds); >> nm = neldermead_configure(nm,"-boundsmax", upper_bounds); >> nm = neldermead_search(nm); >> nm = neldermead_restart(nm); >> xopt = neldermead_get(nm,"-xopt") >> fopt = neldermead_get(nm,"-fopt") >> nm = neldermead_destroy(nm); >> >> // tra?age courbes >> x = linspace(0,50,1000)'; >> a1 = 10; b1 = 6; // b1 > b2 here >> a2 = 1; b2 = 2; >> >> plot_raci = racine(x,a1,b1); >> plot_lin = lineaire(x,a2,b2); >> >> scf(1); >> drawlater(); >> xgrid(3); >> f = gcf(); >> //f >> f.figure_size = [1000, 1000]; >> f.background = color(255,255,255); >> a = gca(); >> //a >> a.font_size = 2; >> a.x_label.text = "X axis" ; >> a.x_location="bottom"; >> a.x_label.font_angle=0; >> a.x_label.font_size = 4; >> a.y_label.text = "Y axis"; >> a.y_location="left"; >> a.y_label.font_angle=-90; >> a.Y_label.font_size = 4; >> a.title.text = "Title"; >> a.title.font_size = 5; >> a.line_style = 1; >> >> // d?but des courbes >> plot(x,plot_lin); >> e1 = gce(); >> p1 = e1.children; >> p1.thickness = 1; >> p1.line_style = 1; >> p1.foreground = 3; >> >> plot(x,plot_raci); >> e2 = gce(); >> p2 = e2.children; >> p2.thickness = 1; >> p2.line_style = 1; >> p2.foreground = 2; >> drawnow(); >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.bignier at scilab-enterprises.com Mon Jan 16 10:22:31 2017 From: paul.bignier at scilab-enterprises.com (Paul Bignier) Date: Mon, 16 Jan 2017 10:22:31 +0100 Subject: [Scilab-users] 'optim' vs 'Nelder-Mead' ... or difficulties to use 'optim' In-Reply-To: <4ccec3f1dd562124523b7f9b02bbe5d8@free.fr> References: <64d0946649ef949ed9e8c5b735c87ba1@free.fr> <4ccec3f1dd562124523b7f9b02bbe5d8@free.fr> Message-ID: Hello Paul, Rewriting the function as follows: function f=target(x) val_lin = lineaire(x,1,2); val_rac = racine(x,10,6); // f = abs(val_lin - val_rac); f = sqrt((val_lin - val_rac)^2); disp(f) if ~isreal(f) then pause; end endfunction will show you that at a certain iteraton 'x=-2' so "racine(x,10,6)" returns a complex number and in turn sqrt() does, when abs() returned the modulus (I added a 'pause' so you can play with the variables). Regards, Paul On 01/15/2017 06:04 PM, paul.carrico at free.fr wrote: > Hi Stephane, > You're right, I forgot my basis :-) > Nevertheless when I re-write the target function as the following, it > fails after some iterations and I do not understand the origin (??) > Paul > ####################################### > function f=target(x) > val_lin = lineaire(x,1,2); > val_rac = racine(x,10,6); > // f = abs(val_lin - val_rac); > f = sqrt((val_lin - val_rac)^2); > printf("f = %g\n",f); > endfunction > ###################################### > Console message: > *********** qnbd (with bound cstr) **************** > dimension= 1, epsq= 0.2220446049250313E-15, verbosity level: imp= 3 > max number of iterations allowed: iter= 1000 > max number of calls to costf allowed: nap= 1000 > ------------------------------------------------ > f = 23.6393 > f = 25.1965 > f = 22.0911 > qnbd : iter= 1 f= 0.2363932D+02 > qnbd : nbre fact 1 defact 0 total var factorisees 1 > rlbd tp= 0.6440E+02 tmax= 0.1000E+11 dh0/dt=-0.6027E+00 > f = 21.6468 > f = 23.1924 > f = 20.111 > es t= 0.3318E+01 h=-0.1992E+01 dh/dt=-0.5981E+00 dfh/dt=-0.6005E+00 dt > 0.3E+01 > f = 4 > f = 6.47214 > f = 6 > al_parameters,'qn','ar',nocf,niter,imp=3) > !--error 98 > La variable retourn?e par la fonction Scilab pass?e en argument n'est > pas valide. > at line 36 of exec file called by : > RFACE/Rosembrock/fonctions_test.sce', -1 > > t= 0.6440E+02 h=-0.1992E+01 dh/dt=-0.5981E+00 dfh/dt= 0.0000E+00 dt > 0.6E+02 > qnbd : indqn= 0 > Le 2017-01-15 12:59, St?phane Mottelet a ?crit : >> Hello >> >> Your target function is not differrentiable (Because of the absolute >> value). That explains why optim has some difficulties. Using a square >> instead should give the advantage to optim against nelder-mead. >> >> S. >> >> >> >>> Le 15 janv. 2017 ? 11:39, paul.carrico at free.fr >>> a ?crit : >>> >>> Hi all >>> >>> Well, from a "macro" point of view, gradient based methods (order 1 >>> method) should be more efficient than Nelder-Mead one (order 0) >>> especially for 1D topic, shouldn't be? >>> >>> In the case here bellow, when I use 'Optim' it is not the case in >>> comparison to 'NelderMead'... I don'y know what I'm doing wrong but >>> I decide to frop off 'optim' in favor tp Nelder-Mead - nevertheless >>> the later method requires much more iterations :-( >>> >>> I'll be interested by some feedback on such topic, either in the >>> mailing list (or in MP in order to not pollute it). >>> >>> Paul >>> ########################################" >>> 'optim' >>> ######################################## >>> mode(0) >>> >>> function f=lineaire(x, a2, b2) >>> f = a2*x+b2; >>> endfunction >>> >>> function g=racine(x, a1, b1) >>> g = sqrt(a1*x) + b1; >>> endfunction >>> >>> function f=target(x) >>> val_lin = lineaire(x,1,2); >>> val_rac = racine(x,10,6); >>> f = abs(val_lin - val_rac); >>> endfunction >>> >>> // Cost function : >>> function [f, g, ind]=cost(x, ind) >>> f = target(x); >>> // g = numderivative(target, x.'); >>> // g = numderivative(target, x.',0.1,order = 2); >>> g = numderivative(target, x.',order = 2); // better but why ??? >>> h automatic works better ??? >>> // g = numderivative(target, x.',order = 4); >>> // g = numderivative(target, x.',0.1, order = 4); >>> endfunction >>> >>> // optimisation avec optim >>> initial_parameters = [50] >>> lower_bounds = [0]; >>> upper_bounds = [1000]; >>> nocf = 1000; // number of call of f >>> niter = 1000; // number of iterations >>> [fopt, xopt, gopt, work, iters, evals, err] = >>> optim(cost,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,imp=3); >>> xopt >>> fopt >>> err >>> >>> // tra?age courbes >>> x = linspace(0,50,1000)'; >>> plot_raci = racine(x,10,6); >>> plot_lin = lineaire(x,1,2); >>> >>> scf(1); >>> drawlater(); >>> xgrid(3); >>> f = gcf(); >>> //f >>> f.figure_size = [1000, 1000]; >>> f.background = color(255,255,255); >>> a = gca(); >>> //a >>> a.font_size = 2; >>> a.x_label.text = "X axis" ; >>> a.x_location="bottom"; >>> a.x_label.font_angle=0; >>> a.x_label.font_size = 4; >>> a.y_label.text = "Y axis"; >>> a.y_location="left"; >>> a.y_label.font_angle=-90; >>> a.Y_label.font_size = 4; >>> a.title.text = "Title"; >>> a.title.font_size = 5; >>> a.line_style = 1; >>> >>> // d?but des courbes >>> plot(x,plot_lin); >>> e1 = gce(); >>> p1 = e1.children; >>> p1.thickness = 1; >>> p1.line_style = 1; >>> p1.foreground = 3; >>> >>> plot(x,plot_raci); >>> e2 = gce(); >>> p2 = e2.children; >>> p2.thickness = 1; >>> p2.line_style = 1; >>> p2.foreground = 2; >>> drawnow(); >>> >>> ####################################### >>> Nelder Mead >>> ####################################### >>> mode(0) >>> >>> function f=lineaire(x, a2, b2) >>> f = a2*x+b2; >>> endfunction >>> >>> function g=racine(x, a1, b1) >>> g = sqrt(a1*x) + b1; >>> endfunction >>> >>> function [f, index]=target(x, index) >>> val_lin = lineaire(x,1,2); >>> val_rac = racine(x,10,6); >>> f = abs(val_lin - val_rac); >>> endfunction >>> >>> // optimisation avec optim >>> initial_parameters = [50] >>> lower_bounds = [0]; >>> upper_bounds = [1000]; >>> >>> nm = neldermead_new (); >>> nm = neldermead_configure(nm,"-numberofvariables",1); >>> nm = neldermead_configure(nm,"-function",target); >>> nm = neldermead_configure(nm,"-x0",initial_parameters); >>> nm = neldermead_configure(nm,"-maxiter",1000); >>> nm = neldermead_configure(nm,"-maxfunevals",1000); >>> nm = neldermead_configure(nm,"-tolfunrelative",10*%eps); >>> nm = neldermead_configure(nm,"-tolxrelative",10*%eps); >>> nm = neldermead_configure(nm,"-method","box"); >>> nm = neldermead_configure(nm,"-boundsmin",lower_bounds); >>> nm = neldermead_configure(nm,"-boundsmax", upper_bounds); >>> nm = neldermead_search(nm); >>> nm = neldermead_restart(nm); >>> xopt = neldermead_get(nm,"-xopt") >>> fopt = neldermead_get(nm,"-fopt") >>> nm = neldermead_destroy(nm); >>> >>> // tra?age courbes >>> x = linspace(0,50,1000)'; >>> a1 = 10; b1 = 6; // b1 > b2 here >>> a2 = 1; b2 = 2; >>> >>> plot_raci = racine(x,a1,b1); >>> plot_lin = lineaire(x,a2,b2); >>> >>> scf(1); >>> drawlater(); >>> xgrid(3); >>> f = gcf(); >>> //f >>> f.figure_size = [1000, 1000]; >>> f.background = color(255,255,255); >>> a = gca(); >>> //a >>> a.font_size = 2; >>> a.x_label.text = "X axis" ; >>> a.x_location="bottom"; >>> a.x_label.font_angle=0; >>> a.x_label.font_size = 4; >>> a.y_label.text = "Y axis"; >>> a.y_location="left"; >>> a.y_label.font_angle=-90; >>> a.Y_label.font_size = 4; >>> a.title.text = "Title"; >>> a.title.font_size = 5; >>> a.line_style = 1; >>> >>> // d?but des courbes >>> plot(x,plot_lin); >>> e1 = gce(); >>> p1 = e1.children; >>> p1.thickness = 1; >>> p1.line_style = 1; >>> p1.foreground = 3; >>> >>> plot(x,plot_raci); >>> e2 = gce(); >>> p2 = e2.children; >>> p2.thickness = 1; >>> p2.line_style = 1; >>> p2.foreground = 2; >>> drawnow(); >>> _______________________________________________ >>> users mailing list >>> users at lists.scilab.org >>> http://lists.scilab.org/mailman/listinfo/users >> >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -- Paul BIGNIER Development engineer ----------------------------------------------------------- Scilab Enterprises 143bis rue Yves Le Coz - 78000 Versailles, France Phone: +33.1.80.77.04.68 http://www.scilab-enterprises.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.carrico at esterline.com Mon Jan 16 10:30:20 2017 From: paul.carrico at esterline.com (Carrico, Paul) Date: Mon, 16 Jan 2017 09:30:20 +0000 Subject: [Scilab-users] Optim & NelderMead use [closed] Message-ID: <3A6B7233274DB449A2A0053A47684F953F782A0A@BGS-EX01.auxitrol.ad> Hi all After performing tests (and modifying the target function as it should have been done first), I can better understand how to use 'optim' and 'Neldermead' procedures. For my needs the mean flags are : - Step h in numderivative --> usefull reading as "EE 221 Numerical Computing" Scott Hudson - The threshold epsg in optim (%eps is the default value - such high accuracy is not necessary for my application - furthermore using a value such as 1e-5 leads to err=1 that is correct for checking) - Ditto for Nelder-Mead and '-tolfunrelative' & '-tolxrelative' Now it works fine :-) Thanks all for the support Paul ##################################################################### mode(0) clear global count_use; count_use = 0; // **** function f=lineaire(x, a2, b2) f = a2*x+b2; endfunction // **** function g=racine(x, a1, b1) g = sqrt(a1*x) + b1; endfunction // **** function f=target(x, a1, b1, a2, b2) val_lin = lineaire(x,a2,b2); val_rac = racine(x,a1,b1); f = sqrt((val_lin - val_rac)^2); global count_use; count_use = count_use +1; endfunction // Cost function: function [f, g, ind]=cost(x, ind, a1, b1, a2, b2) f = target(x); // g = numderivative(target, x.',order = 4); g = numderivative(target, x.',1e-3, order = 4); // 1E-3 => see EE 221 "Numerical Computing" Scott Hudson // Study of the influence of h on the number of target function calculation & the fopt accuracy: // (epsg = %eps here) // h = 1.e-1 => number = 220 & fopt = 2.242026e-05 // h = 1.e-2 => number = 195 & fopt = 2.267564e-07 // h = 1.e-3 => number = 170 & fopt = 2.189495e-09 ++++++ // h = 1.e-4 => number = 190 & fopt = 1.941203e-11 // h = 1.e-5 => number = 215 & fopt = 2.131628e-13 // h = 1.e-6 => number = 235 & fopt = 0. // h = 1.e-7 => number = 255 & fopt = 7.105427e-15 // h = 1.e-8 => number = 275 & fopt = 0. endfunction // ************************* // optimisation with optim initial_parameters = [10] lower_bounds = [0]; upper_bounds = [1000]; nocf = 1000; // number max of call of f niter = 1000; // number max of iterations a1 = 30; b1 = 2.5; a2 = 1; b2 = 2; epsg = 1e-5; // gradient norm threshold (%eps by defaut) --> lead to err = 1 !!! //epsg = %eps; // lead to Err = 13 epsf = 0; //threshold controlling decreasing of f (epsf = 0 by defaut) costf = list (cost, a1, b1, a2, b2); [fopt, xopt, gopt, work, iters, evals, err] = optim(costf,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,epsg,epsf); printf("Optimized value : %g\n",xopt); printf("min cost function value (should be as closed as possible to 0) ; %e\n",fopt); printf('Number of calculations = %d !!!\n',count_use); // Curves definition x = linspace(0,50,1000)'; plot_raci = racine(x,a1,b1); plot_lin = lineaire(x,a2,b2); scf(1); drawlater(); xgrid(3); f = gcf(); //f f.figure_size = [1000, 1000]; f.background = color(255,255,255); a = gca(); //a a.font_size = 2; a.x_label.text = "X axis" ; a.x_location="bottom"; a.x_label.font_angle=0; a.x_label.font_size = 4; a.y_label.text = "Y axis"; a.y_location="left"; a.y_label.font_angle=-90; a.Y_label.font_size = 4; a.title.text = "Title"; a.title.font_size = 5; a.line_style = 1; // Curves plot plot(x,plot_lin); e1 = gce(); p1 = e1.children; p1.thickness = 1; p1.line_style = 1; p1.foreground = 3; plot(x,plot_raci); e2 = gce(); p2 = e2.children; p2.thickness = 1; p2.line_style = 1; p2.foreground = 2; drawnow(); EXPORT CONTROL : Cet email ne contient pas de donn?es techniques This email does not contain technical data -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephane.mottelet at utc.fr Mon Jan 16 10:45:05 2017 From: stephane.mottelet at utc.fr (=?UTF-8?Q?St=c3=a9phane_Mottelet?=) Date: Mon, 16 Jan 2017 10:45:05 +0100 Subject: [Scilab-users] Optim & NelderMead use [closed] In-Reply-To: <3A6B7233274DB449A2A0053A47684F953F782A0A@BGS-EX01.auxitrol.ad> References: <3A6B7233274DB449A2A0053A47684F953F782A0A@BGS-EX01.auxitrol.ad> Message-ID: <333e9b39-73c1-d485-5010-e22a30b3ae31@utc.fr> Hi Paul, your cost function *f*= sqrt((val_lin - val_rac)^2); hasn't changed, since sqrt(x^2)=abs(x). What I meant before is replacing *f*= abs(val_lin - val_rac); by *f*= (val_lin - val_rac)^2; in order to make it differentiable. When using a non-differentiable cost function together with numderivative, it seems logical that tweaking the step size could artificially help convergence. S. Le 16/01/2017 ? 10:30, Carrico, Paul a ?crit : > > Hi all > > After performing tests (and modifying the target function as it > should have been done first), I can better understand how to use > ?optim? and ?Neldermead? procedures. > > For my needs the mean flags are : > > -Step h in numderivative ?usefull reading as ?EE 221 Numerical > Computing" Scott Hudson > > -The threshold epsg in optim (%eps is the default value ? such high > accuracy is not necessary for my application ? furthermore using a > value such as 1e-5 leads to err=1 that is correct for checking) > > -Ditto for Nelder-Mead and ?-tolfunrelative? & ?-tolxrelative? > Now it works fine :-) > Thanks all for the support > Paul > > ##################################################################### > > mode(0) > clear > globalcount_use; > count_use= 0; > /// ****/ > function*f*=_lineaire_(*x*, *a2*, *b2*) > *f* = *a2***x*+*b2*; > endfunction > /// ****/ > function*g*=_racine_(*x*, *a1*, *b1*) > *g* = sqrt(*a1***x*) + *b1*; > endfunction > /// ****/ > function*f*=_target_(*x*, *a1*, *b1*, *a2*, *b2*) > val_lin= _lineaire_(*x*,*a2*,*b2*); > val_rac = _racine_(*x*,*a1*,*b1*); > *f*= sqrt((val_lin - val_rac)^2); > global count_use; > count_use = count_use +1; > endfunction > /// Cost function: / > function[*f*, *g*, *ind*]=_cost_(*x*, *ind*, *a1*, *b1*, *a2*, *b2*) > *f* = _target_(*x*); > /// g = numderivative(target, x.',order = 4); / > *g* = _numderivative_(_target_, *x*.',1e-3, order = 4); /// 1E-3 => > see EE 221 "Numerical Computing" Scott Hudson / > /// Study of the influence of h on the number of target function > calculation & the fopt accuracy:/ > /// (epsg = %eps here)/ > /// h = 1.e-1 => number = 220 & fopt = 2.242026e-05/ > /// h = 1.e-2 => number = 195 & fopt = 2.267564e-07/ > /// h = 1.e-3 => number = 170 & fopt = 2.189495e-09 ++++++/ > /// h = 1.e-4 => number = 190 & fopt = 1.941203e-11/ > /// h = 1.e-5 => number = 215 & fopt = 2.131628e-13/ > /// h = 1.e-6 => number = 235 & fopt = 0./ > /// h = 1.e-7 => number = 255 & fopt = 7.105427e-15/ > /// h = 1.e-8 => number = 275 & fopt = 0./ > endfunction > /// *************************/ > /// optimisation with optim/ > initial_parameters= [10] > lower_bounds= [0]; > upper_bounds= [1000]; > nocf= 1000; /// number max of call of f/ > niter= 1000; /// number max of iterations/ > a1= 30; > b1= 2.5; > a2= 1; > b2= 2; > epsg= 1e-5; /// gradient norm threshold (%eps by defaut) --> lead to > err = 1 !!!/ > ///epsg = %eps; // lead to Err = 13/ > epsf= 0; ///threshold controlling decreasing of f (epsf = 0 by defaut)/ > costf= list (_cost_, a1, b1, a2, b2); > [fopt,xopt, gopt, work, iters, evals, err] = > optim(costf,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,epsg,epsf); > printf("Optimized value : %g\n",xopt); > printf("min cost function value (should be as closed as possible to 0) > ; %e\n",fopt); > printf('Number of calculations = %d !!!\n',count_use); > /// Curves definition/ > x= _linspace_(0,50,1000)'; > plot_raci= _racine_(x,a1,b1); > plot_lin= _lineaire_(x,a2,b2); > _scf_(1); > drawlater(); > xgrid(3); > f= _gcf_(); > ///f / > f.figure_size= [1000, 1000]; > f.background= color(255,255,255); > a= _gca_(); > ///a / > a.font_size= 2; > a.x_label.text= "X axis" ; > a.x_location="bottom"; > a.x_label.font_angle=0; > a.x_label.font_size= 4; > a.y_label.text= "Y axis"; > a.y_location="left"; > a.y_label.font_angle=-90; > a.Y_label.font_size= 4; > a.title.text= "Title"; > a.title.font_size= 5; > a.line_style= 1; > /// Curves plot/ > _plot_(x,plot_lin); > e1= _gce_(); > p1= e1.children; > p1.thickness= 1; > p1.line_style= 1; > p1.foreground= 3; > _plot_(x,plot_raci); > e2= _gce_(); > p2= e2.children; > p2.thickness= 1; > p2.line_style= 1; > p2.foreground= 2; > drawnow(); > > */EXPORT CONTROL : > /**Cet email ne contient pas de donn?es techniques > This email does not contain technical data* > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.carrico at esterline.com Mon Jan 16 10:59:13 2017 From: paul.carrico at esterline.com (Carrico, Paul) Date: Mon, 16 Jan 2017 09:59:13 +0000 Subject: [Scilab-users] [EXTERNAL] Re: Optim & NelderMead use [closed] In-Reply-To: <333e9b39-73c1-d485-5010-e22a30b3ae31@utc.fr> References: <3A6B7233274DB449A2A0053A47684F953F782A0A@BGS-EX01.auxitrol.ad> <333e9b39-73c1-d485-5010-e22a30b3ae31@utc.fr> Message-ID: <3A6B7233274DB449A2A0053A47684F953F782A64@BGS-EX01.auxitrol.ad> Hi St?phane I used the sqrt function in the idea of the "Sum of the Square Error" (while there's not sum here) .. but I understand your remarks Thanks Paul EXPORT CONTROL : Cet email ne contient pas de donn?es techniques This email does not contain technical data De : users [mailto:users-bounces at lists.scilab.org] De la part de St?phane Mottelet Envoy? : lundi 16 janvier 2017 10:45 ? : Users mailing list for Scilab Objet : [EXTERNAL] Re: [Scilab-users] Optim & NelderMead use [closed] Hi Paul, your cost function f = sqrt((val_lin - val_rac)^2); hasn't changed, since sqrt(x^2)=abs(x). What I meant before is replacing f = abs(val_lin - val_rac); by f = (val_lin - val_rac)^2; in order to make it differentiable. When using a non-differentiable cost function together with numderivative, it seems logical that tweaking the step size could artificially help convergence. S. Le 16/01/2017 ? 10:30, Carrico, Paul a ?crit : Hi all After performing tests (and modifying the target function as it should have been done first), I can better understand how to use 'optim' and 'Neldermead' procedures. For my needs the mean flags are : - Step h in numderivative --> usefull reading as "EE 221 Numerical Computing" Scott Hudson - The threshold epsg in optim (%eps is the default value - such high accuracy is not necessary for my application - furthermore using a value such as 1e-5 leads to err=1 that is correct for checking) - Ditto for Nelder-Mead and '-tolfunrelative' & '-tolxrelative' Now it works fine :-) Thanks all for the support Paul ##################################################################### mode(0) clear global count_use; count_use = 0; // **** function f=lineaire(x, a2, b2) f = a2*x+b2; endfunction // **** function g=racine(x, a1, b1) g = sqrt(a1*x) + b1; endfunction // **** function f=target(x, a1, b1, a2, b2) val_lin = lineaire(x,a2,b2); val_rac = racine(x,a1,b1); f = sqrt((val_lin - val_rac)^2); global count_use; count_use = count_use +1; endfunction // Cost function: function [f, g, ind]=cost(x, ind, a1, b1, a2, b2) f = target(x); // g = numderivative(target, x.',order = 4); g = numderivative(target, x.',1e-3, order = 4); // 1E-3 => see EE 221 "Numerical Computing" Scott Hudson // Study of the influence of h on the number of target function calculation & the fopt accuracy: // (epsg = %eps here) // h = 1.e-1 => number = 220 & fopt = 2.242026e-05 // h = 1.e-2 => number = 195 & fopt = 2.267564e-07 // h = 1.e-3 => number = 170 & fopt = 2.189495e-09 ++++++ // h = 1.e-4 => number = 190 & fopt = 1.941203e-11 // h = 1.e-5 => number = 215 & fopt = 2.131628e-13 // h = 1.e-6 => number = 235 & fopt = 0. // h = 1.e-7 => number = 255 & fopt = 7.105427e-15 // h = 1.e-8 => number = 275 & fopt = 0. endfunction // ************************* // optimisation with optim initial_parameters = [10] lower_bounds = [0]; upper_bounds = [1000]; nocf = 1000; // number max of call of f niter = 1000; // number max of iterations a1 = 30; b1 = 2.5; a2 = 1; b2 = 2; epsg = 1e-5; // gradient norm threshold (%eps by defaut) --> lead to err = 1 !!! //epsg = %eps; // lead to Err = 13 epsf = 0; //threshold controlling decreasing of f (epsf = 0 by defaut) costf = list (cost, a1, b1, a2, b2); [fopt, xopt, gopt, work, iters, evals, err] = optim(costf,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,epsg,epsf); printf("Optimized value : %g\n",xopt); printf("min cost function value (should be as closed as possible to 0) ; %e\n",fopt); printf('Number of calculations = %d !!!\n',count_use); // Curves definition x = linspace(0,50,1000)'; plot_raci = racine(x,a1,b1); plot_lin = lineaire(x,a2,b2); scf(1); drawlater(); xgrid(3); f = gcf(); //f f.figure_size = [1000, 1000]; f.background = color(255,255,255); a = gca(); //a a.font_size = 2; a.x_label.text = "X axis" ; a.x_location="bottom"; a.x_label.font_angle=0; a.x_label.font_size = 4; a.y_label.text = "Y axis"; a.y_location="left"; a.y_label.font_angle=-90; a.Y_label.font_size = 4; a.title.text = "Title"; a.title.font_size = 5; a.line_style = 1; // Curves plot plot(x,plot_lin); e1 = gce(); p1 = e1.children; p1.thickness = 1; p1.line_style = 1; p1.foreground = 3; plot(x,plot_raci); e2 = gce(); p2 = e2.children; p2.thickness = 1; p2.line_style = 1; p2.foreground = 2; drawnow(); EXPORT CONTROL : Cet email ne contient pas de donn?es techniques This email does not contain technical data _______________________________________________ users mailing list users at lists.scilab.org http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From j_holland at msn.com Mon Jan 16 12:37:53 2017 From: j_holland at msn.com (James Holland) Date: Mon, 16 Jan 2017 04:37:53 -0700 (MST) Subject: [Scilab-users] Visual Studio 2015 Message-ID: <1484566673684-4035364.post@n3.nabble.com> Will Scilab 6 beta 2 work with Visual Studio 2015? I currently have Visual Studio 2013 Express but the SDK, which I need to create 64-bit DLLs, will only work with the Professional version, if I have to upgrade then 2015 would be a better option. -- View this message in context: http://mailinglists.scilab.org/Visual-Studio-2015-tp4035364.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From contact at pierre-vuillemin.fr Mon Jan 16 11:03:11 2017 From: contact at pierre-vuillemin.fr (Pierre Vuillemin) Date: Mon, 16 Jan 2017 11:03:11 +0100 Subject: [Scilab-users] Optim & NelderMead use [closed] In-Reply-To: <3A6B7233274DB449A2A0053A47684F953F782A0A@BGS-EX01.auxitrol.ad> References: <3A6B7233274DB449A2A0053A47684F953F782A0A@BGS-EX01.auxitrol.ad> Message-ID: <1b463ec18c65d17f631ead3ed13ddf71@pierre-vuillemin.fr> Hi Paul, You should be careful when using the square root function as it is not differentiable at 0 (cf the attached file which illustrates this point in your case). This will leads to issues and prevent optim from "really" (in a sound way) converging towards the solution. To address the issue, you can - reformulate your objective function so that it is smooth near the solution (you will still have an issue at 0 where g is not differentiable though), - use order 0 methods (still, some of them might fail on non-smooth optimisation problems as the minimum might be very "narrow") - dig into non-smooth optimisation (see e.g. http://napsu.karmitsa.fi/nso/) Regards, Pierre Le 16.01.2017 10:30, Carrico, Paul a ?crit : > Hi all > > After performing tests (and modifying the target function as it should have been done first), I can better understand how to use 'optim' and 'Neldermead' procedures. > > For my needs the mean flags are : > > - Step h in numderivative ? usefull reading as "EE 221 Numerical Computing" Scott Hudson > > - The threshold epsg in optim (%eps is the default value - such high accuracy is not necessary for my application - furthermore using a value such as 1e-5 leads to err=1 that is correct for checking) > > - Ditto for Nelder-Mead and '-tolfunrelative' & '-tolxrelative' > > Now it works fine :-) > > Thanks all for the support > > Paul > > ##################################################################### > > mode(0) > > clear > > global count_use; > > count_use = 0; > > _// ****_ > > function F=lineaire(X, A2, B2) > > F = A2*X+B2; > > endfunction > > _// ****_ > > function G=racine(X, A1, B1) > > G = sqrt(A1*X) + B1; > > endfunction > > _// ****_ > > function F=target(X, A1, B1, A2, B2) > > val_lin = lineaire(X,A2,B2); > > val_rac = racine(X,A1,B1); > > F = sqrt((val_lin - val_rac)^2); > > global count_use; > > count_use = count_use +1; > > endfunction > > _// Cost function: _ > > function [F, G, IND]=cost(X, IND, A1, B1, A2, B2) > > F = target(X); > > _// g = numderivative(target, x.',order = 4); _ > > G = numderivative(target, X.',1e-3, order = 4); _// 1E-3 => see EE 221 "Numerical Computing" Scott Hudson _ > > _// Study of the influence of h on the number of target function calculation & the fopt accuracy:_ > > _// (epsg = %eps here)_ > > _// h = 1.e-1 => number = 220 & fopt = 2.242026e-05_ > > _// h = 1.e-2 => number = 195 & fopt = 2.267564e-07_ > > _// h = 1.e-3 => number = 170 & fopt = 2.189495e-09 ++++++_ > > _// h = 1.e-4 => number = 190 & fopt = 1.941203e-11_ > > _// h = 1.e-5 => number = 215 & fopt = 2.131628e-13_ > > _// h = 1.e-6 => number = 235 & fopt = 0._ > > _// h = 1.e-7 => number = 255 & fopt = 7.105427e-15_ > > _// h = 1.e-8 => number = 275 & fopt = 0._ > > endfunction > > _// *************************_ > > _// optimisation with optim_ > > initial_parameters = [10] > > lower_bounds = [0]; > > upper_bounds = [1000]; > > nocf = 1000; _// number max of call of f_ > > niter = 1000; _// number max of iterations_ > > a1 = 30; > > b1 = 2.5; > > a2 = 1; > > b2 = 2; > > epsg = 1e-5; _// gradient norm threshold (%eps by defaut) --> lead to err = 1 !!!_ > > _//epsg = %eps; // lead to Err = 13_ > > epsf = 0; _//threshold controlling decreasing of f (epsf = 0 by defaut)_ > > costf = list (cost, a1, b1, a2, b2); > > [fopt, xopt, gopt, work, iters, evals, err] = optim(costf,'b',lower_bounds,upper_bounds,initial_parameters,'qn','ar',nocf,niter,epsg,epsf); > > printf("Optimized value : %g\n",xopt); > > printf("min cost function value (should be as closed as possible to 0) ; %e\n",fopt); > > printf('Number of calculations = %d !!!\n',count_use); > > _// Curves definition_ > > x = linspace(0,50,1000)'; > > plot_raci = racine(x,a1,b1); > > plot_lin = lineaire(x,a2,b2); > > scf(1); > > drawlater(); > > xgrid(3); > > f = gcf(); > > _//f _ > > f.figure_size = [1000, 1000]; > > f.background = color(255,255,255); > > a = gca(); > > _//a _ > > a.font_size = 2; > > a.x_label.text = "X axis" ; > > a.x_location="bottom"; > > a.x_label.font_angle=0; > > a.x_label.font_size = 4; > > a.y_label.text = "Y axis"; > > a.y_location="left"; > > a.y_label.font_angle=-90; > > a.Y_label.font_size = 4; > > a.title.text = "Title"; > > a.title.font_size = 5; > > a.line_style = 1; > > _// Curves plot_ > > plot(x,plot_lin); > > e1 = gce(); > > p1 = e1.children; > > p1.thickness = 1; > > p1.line_style = 1; > > p1.foreground = 3; > > plot(x,plot_raci); > > e2 = gce(); > > p2 = e2.children; > > p2.thickness = 1; > > p2.line_style = 1; > > p2.foreground = 2; > > drawnow(); > > EXPORT CONTROL : > Cet email ne contient pas de donn?es techniques > This email does not contain technical data > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: nondiff.png Type: image/png Size: 6457 bytes Desc: not available URL: From antoine.elias at scilab-enterprises.com Mon Jan 16 13:42:05 2017 From: antoine.elias at scilab-enterprises.com (antoine.elias at scilab-enterprises.com) Date: Mon, 16 Jan 2017 13:42:05 +0100 Subject: [Scilab-users] Visual Studio 2015 In-Reply-To: <1484566673684-4035364.post@n3.nabble.com> References: <1484566673684-4035364.post@n3.nabble.com> Message-ID: <0cde7281b41d16fdd1e296af77284aca@scilab-enterprises.com> Hello James, You can use VS 2015 to build your toolbox but to distribute it you need to provide runtime libraries or install VS 2015 runtime on target computer. (https://www.microsoft.com/en-us/download/details.aspx?id=48145) Scilab 6 beta 2 provides only VS 2013 runtime libraries At Scilab start, call findmsvccompiler() to get version that Scilab found. If VS 2013 pro is found (msvc120pro [1]) , Scilab always use it to avoid compatibility trouble. You can force Scilab to use another MS compiler by setting environment variable "SCILAB_PREFERED_MSVC" ( with misspelling ^^ ) setenv("SCILAB_PREFERED_MSVC", "msvc140pro"); //to set VS 2015 pro as c/c++ compiler Antoine [1] relation entre la version du compiler et celle de Visual Studio MSVC++ 10.0 (Visual Studio 2010) MSVC++ 11.0 (Visual Studio 2012) MSVC++ 12.0 (Visual Studio 2013) MSVC++ 14.0 (Visual Studio 2015) Le 2017-01-16 12:37, James Holland a ?crit?: > Will Scilab 6 beta 2 work with Visual Studio 2015? I currently have > Visual > Studio 2013 Express but the SDK, which I need to create 64-bit DLLs, > will > only work with the Professional version, if I have to upgrade then 2015 > would be a better option. > > > > -- > View this message in context: > http://mailinglists.scilab.org/Visual-Studio-2015-tp4035364.html > Sent from the Scilab users - Mailing Lists Archives mailing list > archive at Nabble.com. > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users From ddslamdunk at gmail.com Mon Jan 16 16:22:50 2017 From: ddslamdunk at gmail.com (Daniele Tonelli) Date: Mon, 16 Jan 2017 10:22:50 -0500 Subject: [Scilab-users] Radio Buttom Message-ID: Dear, I'm trying to include a buttom radio control. I have the following problems: - leave a default buttom selected - Get property of the selected buttom Follow the code I'm using. uicontrol(vcr, "style", "radiobutton", ... "tag", "columna", ... "string", "Columna", ... "groupname", "elementoEstructural",... "backgroundcolor", [1 1 1], ... "position",[l1,guih1-k*20+guih1o,l2,20],"horizontalalignment","left") uicontrol(vcr, "style", "radiobutton", ... "tag", "viga", ... "string", "Viga", ... "groupname", "elementoEstructural",... "backgroundcolor", [1 1 1], ... "position",[l1+guih1-k*20+guih1o,guih1-k*20+guih1o,l2,20],"horizontalalignment","left") Thank you very much, Daniel -------------- next part -------------- An HTML attachment was scrubbed... URL: From ddslamdunk at gmail.com Mon Jan 16 22:56:13 2017 From: ddslamdunk at gmail.com (Daniele Tonelli) Date: Mon, 16 Jan 2017 16:56:13 -0500 Subject: [Scilab-users] Some problemes with GUI Message-ID: Dear, I have several problems with the GUI that I send in the image and in the attachment. - If I modify the data A does not modify the results C - I can not update data B in any case What is happening? Thank you, Daniel [image: Immagine incorporata 1] -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: imagen.png Type: image/png Size: 38053 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: englib-NSR-10.sci Type: application/octet-stream Size: 8617 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: vcr.sce Type: application/octet-stream Size: 10055 bytes Desc: not available URL: From sgougeon at free.fr Tue Jan 17 01:11:46 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Tue, 17 Jan 2017 01:11:46 +0100 Subject: [Scilab-users] Some problemes with GUI In-Reply-To: References: Message-ID: <587D6142.8050009@free.fr> Hello Daniele, Your application looks to use uicontrol tables. This component is bugged in Scilab 5.5.2 and early Scilab 6.0.0-beta: http://bugzilla.scilab.org/11625. It has been fixed during last summer. You must use a nightly build release to reliably work with it: http://www.scilab.org/fr/development/nightly_builds/master HTH Samuel Gougeon Le 16/01/2017 22:56, Daniele Tonelli a ?crit : > Dear, > > I have several problems with the GUI that I send in the image and in > the attachment. > > - If I modify the data A does not modify the results C > > - I can not update data B in any case > > What is happening? > > Thank you, > > Daniel > From contact at pierre-vuillemin.fr Tue Jan 17 08:23:01 2017 From: contact at pierre-vuillemin.fr (Pierre Vuillemin) Date: Tue, 17 Jan 2017 08:23:01 +0100 Subject: [Scilab-users] Anonymous functions Message-ID: <2124090f319501f664bd334ad4b4ba87@pierre-vuillemin.fr> Hi all, I am trying to reproduce the behaviour of anonymous function in Scilab (see the code in lambdaFun here: https://github.com/pivui/scilabTools). At the moment, it works like in Matlab, for instance: a = eye(3,3); lambda 'f(x) = a*x' // the name of the lambda function will be f a = rand(3,3) // the value of 'a' is saved in the lambda function when it is created f(ones(3,1)) // gives [1,1,1]' I would like to emulate the behaviour of lambda function of python as well. In that case, 'a' should change when the initial variable changes, for instance a = 2 f = lambda : a def fun(): a = 4 return f a = 3 f() // should return 3 fun() // should return 3 -> it does not take the variable 'a' in the function namespace I need to remember where the value or a is stored, I don't know if it is possible? Regards, Pierre From Serge.Steer at inria.fr Tue Jan 17 10:38:15 2017 From: Serge.Steer at inria.fr (Serge Steer) Date: Tue, 17 Jan 2017 10:38:15 +0100 Subject: [Scilab-users] Anonymous functions In-Reply-To: <2124090f319501f664bd334ad4b4ba87@pierre-vuillemin.fr> References: <2124090f319501f664bd334ad4b4ba87@pierre-vuillemin.fr> Message-ID: <74abb5fd-5d5d-e62e-6409-32d29bf30988@inria.fr> A partial solution should be deff("y=f(x)","a="+sci2exp(a,0)+";y=a*x") but it may cause numerical problem as a is formatted Regards Serge Steer On 17/01/2017 08:23, Pierre Vuillemin wrote: > Hi all, > > I am trying to reproduce the behaviour of anonymous function in Scilab > (see the code in lambdaFun here: https://github.com/pivui/scilabTools). > > At the moment, it works like in Matlab, for instance: > > a = eye(3,3); > lambda 'f(x) = a*x' // the name of the lambda function will be f > a = rand(3,3) // the value of 'a' is saved in the lambda > function when it is created > f(ones(3,1)) // gives [1,1,1]' > > I would like to emulate the behaviour of lambda function of python as > well. In that case, 'a' should change when the initial variable > changes, for instance > > a = 2 > f = lambda : a > def fun(): > a = 4 > return f > a = 3 > f() // should return 3 > fun() // should return 3 -> it does not take the variable 'a' in the > function namespace > > I need to remember where the value or a is stored, I don't know if it > is possible? > > Regards, > > Pierre > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > From contact at pierre-vuillemin.fr Tue Jan 17 11:46:11 2017 From: contact at pierre-vuillemin.fr (Pierre Vuillemin) Date: Tue, 17 Jan 2017 11:46:11 +0100 Subject: [Scilab-users] Anonymous functions In-Reply-To: <74abb5fd-5d5d-e62e-6409-32d29bf30988@inria.fr> References: <2124090f319501f664bd334ad4b4ba87@pierre-vuillemin.fr> <74abb5fd-5d5d-e62e-6409-32d29bf30988@inria.fr> Message-ID: <52652d6113804f8a03b270ddfdf933b8@pierre-vuillemin.fr> I have actually implemented a similar solution (in the previous link) except that the data are stored in some list. This leads to anonymous functions that behaves as in Matlab, i.e. the data of the function is instantiated when the function is created. In python, the value of the data 'a' is instantiated when the function is evaluated. Therefore, if the data 'a' changes, the function changes. Here I could make something like deff('y=f(x)','y = a*x') but then the function will get the value of the variable 'a' of the current namespace, e.g. a = 1 function outer(x) a = 2 disp(f(1)) endfunction f(1) // will give 1 outer(1) // will give 2 a = 3 f(1) // will give 3 outer(1) // will give 2 In this example, I would like f(1) to behave identically independently of its position. Achieving that boils down to be able to refer to a specific variable in a specific namespace of Scilab (a kind of pointer I guess), but I'm not sure this is possible? Le 17.01.2017 10:38, Serge Steer a ?crit?: > A partial solution should be > deff("y=f(x)","a="+sci2exp(a,0)+";y=a*x") > > but it may cause numerical problem as a is formatted > Regards > > Serge Steer > On 17/01/2017 08:23, Pierre Vuillemin wrote: >> Hi all, >> >> I am trying to reproduce the behaviour of anonymous function in Scilab >> (see the code in lambdaFun here: >> https://github.com/pivui/scilabTools). >> >> At the moment, it works like in Matlab, for instance: >> >> a = eye(3,3); >> lambda 'f(x) = a*x' // the name of the lambda function will be f >> a = rand(3,3) // the value of 'a' is saved in the lambda >> function when it is created >> f(ones(3,1)) // gives [1,1,1]' >> >> I would like to emulate the behaviour of lambda function of python as >> well. In that case, 'a' should change when the initial variable >> changes, for instance >> >> a = 2 >> f = lambda : a >> def fun(): >> a = 4 >> return f >> a = 3 >> f() // should return 3 >> fun() // should return 3 -> it does not take the variable 'a' in the >> function namespace >> >> I need to remember where the value or a is stored, I don't know if it >> is possible? >> >> Regards, >> >> Pierre >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users >> > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users From sgougeon at free.fr Tue Jan 17 14:21:13 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Tue, 17 Jan 2017 14:21:13 +0100 Subject: [Scilab-users] Anonymous functions In-Reply-To: <52652d6113804f8a03b270ddfdf933b8@pierre-vuillemin.fr> References: <2124090f319501f664bd334ad4b4ba87@pierre-vuillemin.fr> <74abb5fd-5d5d-e62e-6409-32d29bf30988@inria.fr> <52652d6113804f8a03b270ddfdf933b8@pierre-vuillemin.fr> Message-ID: <587E1A49.3030902@free.fr> Le 17/01/2017 11:46, Pierre Vuillemin a ?crit : > I have actually implemented a similar solution (in the previous link) > except that the data are stored in some list. This leads to anonymous > functions that behaves as in Matlab, i.e. the data of the function is > instantiated when the function is created. > > In python, the value of the data 'a' is instantiated when the function > is evaluated. Therefore, if the data 'a' changes, the function changes. > > Here I could make something like > > deff('y=f(x)','y = a*x') > > but then the function will get the value of the variable 'a' of the > current namespace, e.g. > > a = 1 > function outer(x) > a = 2 > disp(f(1)) > endfunction > > f(1) // will give 1 > outer(1) // will give 2 > a = 3 > f(1) // will give 3 > outer(1) // will give 2 > > In this example, I would like f(1) to behave identically independently > of its position. If i understand correctly your query, the global space is unique and aims to allow that: deff('y=f(x)','global a; y = a*x') This requires the only variable "a" you want to consider been declared "global a" before some calling point. Actually, i don't see how to refer to a unique "a" without telling to Scilab which one it must be. Samuel From ddslamdunk at gmail.com Tue Jan 17 23:25:05 2017 From: ddslamdunk at gmail.com (Daniele Tonelli) Date: Tue, 17 Jan 2017 17:25:05 -0500 Subject: [Scilab-users] Some problemes with GUI In-Reply-To: <587D6142.8050009@free.fr> References: <587D6142.8050009@free.fr> Message-ID: Thanks, I'm using Scilab 6.0.0. Hoy when I change A, function "Calcular" can modify C. However it can't update B. I urgently need to solve the issue. Can anybody help me? Thanks, *Daniel* 2017-01-16 19:11 GMT-05:00 Samuel Gougeon : > Hello Daniele, > > Your application looks to use uicontrol tables. > This component is bugged in Scilab 5.5.2 and early Scilab 6.0.0-beta: > http://bugzilla.scilab.org/11625. > It has been fixed during last summer. > You must use a nightly build release to reliably work with it: > http://www.scilab.org/fr/development/nightly_builds/master > > HTH > Samuel Gougeon > > Le 16/01/2017 22:56, Daniele Tonelli a ?crit : > >> Dear, >> >> I have several problems with the GUI that I send in the image and in the >> attachment. >> >> - If I modify the data A does not modify the results C >> >> - I can not update data B in any case >> >> What is happening? >> >> Thank you, >> >> Daniel >> >> _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: englib-NSR-10.sci Type: application/octet-stream Size: 8617 bytes Desc: not available URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: vcr.sce Type: application/octet-stream Size: 10055 bytes Desc: not available URL: From sgougeon at free.fr Wed Jan 18 04:45:28 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Wed, 18 Jan 2017 04:45:28 +0100 Subject: [Scilab-users] Some problemes with GUI In-Reply-To: References: <587D6142.8050009@free.fr> Message-ID: <587EE4D8.4080706@free.fr> Le 17/01/2017 23:25, Daniele Tonelli a ?crit : > Thanks, > > I'm using Scilab 6.0.0. Which version exactly? [v,o] = getversion() From ddslamdunk at gmail.com Wed Jan 18 13:28:24 2017 From: ddslamdunk at gmail.com (Daniele Tonelli) Date: Wed, 18 Jan 2017 07:28:24 -0500 Subject: [Scilab-users] Some problemes with GUI In-Reply-To: <587EE4D8.4080706@free.fr> References: <587D6142.8050009@free.fr> <587EE4D8.4080706@free.fr> Message-ID: In the figure I send you my version number. Did you try to lunch the program? [image: Immagine incorporata 1] 2017-01-17 22:45 GMT-05:00 Samuel Gougeon : > Le 17/01/2017 23:25, Daniele Tonelli a ?crit : > >> Thanks, >> >> I'm using Scilab 6.0.0. >> > Which version exactly? > [v,o] = getversion() > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: imagen.png Type: image/png Size: 2953 bytes Desc: not available URL: From j_holland at msn.com Wed Jan 18 22:38:51 2017 From: j_holland at msn.com (James Holland) Date: Wed, 18 Jan 2017 14:38:51 -0700 (MST) Subject: [Scilab-users] Interfacing to third party DLLs In-Reply-To: <1483990971838-4035337.post@n3.nabble.com> References: <1483951784272-4035335.post@n3.nabble.com> <58735163.6090800@free.fr> <1483990971838-4035337.post@n3.nabble.com> Message-ID: <1484775531761-4035379.post@n3.nabble.com> I've spent some time on this and I still can't get this to work. I've created a very simple 64-bit dll to allow me to experiment with this but to no avail. All my DLL consists of is two functions, one that adds two doubles and returns a double and one that subtracts a double from another double and returns a double. When I try to add a=4, b=2 I get a nonsense answer that changes every time. Also ulink doesn't work at all nor does dllinfo although I can examine the dll using dumpbin. TestDLL1.zip TestDLL1.sce -- View this message in context: http://mailinglists.scilab.org/Scilab-users-Interfacing-to-third-party-DLLs-tp4035330p4035379.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From antoine.elias at scilab-enterprises.com Thu Jan 19 10:00:56 2017 From: antoine.elias at scilab-enterprises.com (antoine.elias at scilab-enterprises.com) Date: Thu, 19 Jan 2017 10:00:56 +0100 Subject: [Scilab-users] Interfacing to third party DLLs In-Reply-To: <1484775531761-4035379.post@n3.nabble.com> References: <1483951784272-4035335.post@n3.nabble.com> <58735163.6090800@free.fr> <1483990971838-4035337.post@n3.nabble.com> <1484775531761-4035379.post@n3.nabble.com> Message-ID: Hello James, inputs arguments of your interface must be pointers, Scilab manage data as matrix ( arrays in C ) So a scalar variable `A` become a `double A[1];` prototype must be like this : void Add(double* a, double* b, double* c); I made some changes is yours files, take a look, I hope that can help you. Antoine Le 2017-01-18 22:38, James Holland a ?crit?: > I've spent some time on this and I still can't get this to work. I've > created > a very simple 64-bit dll to allow me to experiment with this but to no > avail. All my DLL consists of is two functions, one that adds two > doubles > and returns a double and one that subtracts a double from another > double and > returns a double. When I try to add a=4, b=2 I get a nonsense answer > that > changes every time. Also ulink doesn't work at all nor does dllinfo > although > I can examine the dll using dumpbin. > > > TestDLL1.zip > > TestDLL1.sce > > > > > -- > View this message in context: > http://mailinglists.scilab.org/Scilab-users-Interfacing-to-third-party-DLLs-tp4035330p4035379.html > Sent from the Scilab users - Mailing Lists Archives mailing list > archive at Nabble.com. > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- A non-text attachment was scrubbed... Name: DLLtest1.cpp Type: text/x-c Size: 175 bytes Desc: not available URL: -------------- next part -------------- An embedded and charset-unspecified text was scrubbed... Name: DLLtest1.h URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: testDLL.sce Type: text/x-fortran Size: 521 bytes Desc: not available URL: From j_holland at msn.com Thu Jan 19 19:09:00 2017 From: j_holland at msn.com (James Holland) Date: Thu, 19 Jan 2017 11:09:00 -0700 (MST) Subject: [Scilab-users] Interfacing to third party DLLs In-Reply-To: References: <1483951784272-4035335.post@n3.nabble.com> <58735163.6090800@free.fr> <1483990971838-4035337.post@n3.nabble.com> <1484775531761-4035379.post@n3.nabble.com> Message-ID: <1484849340308-4035384.post@n3.nabble.com> Thank you. I couldn't find this information anywhere - I think I will create a short tutorial, if only to remind myself how its done. -- View this message in context: http://mailinglists.scilab.org/Scilab-users-Interfacing-to-third-party-DLLs-tp4035330p4035384.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From contact at pierre-vuillemin.fr Fri Jan 20 09:00:39 2017 From: contact at pierre-vuillemin.fr (Pierre Vuillemin) Date: Fri, 20 Jan 2017 09:00:39 +0100 Subject: [Scilab-users] Anonymous functions In-Reply-To: <587E1A49.3030902@free.fr> References: <2124090f319501f664bd334ad4b4ba87@pierre-vuillemin.fr> <74abb5fd-5d5d-e62e-6409-32d29bf30988@inria.fr> <52652d6113804f8a03b270ddfdf933b8@pierre-vuillemin.fr> <587E1A49.3030902@free.fr> Message-ID: Hi Samuel, Indeed, the behaviour I seek to reproduce is similar to what could be done with a global variable. Yet I would avoid to resort to global variables. From what I've understand about variables scoping in Scilab (https://wiki.scilab.org/howto/global%20and%20local%20variables), variables from the above level are only replaced/copied locally when needed, e.g. function outer() a = 1 function inner() disp(a) // a has the value of the outer function a = 2 // now a copy is made and a is locally equal to 2 endfunction inner() disp(a) // a has kept its initial value of 1 endfunction Hence I guess that the fact that a = 1 in the scope of the outer function is stored somewhere so that Scilab can retrieve that information when needed. I'm wondering how it works internally and whether I could use this to create generic lambda function? I'm aware that this cannot be done solely in Scilab but requires to fiddle with the C interface, but I'm curious to experiment. Regards, Pierre Le 17.01.2017 14:21, Samuel Gougeon a ?crit?: > Le 17/01/2017 11:46, Pierre Vuillemin a ?crit : >> I have actually implemented a similar solution (in the previous link) >> except that the data are stored in some list. This leads to anonymous >> functions that behaves as in Matlab, i.e. the data of the function is >> instantiated when the function is created. >> >> In python, the value of the data 'a' is instantiated when the function >> is evaluated. Therefore, if the data 'a' changes, the function >> changes. >> >> Here I could make something like >> >> deff('y=f(x)','y = a*x') >> >> but then the function will get the value of the variable 'a' of the >> current namespace, e.g. >> >> a = 1 >> function outer(x) >> a = 2 >> disp(f(1)) >> endfunction >> >> f(1) // will give 1 >> outer(1) // will give 2 >> a = 3 >> f(1) // will give 3 >> outer(1) // will give 2 >> >> In this example, I would like f(1) to behave identically independently >> of its position. > > If i understand correctly your query, the global space is unique and > aims to allow that: > deff('y=f(x)','global a; y = a*x') > > This requires the only variable "a" you want to consider been declared > "global a" before some calling point. Actually, i don't see how to > refer to a unique "a" without telling to Scilab which one it must be. > > Samuel > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users From oleksiy.bond at gmail.com Fri Jan 20 10:42:51 2017 From: oleksiy.bond at gmail.com (Oleksiy Bondarenko) Date: Fri, 20 Jan 2017 18:42:51 +0900 Subject: [Scilab-users] Tcl/Tk Message-ID: Hello, I am wondering about updating of Tcl/Tk interpreter in SciLab. Scilab is progressing rapidly, but the version of Tcl/Tk used in it is already outdated. Does anyone know how to update it manually, or where should I post the request? Thank you. -------------- next part -------------- An HTML attachment was scrubbed... URL: From sdr at durietz.se Fri Jan 20 11:05:23 2017 From: sdr at durietz.se (Stefan Du Rietz) Date: Fri, 20 Jan 2017 11:05:23 +0100 Subject: [Scilab-users] Anonymous functions In-Reply-To: References: <2124090f319501f664bd334ad4b4ba87@pierre-vuillemin.fr> <74abb5fd-5d5d-e62e-6409-32d29bf30988@inria.fr> <52652d6113804f8a03b270ddfdf933b8@pierre-vuillemin.fr> <587E1A49.3030902@free.fr> Message-ID: <13bfbc97-8d1e-d2c6-dbee-61d0c2aa311a@durietz.se> Sorry, I left out a line below (a = 2;) Hello Pierre, is this too simple? function outer() a = 1 function inner() mprintf("a = %i (inner: a has the value of the outer function)\n",a) a = 2; a = resume(a); endfunction inner() mprintf("a = %i (outer: a has got its new inner value of 2\n", a) endfunction /Stefan On 2017-01-20 09:00, Pierre Vuillemin wrote: > Hi Samuel, > > Indeed, the behaviour I seek to reproduce is similar to what could be > done with a global variable. Yet I would avoid to resort to global > variables. > > From what I've understand about variables scoping in Scilab > (https://wiki.scilab.org/howto/global%20and%20local%20variables), > variables from the above level are only replaced/copied locally when > needed, e.g. > > function outer() > a = 1 > function inner() > disp(a) // a has the value of the outer function > a = 2 // now a copy is made and a is locally equal to 2 > endfunction > inner() > disp(a) // a has kept its initial value of 1 > endfunction > > > Hence I guess that the fact that a = 1 in the scope of the outer > function is stored somewhere so that Scilab can retrieve that > information when needed. I'm wondering how it works internally and > whether I could use this to create generic lambda function? > > I'm aware that this cannot be done solely in Scilab but requires to > fiddle with the C interface, but I'm curious to experiment. > > > Regards, > > Pierre > > > Le 17.01.2017 14:21, Samuel Gougeon a ?crit : >> Le 17/01/2017 11:46, Pierre Vuillemin a ?crit : >>> I have actually implemented a similar solution (in the previous >>> link) except that the data are stored in some list. This leads to >>> anonymous functions that behaves as in Matlab, i.e. the data of the >>> function is instantiated when the function is created. >>> >>> In python, the value of the data 'a' is instantiated when the >>> function is evaluated. Therefore, if the data 'a' changes, the >>> function changes. >>> >>> Here I could make something like >>> >>> deff('y=f(x)','y = a*x') >>> >>> but then the function will get the value of the variable 'a' of the >>> current namespace, e.g. >>> >>> a = 1 >>> function outer(x) >>> a = 2 >>> disp(f(1)) >>> endfunction >>> >>> f(1) // will give 1 >>> outer(1) // will give 2 >>> a = 3 >>> f(1) // will give 3 >>> outer(1) // will give 2 >>> >>> In this example, I would like f(1) to behave identically >>> independently of its position. >> >> If i understand correctly your query, the global space is unique and >> aims to allow that: >> deff('y=f(x)','global a; y = a*x') >> >> This requires the only variable "a" you want to consider been declared >> "global a" before some calling point. Actually, i don't see how to >> refer to a unique "a" without telling to Scilab which one it must be. >> >> Samuel >> >> >> >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users From sdr at durietz.se Fri Jan 20 10:58:52 2017 From: sdr at durietz.se (Stefan Du Rietz) Date: Fri, 20 Jan 2017 10:58:52 +0100 Subject: [Scilab-users] Anonymous functions In-Reply-To: References: <2124090f319501f664bd334ad4b4ba87@pierre-vuillemin.fr> <74abb5fd-5d5d-e62e-6409-32d29bf30988@inria.fr> <52652d6113804f8a03b270ddfdf933b8@pierre-vuillemin.fr> <587E1A49.3030902@free.fr> Message-ID: <89014cd6-98c4-eddc-a0a1-8b6d59cf4e29@durietz.se> Hello Pierre, is this too simple? function outer() a = 1 function inner() mprintf("a = %i (inner: a has the value of the outer function)\n", a) a = resume(a); endfunction inner() mprintf("a = %i (outer: a has got its new inner value of 2\n", a) endfunction /Stefan On 2017-01-20 09:00, Pierre Vuillemin wrote: > Hi Samuel, > > Indeed, the behaviour I seek to reproduce is similar to what could be > done with a global variable. Yet I would avoid to resort to global > variables. > > From what I've understand about variables scoping in Scilab > (https://wiki.scilab.org/howto/global%20and%20local%20variables), > variables from the above level are only replaced/copied locally when > needed, e.g. > > function outer() > a = 1 > function inner() > disp(a) // a has the value of the outer function > a = 2 // now a copy is made and a is locally equal to 2 > endfunction > inner() > disp(a) // a has kept its initial value of 1 > endfunction > > > Hence I guess that the fact that a = 1 in the scope of the outer > function is stored somewhere so that Scilab can retrieve that > information when needed. I'm wondering how it works internally and > whether I could use this to create generic lambda function? > > I'm aware that this cannot be done solely in Scilab but requires to > fiddle with the C interface, but I'm curious to experiment. > > > Regards, > > Pierre > > > Le 17.01.2017 14:21, Samuel Gougeon a ?crit : >> Le 17/01/2017 11:46, Pierre Vuillemin a ?crit : >>> I have actually implemented a similar solution (in the previous >>> link) except that the data are stored in some list. This leads to >>> anonymous functions that behaves as in Matlab, i.e. the data of the >>> function is instantiated when the function is created. >>> >>> In python, the value of the data 'a' is instantiated when the >>> function is evaluated. Therefore, if the data 'a' changes, the >>> function changes. >>> >>> Here I could make something like >>> >>> deff('y=f(x)','y = a*x') >>> >>> but then the function will get the value of the variable 'a' of the >>> current namespace, e.g. >>> >>> a = 1 >>> function outer(x) >>> a = 2 >>> disp(f(1)) >>> endfunction >>> >>> f(1) // will give 1 >>> outer(1) // will give 2 >>> a = 3 >>> f(1) // will give 3 >>> outer(1) // will give 2 >>> >>> In this example, I would like f(1) to behave identically >>> independently of its position. >> >> If i understand correctly your query, the global space is unique and >> aims to allow that: >> deff('y=f(x)','global a; y = a*x') >> >> This requires the only variable "a" you want to consider been declared >> "global a" before some calling point. Actually, i don't see how to >> refer to a unique "a" without telling to Scilab which one it must be. >> >> Samuel >> >> >> >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users From sgougeon at free.fr Fri Jan 20 12:03:23 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Fri, 20 Jan 2017 12:03:23 +0100 Subject: [Scilab-users] Tcl/Tk In-Reply-To: References: Message-ID: <5881EE7B.8090404@free.fr> Hello, Le 20/01/2017 10:42, Oleksiy Bondarenko a ?crit : > Hello, > > I am wondering about updating of Tcl/Tk interpreter in SciLab. Scilab > is progressing rapidly, but the version of Tcl/Tk used in it is > already outdated. Does anyone know how to update it manually, or where > should I post the request? AFAIK, for the MSWindows distribution, the TCL and Tk main DLLs are stored in SCI\bin\tcl85.dll and SCI\bin\tk85.dll, in addition to the SCI\bin\tclsci.dll Scilab interface. A request can be posted on the Scilab bugzilla page, choosing the TCL component. HTH Samuel Gougeon -------------- next part -------------- An HTML attachment was scrubbed... URL: From contact at pierre-vuillemin.fr Sat Jan 21 11:07:39 2017 From: contact at pierre-vuillemin.fr (Pierre Vuillemin) Date: Sat, 21 Jan 2017 11:07:39 +0100 Subject: [Scilab-users] COMPleib library for Scilab Message-ID: <1484993259.4295.0@ssl0.ovh.net> Hi all, If you are interested in control or LTI model reduction, I've ported the COMPleib library (see http://www.complib.de/ for further info) to Scilab. You can find it here: https://github.com/pivui/scilabTools/tree/master/COMPleib I've not tested all the models hence some issues might remains. Let me know if you find a problem. On a side note, Scilab seems to have some troubles to plot the bode diagrams for some "large" models, for instance with the CDP model, [A,B1,B,C1,C,D11,D12,D21,nx,nw,nu,nz,ny]=COMPleib('CDP'); H = syslin('c', A,B,C,D21) gainplot(H) returns !--error 264 Valeur erron?e de l'argument -9808211 : Ne doit pas contenir de NaN ou Inf. at line 123 of function calfrq called by : at line 73 of function repfreq called by : at line 28 of function gainplot cale by : Regards, Pierre -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfuttrup at gmail.com Sun Jan 22 15:58:41 2017 From: cfuttrup at gmail.com (Claus Futtrup) Date: Sun, 22 Jan 2017 15:58:41 +0100 Subject: [Scilab-users] case control statement Message-ID: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> Hi there I'd like to use the "case" control statement to select a few options. I'm wondering, is it possible for a case to have multiple options, I mean like this: select model case 1,3,4 then do something case 2 then do something case 5 then do something end Could I define [1 3 4] as a group of options and ask "CASE IN GROUP" ... or how would I go about and implement this? Best regards, Claus From sgougeon at free.fr Sun Jan 22 16:14:33 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Sun, 22 Jan 2017 16:14:33 +0100 Subject: [Scilab-users] case control statement In-Reply-To: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> Message-ID: <5884CC59.7070003@free.fr> Hello Claus, No it's not possible. It has been suggested here: http://bugzilla.scilab.org/6503 But chained /elseif /statements do the same in a fully versatile way. HTH Samuel PS: BTW, i don't really understand the interest in the select/case structure wrt the elseif one. select/case looks stiffer and less powerful. Le 22/01/2017 15:58, Claus Futtrup a ?crit : > Hi there > > I'd like to use the "case" control statement to select a few options. > I'm wondering, is it possible for a case to have multiple options, I > mean like this: > > select model > > case 1,3,4 then > > do something > > case 2 then > > do something > > case 5 then > > do something > > end > > Could I define [1 3 4] as a group of options and ask "CASE IN GROUP" > ... or how would I go about and implement this? > > Best regards, > > Claus > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfuttrup at gmail.com Sun Jan 22 16:31:35 2017 From: cfuttrup at gmail.com (Claus Futtrup) Date: Sun, 22 Jan 2017 16:31:35 +0100 Subject: [Scilab-users] case control statement In-Reply-To: <5884CC59.7070003@free.fr> References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> <5884CC59.7070003@free.fr> Message-ID: <3c2a2744-624e-d20d-2603-ad85e5976500@gmail.com> Hi Samuel Thanks for the quick response. I'll convert to else-if control statements ... Best regards, Claus On 22-01-2017 16:14, Samuel Gougeon wrote: > Hello Claus, > No it's not possible. It has been suggested here: > http://bugzilla.scilab.org/6503 > But chained /elseif /statements do the same in a fully versatile way. > HTH > Samuel > PS: BTW, i don't really understand the interest in the select/case > structure wrt the elseif one. > select/case looks stiffer and less powerful. > > Le 22/01/2017 15:58, Claus Futtrup a ?crit : >> Hi there >> >> I'd like to use the "case" control statement to select a few options. >> I'm wondering, is it possible for a case to have multiple options, I >> mean like this: >> >> select model >> >> case 1,3,4 then >> >> do something >> >> case 2 then >> >> do something >> >> case 5 then >> >> do something >> >> end >> >> Could I define [1 3 4] as a group of options and ask "CASE IN GROUP" >> ... or how would I go about and implement this? >> >> Best regards, >> >> Claus >> >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users >> > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfuttrup at gmail.com Sun Jan 22 17:01:12 2017 From: cfuttrup at gmail.com (Claus Futtrup) Date: Sun, 22 Jan 2017 17:01:12 +0100 Subject: [Scilab-users] case control statement In-Reply-To: <5884CC59.7070003@free.fr> References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> <5884CC59.7070003@free.fr> Message-ID: <017cedd3-d23c-49ef-7d7d-57221f0aa303@gmail.com> Hi there OK, so I converted to elseif (source code at the bottom of my post). Now Scilab complains like this: elseif or[(model==3) (model==4)] then // FDD-LOG / CLOG !--error 35 Syntax error in a 'if' instruction. at line 11 of function getq called by : endfunction I'm replacing a CASE control with an ELSEIF and using the OR[] to collect my options. I tested the OR control on the command line, without problems, so I don't understand what Scilab is complaining about. Please let me know if you have any idea... Best regards, Claus Here's a code snippet: // This function, getq, defines the q-values for all models. if model==1 then // FDD // // q = 1 - this used to be 1 - beta*ln(w) also for FDD (!?!?) q = 1; elseif or[(model==3) (model==4)] then // FDD-LOG / CLOG // // q = 1 - beta * ln(w) - Scilab log(w) = natural log = ln(w)) q = 1 - gbeta*log(w); // gbeta - it's _not_ LOG model _lambda_ elseif model==2 then // LOG // // q = 1 - beta*ln(iw) // q = 1 - gbeta*log(%i .* w); end On 22-01-2017 16:14, Samuel Gougeon wrote: > Hello Claus, > No it's not possible. It has been suggested here: > http://bugzilla.scilab.org/6503 > But chained /elseif /statements do the same in a fully versatile way. > HTH > Samuel > PS: BTW, i don't really understand the interest in the select/case > structure wrt the elseif one. > select/case looks stiffer and less powerful. > > Le 22/01/2017 15:58, Claus Futtrup a ?crit : >> Hi there >> >> I'd like to use the "case" control statement to select a few options. >> I'm wondering, is it possible for a case to have multiple options, I >> mean like this: >> >> select model >> >> case 1,3,4 then >> >> do something >> >> case 2 then >> >> do something >> >> case 5 then >> >> do something >> >> end >> >> Could I define [1 3 4] as a group of options and ask "CASE IN GROUP" >> ... or how would I go about and implement this? >> >> Best regards, >> >> Claus >> >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users >> > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From sdr at durietz.se Sun Jan 22 17:35:28 2017 From: sdr at durietz.se (Stefan Du Rietz) Date: Sun, 22 Jan 2017 17:35:28 +0100 Subject: [Scilab-users] case control statement In-Reply-To: <017cedd3-d23c-49ef-7d7d-57221f0aa303@gmail.com> References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> <5884CC59.7070003@free.fr> <017cedd3-d23c-49ef-7d7d-57221f0aa303@gmail.com> Message-ID: <6eb89a07-84aa-8d04-5b04-f9ad2065daf7@durietz.se> Hello Claus, you put the parentheses wrong: elseif or([model==3 model==4]) Regards Stefan On 2017-01-22 17:01, Claus Futtrup wrote: > Hi there > > OK, so I converted to elseif (source code at the bottom of my post). > Now Scilab complains like this: > > elseif or[(model==3) (model==4)] then // FDD-LOG / CLOG > !--error 35 > Syntax error in a 'if' instruction. > at line 11 of function getq called by : > endfunction > > I'm replacing a CASE control with an ELSEIF and using the OR[] to > collect my options. I tested the OR control on the command line, > without problems, so I don't understand what Scilab is complaining about. > > Please let me know if you have any idea... > > Best regards, > Claus > > Here's a code snippet: > > // This function, getq, defines the q-values for all models. > > if model==1 then // FDD > // > // q = 1 - this used to be 1 - beta*ln(w) also for FDD (!?!?) > q = 1; > > elseif or[(model==3) (model==4)] then // FDD-LOG / CLOG > // > // q = 1 - beta * ln(w) - Scilab log(w) = natural log = ln(w)) > q = 1 - gbeta*log(w); // gbeta - it's _not_ LOG model _lambda_ > > elseif model==2 then // LOG > // > // q = 1 - beta*ln(iw) > // > q = 1 - gbeta*log(%i .* w); > > end > > On 22-01-2017 16:14, Samuel Gougeon wrote: >> Hello Claus, >> No it's not possible. It has been suggested here: >> http://bugzilla.scilab.org/6503 >> But chained /elseif /statements do the same in a fully versatile way. >> HTH >> Samuel >> PS: BTW, i don't really understand the interest in the select/case >> structure wrt the elseif one. >> select/case looks stiffer and less powerful. >> >> Le 22/01/2017 15:58, Claus Futtrup a ?crit : >>> Hi there >>> >>> I'd like to use the "case" control statement to select a few >>> options. I'm wondering, is it possible for a case to have multiple >>> options, I mean like this: >>> >>> select model >>> >>> case 1,3,4 then >>> >>> do something >>> >>> case 2 then >>> >>> do something >>> >>> case 5 then >>> >>> do something >>> >>> end >>> >>> Could I define [1 3 4] as a group of options and ask "CASE IN >>> GROUP" ... or how would I go about and implement this? >>> >>> Best regards, >>> >>> Claus >>> >>> _______________________________________________ >>> users mailing list >>> users at lists.scilab.org >>> http://lists.scilab.org/mailman/listinfo/users >>> >> >> >> >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > From sgougeon at free.fr Sun Jan 22 19:14:45 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Sun, 22 Jan 2017 19:14:45 +0100 Subject: [Scilab-users] case control statement In-Reply-To: <017cedd3-d23c-49ef-7d7d-57221f0aa303@gmail.com> References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> <5884CC59.7070003@free.fr> <017cedd3-d23c-49ef-7d7d-57221f0aa303@gmail.com> Message-ID: <5884F695.2000002@free.fr> Le 22/01/2017 17:01, Claus Futtrup a ?crit : > Hi there > > OK, so I converted to elseif (source code at the bottom of my post). > Now Scilab complains like this: > > elseif or[(model==3) (model==4)] then // FDD-LOG / CLOG if model is a scalar, just write elseif or(model==[3 4]) then // FDD-LOG / CLOG Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From jrafaelbguerra at hotmail.com Sun Jan 22 19:18:10 2017 From: jrafaelbguerra at hotmail.com (Rafael Guerra) Date: Sun, 22 Jan 2017 18:18:10 +0000 Subject: [Scilab-users] case control statement In-Reply-To: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> Message-ID: Schlumberger-Private Hi Claus, Check this code out: // START OF (UGLY) CASE loop= %t; while loop printf("\n") str = input("Enter number (1-7) or 0 to exit: n=","string"); n = evstr(str); select %t case n== 2 printf("single choice...\n"); case n== 5 printf("single choice...\n"); case or(n==[1 3 4]) printf("n=%i --> multiple choice#1:\n",n); case or(n==[6,7]) printf("n=%i --> multiple choice#2:\n",n); case n==0 printf("Bye...\n"); loop=%f; end end // END OF CASE Regards, Rafael -----Original Message----- From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Claus Futtrup Sent: Sunday, January 22, 2017 3:59 PM To: International users mailing list for Scilab. Subject: [Scilab-users] case control statement Hi there I'd like to use the "case" control statement to select a few options. I'm wondering, is it possible for a case to have multiple options, I mean like this: select model case 1,3,4 then do something case 2 then do something case 5 then do something end Could I define [1 3 4] as a group of options and ask "CASE IN GROUP" ... or how would I go about and implement this? Best regards, Claus -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfuttrup at gmail.com Sun Jan 22 19:18:23 2017 From: cfuttrup at gmail.com (Claus Futtrup) Date: Sun, 22 Jan 2017 19:18:23 +0100 Subject: [Scilab-users] case control statement In-Reply-To: <5884F695.2000002@free.fr> References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> <5884CC59.7070003@free.fr> <017cedd3-d23c-49ef-7d7d-57221f0aa303@gmail.com> <5884F695.2000002@free.fr> Message-ID: <1322d543-548f-dc44-b718-8570065ba0cc@gmail.com> Thank you, yes, I see where I went wrong with the square brackets. Sorry. Thank you to the team that you answer question so quickly and even during the weekend. :-) Best regards, Claus On 22-01-2017 19:14, Samuel Gougeon wrote: > Le 22/01/2017 17:01, Claus Futtrup a ?crit : >> Hi there >> >> OK, so I converted to elseif (source code at the bottom of my post). >> Now Scilab complains like this: >> >> elseif or[(model==3) (model==4)] then // FDD-LOG / CLOG > > if model is a scalar, just write > > elseif or(model==[3 4]) then // FDD-LOG / CLOG > > Samuel > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfuttrup at gmail.com Sun Jan 22 19:31:00 2017 From: cfuttrup at gmail.com (Claus Futtrup) Date: Sun, 22 Jan 2017 19:31:00 +0100 Subject: [Scilab-users] case control statement In-Reply-To: References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> Message-ID: Hi Rafael Interesting... So I don't need to select anything, I can just do case model== something. (Or maybe select initializes the case ... but it looks to me like you're not really using select for anything) /Claus On 22-01-2017 19:18, Rafael Guerra wrote: > > **Schlumberger-Private** > > Hi Claus, > > Check this code out: > > /// START OF (UGLY) CASE/ > > loop=%t; > > whileloop > > printf("\n") > > str = _input_("Enter number (1-7) or 0 to exit: n=","string"); > > n = _evstr_(str); > > select %t > > case n== 2 > > printf("single choice...\n"); > > case n== 5 > > printf("single choice...\n"); > > case or(n==[1 3 4]) > > printf("n=%i --> multiple choice#1:\n",n); > > caseor(n==[6,7]) > > printf("n=%i --> multiple choice#2:\n",n); > > case n==0 > > printf("Bye...\n"); > > loop=%f; > > end > > end > > /// END OF CASE/ > > Regards, > > Rafael > > -----Original Message----- > From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Claus > Futtrup > Sent: Sunday, January 22, 2017 3:59 PM > To: International users mailing list for Scilab. > Subject: [Scilab-users] case control statement > > Hi there > > I'd like to use the "case" control statement to select a few options. > > I'm wondering, is it possible for a case to have multiple options, I > > mean like this: > > select model > > case 1,3,4 then > > do something > > case 2 then > > do something > > case 5 then > > do something > > end > > Could I define [1 3 4] as a group of options and ask "CASE IN GROUP" ... > > or how would I go about and implement this? > > Best regards, > > Claus > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From jrafaelbguerra at hotmail.com Sun Jan 22 19:37:56 2017 From: jrafaelbguerra at hotmail.com (Rafael Guerra) Date: Sun, 22 Jan 2017 18:37:56 +0000 Subject: [Scilab-users] case control statement In-Reply-To: References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> Message-ID: Schlumberger-Private Well, it selects only %true expressions, actually I believe it selects only the first case true expression encountered, so the cases need to be exclusive. You can test and let us know From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Claus Futtrup Sent: Sunday, January 22, 2017 7:31 PM To: users at lists.scilab.org Subject: Re: [Scilab-users] case control statement Hi Rafael Interesting... So I don't need to select anything, I can just do case model== something. (Or maybe select initializes the case ... but it looks to me like you're not really using select for anything) /Claus On 22-01-2017 19:18, Rafael Guerra wrote: Schlumberger-Private Hi Claus, Check this code out: // START OF (UGLY) CASE loop= %t; while loop printf("\n") str = input("Enter number (1-7) or 0 to exit: n=","string"); n = evstr(str); select %t case n== 2 printf("single choice...\n"); case n== 5 printf("single choice...\n"); case or(n==[1 3 4]) printf("n=%i --> multiple choice#1:\n",n); case or(n==[6,7]) printf("n=%i --> multiple choice#2:\n",n); case n==0 printf("Bye...\n"); loop=%f; end end // END OF CASE Regards, Rafael -----Original Message----- From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Claus Futtrup Sent: Sunday, January 22, 2017 3:59 PM To: International users mailing list for Scilab. Subject: [Scilab-users] case control statement Hi there I'd like to use the "case" control statement to select a few options. I'm wondering, is it possible for a case to have multiple options, I mean like this: select model case 1,3,4 then do something case 2 then do something case 5 then do something end Could I define [1 3 4] as a group of options and ask "CASE IN GROUP" ... or how would I go about and implement this? Best regards, Claus _______________________________________________ users mailing list users at lists.scilab.org http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From jrafaelbguerra at hotmail.com Sun Jan 22 21:27:38 2017 From: jrafaelbguerra at hotmail.com (Rafael Guerra) Date: Sun, 22 Jan 2017 20:27:38 +0000 Subject: [Scilab-users] case control statement In-Reply-To: References: <46e683a5-22fe-7b34-db0c-a012f7456e02@gmail.com> Message-ID: Apologies for previous Outlook emails with company info classification - will remove this in the future. From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Rafael Guerra Sent: Sunday, January 22, 2017 7:38 PM To: Users mailing list for Scilab Subject: Re: [Scilab-users] case control statement Well, it selects only %true expressions, actually I believe it selects only the first case true expression encountered, so the cases need to be exclusive. You can test and let us know From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Claus Futtrup Sent: Sunday, January 22, 2017 7:31 PM To: users at lists.scilab.org Subject: Re: [Scilab-users] case control statement Hi Rafael Interesting... So I don't need to select anything, I can just do case model== something. (Or maybe select initializes the case ... but it looks to me like you're not really using select for anything) /Claus On 22-01-2017 19:18, Rafael Guerra wrote: Hi Claus, Check this code out: // START OF (UGLY) CASE loop= %t; while loop printf("\n") str = input("Enter number (1-7) or 0 to exit: n=","string"); n = evstr(str); select %t case n== 2 printf("single choice...\n"); case n== 5 printf("single choice...\n"); case or(n==[1 3 4]) printf("n=%i --> multiple choice#1:\n",n); case or(n==[6,7]) printf("n=%i --> multiple choice#2:\n",n); case n==0 printf("Bye...\n"); loop=%f; end end // END OF CASE Regards, Rafael -----Original Message----- From: users [mailto:users-bounces at lists.scilab.org] On Behalf Of Claus Futtrup Sent: Sunday, January 22, 2017 3:59 PM To: International users mailing list for Scilab. Subject: [Scilab-users] case control statement Hi there I'd like to use the "case" control statement to select a few options. I'm wondering, is it possible for a case to have multiple options, I mean like this: select model case 1,3,4 then do something case 2 then do something case 5 then do something end Could I define [1 3 4] as a group of options and ask "CASE IN GROUP" ... or how would I go about and implement this? Best regards, Claus _______________________________________________ users mailing list users at lists.scilab.org http://lists.scilab.org/mailman/listinfo/users -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.carrico at free.fr Mon Jan 23 09:41:00 2017 From: paul.carrico at free.fr (paul.carrico at free.fr) Date: Mon, 23 Jan 2017 09:41:00 +0100 Subject: [Scilab-users] optim vs Neldermead: improvement Message-ID: Hi All I'm using 'optim' and 'NelderMead' in conjunction with my finite element solver. A "good" optimization is a balance between accuracy and cpu time ? in other word I do not necessary need to be accurate at 1e-11 but requiring a lot of iterations where 1e-3 is enough with a lower amount of loops. In my understanding: * With 'optim', I can modifiy * The step value h in numderivative (put at 1e-3 after previous tests on analytical functions tests) * The values of epsf (default value) and epsg (tested at 1e-3 and 1e-5) * With "Neldermead", I can change: * Tolfunrelative (tested at default value for the moment) * Tolxrelative (tested at default value for the moment) Am I right or is there another 'flags' I can play with? _NB_: so far, Nelder-Mead requires less iterations than 'optim' with a single variable ? I'm wondering how can I improve optim use that is supposed to converge faster? Thanks Paul -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.bignier at scilab-enterprises.com Mon Jan 23 11:37:56 2017 From: paul.bignier at scilab-enterprises.com (Paul Bignier) Date: Mon, 23 Jan 2017 11:37:56 +0100 Subject: [Scilab-users] optim vs Neldermead: improvement In-Reply-To: References: Message-ID: <71fe5b72-fca7-9dab-0ccb-0c336bfef6da@scilab-enterprises.com> Hi Paul, As I'm sure you've read them, optim , neldermead & numderivative help pages provide you with all the flags you can customize. After that, it's all in the functions that you provide to compute the cost & its derivative. Best regards, Paul On 01/23/2017 09:41 AM, paul.carrico at free.fr wrote: > > Hi All > > I?m using ?optim? and ?NelderMead? in conjunction with my finite > element solver. > > A ?good? optimization is a balance between accuracy and cpu time ? in > other word I do not necessary need to be accurate at 1e-11 but > requiring a lot of iterations where 1e-3 is enough with a lower amount > of loops. > > In my understanding: > > 1. With ?optim?, I can modifiy > > * The step value h in numderivative (put at 1e-3 after previous > tests on analytical functions tests) > * The values of epsf (default value) and epsg (tested at 1e-3 and 1e-5) > > 1. With ?Neldermead?, I can change: > > * Tolfunrelative (tested at default value for the moment) > * Tolxrelative (tested at default value for the moment) > > > Am I right or is there another 'flags' I can play with? > > /NB/: so far, Nelder-Mead requires less iterations than ?optim? with a > single variable ? I?m wondering how can I improve optim use that is > supposed to converge faster? > > Thanks > > Paul > > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -- Paul BIGNIER Development engineer ----------------------------------------------------------- Scilab Enterprises 143bis rue Yves Le Coz - 78000 Versailles, France Phone: +33.1.80.77.04.68 http://www.scilab-enterprises.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From paul.carrico at free.fr Mon Jan 23 11:47:31 2017 From: paul.carrico at free.fr (paul.carrico at free.fr) Date: Mon, 23 Jan 2017 11:47:31 +0100 Subject: [Scilab-users] optim vs Neldermead: improvement In-Reply-To: <71fe5b72-fca7-9dab-0ccb-0c336bfef6da@scilab-enterprises.com> References: <71fe5b72-fca7-9dab-0ccb-0c336bfef6da@scilab-enterprises.com> Message-ID: <962115cf5e7d325e3b7eb6b15a8642bd@free.fr> Of course I did :-) It is a way as well to share feedback on the influence of some flags; as it has been said 'it is my understanding" ... Paul Le 2017-01-23 11:37, Paul Bignier a ?crit : > Hi Paul, > > As I'm sure you've read them, optim [1 [1]], neldermead [2 [2]] & > numderivative [3 [3]] help pages provide you with all the flags you can > customize. > After that, it's all in the functions that you provide to compute the > cost & its derivative. > > Best regards, > Paul > > On 01/23/2017 09:41 AM, paul.carrico at free.fr wrote: > >> Hi All >> >> I'm using 'optim' and 'NelderMead' in conjunction with my >> finite element solver. >> >> A "good" optimization is a balance between accuracy and cpu time >> ? in other word I do not necessary need to be accurate at 1e-11 >> but requiring a lot of iterations where 1e-3 is enough with a lower >> amount of loops. >> >> In my understanding: >> >> * With 'optim', I can modifiy >> >> * The step value h in numderivative (put at 1e-3 after previous >> tests on analytical functions tests) >> * The values of epsf (default value) and epsg (tested at 1e-3 and >> 1e-5) >> >> * With "Neldermead", I can change: >> >> * Tolfunrelative (tested at default value for the moment) >> * Tolxrelative (tested at default value for the moment) >> >> Am I right or is there another 'flags' I can play with? >> >> _NB_: so far, Nelder-Mead requires less iterations than 'optim' >> with a single variable ? I'm wondering how can I improve optim >> use that is supposed to converge faster? >> >> Thanks >> >> Paul >> >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > > -- > Paul BIGNIER > Development engineer > ----------------------------------------------------------- > Scilab Enterprises > 143bis rue Yves Le Coz - 78000 Versailles, France > Phone: +33.1.80.77.04.68 > http://www.scilab-enterprises.com > > Links: > ------ > [1] https://help.scilab.org/docs/6.0.0/en_US/optim.html > [2] https://help.scilab.org/docs/6.0.0/en_US/neldermead.html > [3] https://help.scilab.org/docs/6.0.0/en_US/numderivative.html > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users Links: ------ [1] https://help.scilab.org/docs/6.0.0/en_US/optim.html [2] https://help.scilab.org/docs/6.0.0/en_US/neldermead.html [3] https://help.scilab.org/docs/6.0.0/en_US/numderivative.html -------------- next part -------------- An HTML attachment was scrubbed... URL: From aardelean at mybiosis.info Wed Jan 25 19:00:45 2017 From: aardelean at mybiosis.info (Adorian Ardelean) Date: Wed, 25 Jan 2017 20:00:45 +0200 Subject: [Scilab-users] legends() in scilab-6.0.0-beta-1 Message-ID: <83583f79-f979-c7cb-f51d-a1d91bcd7d45@mybiosis.info> Hi, I am trying to run a test scilab script in a debian 8 server environment, but legends() is constantly failing. I execute the script file via command line & the scilab version is scilab-6.0.0-beta-1 ./bin/scilab -nw -nb -e "exec('sci.sci')"; and I get the following: --> t=0:0.1:2*%pi; --> scf(8); --> xset("line style",2);plot2d(t,cos(t),style=5); --> xset("line style",4);plot2d(t,sin(t),style=3); --> legends(["sin(t)";"cos(t)"],[[5;2],[3;4]], with_box=%f, opt="?") terminate called after throwing an instance of 'GiwsException::JniCallMethodException' what(): Exception when calling Java method : at org.scilab.modules.renderer.JoGLView.axes.AxesDrawer.updateAxesTransformation(Unknown Source) at org.scilab.modules.renderer.CallRenderer.updateSubwinScale(Unknown Source) at org.scilab.modules.renderer.JoGLView.axes.AxesDrawer.updateAxesTransformation(Unknown Source) at org.scilab.modules.renderer.CallRenderer.updateSubwinScale(Unknown Source) A fatal error has been detected by Scilab. Your instance will probably quit unexpectedly soon. If a graphic feature has been used, this might be caused by the system graphic drivers. Getdebuginfo throws the following info: !Scilab Version: scilab-6.0.0-beta-1 ! ! ! !Compilation date: Feb 10 2016 ! ! ! !Compilation time: 13:58:37 ! ! ! !Compileur version: 4.8.2 20140120 (Red Hat 4.8.2-15) ! ! ! !XML version: 2.9.1 ! ! ! !Compiler Architecture: X64 ! a = !Total memory: 32876156 ! ! ! !Used memory: 32230312 ! ! ! !Free memory: 645844 ! ! ! !Shared memory: 0 ! ! ! !Buffers memory: 439632 ! ! ! !Cached memory: 30117676 ! ! ! !Used -/+ buffers/cache: 1673004 ! ! ! !Free -/+ buffers/cache: 31203152 ! ! ! !Total swap: 16768892 ! ! ! !Used swap: 0 ! ! ! !Free swap: 16768892 ! Is this a bug that should be reported? All the best, Adorian From sgougeon at free.fr Wed Jan 25 21:34:31 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Wed, 25 Jan 2017 21:34:31 +0100 Subject: [Scilab-users] legends() in scilab-6.0.0-beta-1 In-Reply-To: <83583f79-f979-c7cb-f51d-a1d91bcd7d45@mybiosis.info> References: <83583f79-f979-c7cb-f51d-a1d91bcd7d45@mybiosis.info> Message-ID: <58890BD7.5030809@free.fr> Hello Adorian, Le 25/01/2017 19:00, Adorian Ardelean a ?crit : > Hi, > > I am trying to run a test scilab script in a debian 8 server > environment, but legends() is constantly failing. > > I execute the script file via command line & the scilab version is > scilab-6.0.0-beta-1 > > ./bin/scilab -nw -nb -e "exec('sci.sci')"; > > and I get the following: > > --> t=0:0.1:2*%pi; > > --> scf(8); > > --> xset("line style",2);plot2d(t,cos(t),style=5); > > --> xset("line style",4);plot2d(t,sin(t),style=3); > > --> legends(["sin(t)";"cos(t)"],[[5;2],[3;4]], with_box=%f, opt="?") > > .../... > Is this a bug that should be reported? If it is a bug, it may be specific to debian. I don't get it under MSWindows 7 x64. Scilab 6.0.0-beta evolves quickly. You may try with a more recent release: http://www.scilab.org/fr/development/nightly_builds/master Best regards Samuel Gougeon From Pablo_F_7 at hotmail.com Sun Jan 29 19:13:04 2017 From: Pablo_F_7 at hotmail.com (Pablo Fonovich) Date: Sun, 29 Jan 2017 18:13:04 +0000 Subject: [Scilab-users] Simultaneous record and play sound with scilab Message-ID: Hi: I have to test some audio equipment i've built, and i wanted to know if its possible to play a sound and record an input simultaneously with scilab. There is a portaudio toolbox, but is a bit old and i could not manage to get it working. The idea is to generate some sinusoidal signals and play them throuh a pro audio card. That signal is going to be fed to my audio equipment under test and the response of it should be recorded by scilab. So i do not need to play what i'm recording; from scilab's point of view, they are two independent signals. Thanks in advance -------------- next part -------------- An HTML attachment was scrubbed... URL: From mrscilab at gmail.com Mon Jan 30 00:25:46 2017 From: mrscilab at gmail.com (Max Rossi) Date: Sun, 29 Jan 2017 16:25:46 -0700 (MST) Subject: [Scilab-users] Non rectangular contour plot Message-ID: <1485732346156-4035420.post@n3.nabble.com> Hi all, I'm trying to plot in Scilab the surface error of different non rectangular panels (see attachments). At a certain point of my code, everything is turned into nice XYZ data but the only way I found to plot the data is to generate a grid and fit the Z above it as follows: tl_coef = cshep2d(XYZ); xpx = round((max(X)-min(X))/pix_size); ypx = round((max(Y)-min(Y))/pix_size); vx = linspace(min(X),max(X),xpx); vy = linspace(min(Y),max(Y),ypx); [Xg,Yg] = ndgrid(vx,vy); map1 = eval_cshep2d(Xg,Yg, tl_coef); When the panel is not rectangular or circular I'm in trouble assigning %nan to points that are inside the grid but outside the panel XY measured locations. Is there any smart way to manage the problem? Thanks! Max B1-R1_558_pts.png A1L-R01_800_pts.png -- View this message in context: http://mailinglists.scilab.org/Non-rectangular-contour-plot-tp4035420.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From Christophe.Dang at sidel.com Mon Jan 30 13:59:44 2017 From: Christophe.Dang at sidel.com (Dang Ngoc Chan, Christophe) Date: Mon, 30 Jan 2017 12:59:44 +0000 Subject: [Scilab-users] Non rectangular contour plot Message-ID: Hello, > De : Max Rossi > Envoy? : lundi 30 janvier 2017 00:26 > > I'm trying to plot in Scilab the surface error of different non rectangular panels (see attachments). > [...] > When the panel is not rectangular or circular I'm in trouble assigning %nan to points > that are inside the grid but outside the panel XY measured locations. > Is there any smart way to manage the problem? I'm not sure I understand well your problem but a nice and efficient way to select a set of matrix elements is to have a matrix of booleans of the same size, a kind of mask. If map1 is the matrix of values you want to display and mask is a matrix of booleans, mask(m, n) is %t if (Xg(m), Yg(n)) is inside the panel, then you can use map1(~mask) = %nan; see https://help.scilab.org/docs/6.0.0/en_US/extraction.html HTH 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. From bruno.pincon at univ-lorraine.fr Mon Jan 30 16:20:37 2017 From: bruno.pincon at univ-lorraine.fr (=?UTF-8?Q?Pin=c3=a7on_Bruno?=) Date: Mon, 30 Jan 2017 16:20:37 +0100 Subject: [Scilab-users] Non rectangular contour plot In-Reply-To: <1485732346156-4035420.post@n3.nabble.com> References: <1485732346156-4035420.post@n3.nabble.com> Message-ID: Le 30/01/2017 ? 00:25, Max Rossi a ?crit : > Hi all, > > I'm trying to plot in Scilab the surface error of different non rectangular > panels (see attachments). > At a certain point of my code, everything is turned into nice XYZ data but > the only way I found to plot the data is to generate a grid and fit the Z > above it as follows: > > tl_coef = cshep2d(XYZ); > xpx = round((max(X)-min(X))/pix_size); > ypx = round((max(Y)-min(Y))/pix_size); > vx = linspace(min(X),max(X),xpx); > vy = linspace(min(Y),max(Y),ypx); > [Xg,Yg] = ndgrid(vx,vy); > map1 = eval_cshep2d(Xg,Yg, tl_coef); > > When the panel is not rectangular or circular I'm in trouble assigning %nan > to points that are inside the grid but outside the panel XY measured > locations. > Is there any smart way to manage the problem? Hello, /If I understand well, you want a way to put Nan for those grid points which are far from interpolation points (because the values got by cshep2d are not really meaningful due to large errors) ? For "exterior points", assuming the interpolation region is more or less convex a possibility would be to compute the convex-hull of the (x-y coordinates) interpolation points and to test if each grid point is inside but I 'm not sure you can do that immediatly with scilab : the convex hull function was part of metanet which is not embedded in scilab since a while, maybe it is still available through atoms. Btw I don't remenber if there is a "inside polygon test" in scilab. Otherwise you could try a force brute method (which could be accelerated) by computing the minimal distance between each grid point to the interpolations points and discarding those which are too far. This can be done like this : (assuming that X and Y are the coordinates of the interpolation points) [Xg,Yg] = ndgrid(vx,vy); Zg = eval_cshep2d(Xg,Yg, tl_coef); // compute distance betwen grid and interpolation points ngp = size(Zg,"*") dmin = zeros(Zg) for k = 1:ngp dmin(k) = sqrt(min( (Xg(k) - X).^2 + (Yg(k) - Y).^2) ) end // discard points which are too far threshold_dist = 0.1 // to be set adequately... Zg(dmin > threshold_dist) = %nan hth Bruno /// -------------- next part -------------- An HTML attachment was scrubbed... URL: From Christophe.Dang at sidel.com Mon Jan 30 16:36:24 2017 From: Christophe.Dang at sidel.com (Dang Ngoc Chan, Christophe) Date: Mon, 30 Jan 2017 15:36:24 +0000 Subject: [Scilab-users] Non rectangular contour plot Message-ID: Hello, > De : Pin?on Bruno > Envoy? : lundi 30 janvier 2017 16:21 > > a possibility would be to compute > the convex-hull of the (x-y coordinates) interpolation points and > to test if each grid point is inside but I 'm not sure you can do > that immediatly with Scilab For your information, I put a piece of code that contains a function called marche_jarvis() here: https://fr.wikipedia.org/wiki/Discussion:Probl%C3%A8me_du_cercle_minimum#Programme_Scilab Apart from the fact that the comments are in French, the function is a boiler plate (I hope). It uses the Jarvis walk algorithm, which is not the most efficient but is rather simple to implement (-: HTH -- 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. From Christophe.Dang at sidel.com Mon Jan 30 16:49:57 2017 From: Christophe.Dang at sidel.com (Dang Ngoc Chan, Christophe) Date: Mon, 30 Jan 2017 15:49:57 +0000 Subject: [Scilab-users] {EXT} Re: Non rectangular contour plot In-Reply-To: References: Message-ID: Hello again > De : De la part de Dang Ngoc Chan, Christophe > Envoy? : lundi 30 janvier 2017 16:36 > > [Determination of the convex hull with Jarvis walk] I just extracted the function and put it here: https://fr.wikipedia.org/wiki/Discussion:Marche_de_Jarvis#Programme_Scilab which might be more convenient. 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. From sgougeon at free.fr Mon Jan 30 17:01:00 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Mon, 30 Jan 2017 17:01:00 +0100 Subject: [Scilab-users] Non rectangular contour plot In-Reply-To: <1485732346156-4035420.post@n3.nabble.com> References: <1485732346156-4035420.post@n3.nabble.com> Message-ID: Hello, Le 30/01/2017 ? 00:25, Max Rossi a ?crit : > Hi all, > > I'm trying to plot in Scilab the surface error of different non rectangular > panels (see attachments). > At a certain point of my code, everything is turned into nice XYZ data but > the only way I found to plot the data is to generate a grid and fit the Z > above it as follows: What are the Z value(s) set for points outside the polygonal boundary of the ROI? Have they already a special value, or a specific range? Otherwise, as answered by Bruno, you may use an external in_polygon() boolean function. There is this one: https://fileexchange.scilab.org/toolboxes/121000 But it is not vectorized (easy to do). Some vectorized (so much faster) version already exists in an external toolbox, but i don't remember which one.. HTH Samuel Gougeon From sgougeon at free.fr Mon Jan 30 17:11:12 2017 From: sgougeon at free.fr (Samuel Gougeon) Date: Mon, 30 Jan 2017 17:11:12 +0100 Subject: [Scilab-users] help pages: ToC of a subsection: how to add a short presentation before the automatic list of entries ? Message-ID: <6188c192-8d89-bf41-0b86-badfa57b68ca@free.fr> Hello Scilabers and developpers, In the summary page of a subsection in the Scilab's help or in the help tree of an external module, like this one , i would like to add/write some short presentation of the subsection. Is it possible to do that? The CHAPTER source file of the subsection would likely be the first candidate to enable that. But i am not sure that there is a proper tag after which text could be introduced. Is there any one? If yes, it is unlikely processed according to the docbook standard. But already, being able to write "raw" unformated text supporting only "new line \n" would help. For the time being, beyond the "title=" one, i have not found any documentation about the set of tags supported in CHAPTER files. Thanks for any hint Regards Samuel Gougeon -------------- next part -------------- An HTML attachment was scrubbed... URL: From Christophe.Dang at sidel.com Mon Jan 30 13:46:10 2017 From: Christophe.Dang at sidel.com (Dang Ngoc Chan, Christophe) Date: Mon, 30 Jan 2017 12:46:10 +0000 Subject: [Scilab-users] Simultaneous record and play sound with scilab Message-ID: Hello, > De : Pablo Fonovich > Envoy? : dimanche 29 janvier 2017 19:13 > > i wanted to know if its possible to play a sound and record an input simultaneously with Scilab. I'm not sure that this fulfils your need, but you can use the savewave() function to generate a .wav file, then use any player to generate the output signal while recording with another application. https://help.scilab.org/docs/6.0.0/en_US/savewave.html Hope this help -- 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. From mrscilab at gmail.com Tue Jan 31 00:54:42 2017 From: mrscilab at gmail.com (Max Rossi) Date: Mon, 30 Jan 2017 16:54:42 -0700 (MST) Subject: [Scilab-users] Non rectangular contour plot In-Reply-To: References: <1485732346156-4035420.post@n3.nabble.com> Message-ID: <1485820482714-4035429.post@n3.nabble.com> Hi everybody, sorry for the lack of clarity and thanks for all your suggestions: in fact I'm trying to understand if one XgYg grid point is contained or not in the envelope of some scattered XY coordinates (which I can assume as convex). Extraction works fine when the condition is simple. As a matter of fact for the circle I worked it out that way: Zg_nan = find(Xg.^2 + Yg.^2 > max(X.^2 + Y.^2)); map1(Zg_nan) = %nan; For the general case, I thought about the brute force mentioned by Bruno but somebody may be tempted to set a px_size for the grid much smaller than the measured points spread. What I can do is to constrain the grid size to be greater than the minimum measured XY distance and/or using as suggested an adequate threshold for the Zg_nan check. As for Samuel, the Z outside the ROI are not measured at all but thanks for the in_polygon function: that's another very useful option. In that case I should retrieve vertex coordinates by Christophe's marche_jarvis (wow) and than use the in_polygon to generate the boolean mask. That should do it! Best, m. -- View this message in context: http://mailinglists.scilab.org/Non-rectangular-contour-plot-tp4035420p4035429.html Sent from the Scilab users - Mailing Lists Archives mailing list archive at Nabble.com. From Pablo_F_7 at hotmail.com Tue Jan 31 14:44:22 2017 From: Pablo_F_7 at hotmail.com (Pablo Fonovich) Date: Tue, 31 Jan 2017 13:44:22 +0000 Subject: [Scilab-users] Simultaneous record and play sound with scilab In-Reply-To: References: Message-ID: Thanks for your answer! The idea was to do it all in scilab. I finally managed to get portaudio toolbox working... but it does not let you record and play at the same time. I finally cheated and added 1sec delay to mi equipment (digital recorder) and put it in loopback mode, so with scilab i played a sound and then recorded the delayed answer from de equipment. Is not what i wanted but it works. ________________________________ De: users en nombre de Dang Ngoc Chan, Christophe Enviado: lunes, 30 de enero de 2017 09:46 a.m. Para: Users mailing list for Scilab Asunto: Re: [Scilab-users] Simultaneous record and play sound with scilab Hello, > De : Pablo Fonovich > Envoy? : dimanche 29 janvier 2017 19:13 > > i wanted to know if its possible to play a sound and record an input simultaneously with Scilab. I'm not sure that this fulfils your need, but you can use the savewave() function to generate a .wav file, then use any player to generate the output signal while recording with another application. https://help.scilab.org/docs/6.0.0/en_US/savewave.html savewave - Save data into a sound wav file. help.scilab.org Description. save x into a wav sound file. you can transform other sound files into wav file with the sox program. Hope this help -- 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 at lists.scilab.org http://lists.scilab.org/mailman/listinfo/users users Info Page - Scilab lists.scilab.org The place to ask (and answer) questions on using Scilab. To see the collection of prior postings to the list, visit the users archives. -------------- next part -------------- An HTML attachment was scrubbed... URL: From daniel.neutzler at haw-hamburg.de Tue Jan 31 13:15:00 2017 From: daniel.neutzler at haw-hamburg.de (Daniel Neutzler) Date: Tue, 31 Jan 2017 13:15:00 +0100 Subject: [Scilab-users] Question about javasci V2 Message-ID: Hi, I am using Scilab 5.5.2 and trying to open a Scilab script from Java. Therfore I followed the documentation: Compute and run with javasci v2. I use Eclipse to compile and run. It works, but I want now to open it in "advanced mode" to get grahpics (*Scilab sci = new Scilab(true);*). If i do it, I get a compile Error. What's wrong ? Code and Error Plot out see below. Thank You for your Help, Daniel Neutzler ####Error#### java.lang.ExceptionInInitializerError at org.scilab.modules.commons.xml.XConfiguration.(Unknown Source) at org.scilab.modules.core.Scilab.(Unknown Source) at org.scilab.modules.javasci.Call_ScilabJNI.Call_ScilabOpen(Native Method) at org.scilab.modules.javasci.Call_Scilab.Call_ScilabOpen(Unknown Source) at org.scilab.modules.javasci.Scilab.open(Unknown Source) at StartUp.main.main(main.java:17) Caused by: java.lang.NullPointerException at java.io.File.(Unknown Source) at org.scilab.modules.commons.ScilabConstants.(Unknown Source) ... 6 more Exception in thread "main" #### JAVA Code#### package StartUp; *import org.scilab.modules.javasci.Scilab;** **import org.scilab.modules.types.ScilabType;* import java.io.File; import java.io.FileNotFoundException; public class main { public static void main(String[] args) throws FileNotFoundException{ System.out.println("Starte Programm Pin-Positionsanalyse-Tool V1.0..."); try { *Scilab sci = new Scilab(true); // Starts in advanced mode * if (sci.open()) { sci.execException(new File("C:/Users/Daniel/Desktop/test.sce")); sci.close(); } else { System.out.println("Could not start Scilab "); } /* Can be improved by other exceptions: AlreadyRunningException, * InitializationException, UndefinedVariableException, * UnknownTypeException, etc */ } catch (org.scilab.modules.javasci.JavasciException e) { System.err.println("An exception occurred: " + e.getLocalizedMessage()); } } } -------------- next part -------------- An HTML attachment was scrubbed... URL: