From samuelamamjnr at gmail.com Wed Dec 1 09:27:50 2021 From: samuelamamjnr at gmail.com (Samuel Amamjnr) Date: Wed, 1 Dec 2021 09:27:50 +0100 Subject: [Scilab-users] (no subject) Message-ID: What is the worldwide usage count of Scilab -------------- next part -------------- An HTML attachment was scrubbed... URL: From samuelamamjnr at gmail.com Wed Dec 1 09:29:23 2021 From: samuelamamjnr at gmail.com (Samuel Amamjnr) Date: Wed, 1 Dec 2021 09:29:23 +0100 Subject: [Scilab-users] (no subject) Message-ID: How is Scilab's development funded -------------- next part -------------- An HTML attachment was scrubbed... URL: From ray.finucane at gmail.com Wed Dec 1 12:39:40 2021 From: ray.finucane at gmail.com (Ray Finucane) Date: Wed, 1 Dec 2021 03:39:40 -0800 Subject: [Scilab-users] (no subject) In-Reply-To: References: Message-ID: I am a long time user. 20 years or more On Wed, Dec 1, 2021 at 00:29 Samuel Amamjnr wrote: > What is the worldwide usage count of Scilab > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users > -- Ray Finucane 925724 4040 .ray.finucane at gmail.com -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfuttrup at gmail.com Wed Dec 1 18:07:09 2021 From: cfuttrup at gmail.com (Claus Futtrup) Date: Wed, 1 Dec 2021 18:07:09 +0100 Subject: [Scilab-users] (no subject) In-Reply-To: References: Message-ID: <35d3b47e-dafd-cab8-2417-b41794ca9a6c@gmail.com> Hi Samuel I have no idea. Maybe we can ask how many Scilab installation files were downloaded (for each release)? ... that they know of (I say this because packages can be redistributed). For example for the Release 6.0 series, and the 6.1 series? Best regards, Claus On 01-12-2021 09:27, Samuel Amamjnr wrote: > What is the worldwide usage count of Scilab > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users From p.muehlmann at gmail.com Sat Dec 4 17:29:39 2021 From: p.muehlmann at gmail.com (P M) Date: Sat, 4 Dec 2021 17:29:39 +0100 Subject: [Scilab-users] clarification in data type preciscion needed Message-ID: Dear programmers, I need/want to follow some C-library code with Scilab. The C-libarary defines a lot of variables by "int64_t". - So far I understand int64_t is a datatype of exactly 64bit length (8 byte signed integer) What would be the correct equivalent data type in Scilab? - Normally I'd use doubles in Scilab, but is that correct? Thank you, Philipp -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.s.strom at hslmg.de Sat Dec 4 20:39:21 2021 From: j.s.strom at hslmg.de (Jens Simon Strom) Date: Sat, 4 Dec 2021 20:39:21 +0100 Subject: [Scilab-users] Getting the variable name used for a function input argument In-Reply-To: References: <1989424254.375799.1605881328060.JavaMail.zimbra@insa-rennes.fr> <740fb2a0-d406-6aa5-b02c-0fd2fcb9bf49@hslmg.de> <1250650f-0161-3eff-37ee-1ea69b625508@fceia.unr.edu.ar> Message-ID: Hi, Thanks for all the responses and sorry for not beeing able to answer before now. The background of my question was to write a function for formatted output of complex variables in polar form with mprintf like function printc(c) which returns the name of c on calling level, |c|, and the angle. I understand now that I have to write e. g. function printc(c,cname) where cname is the wanted string. This can even give some additional freedeom in modifying the output name. Regards Jens Am 24.11.2021 um 09:51 schrieb St?phane Mottelet: > > Hi, > > Le 24/11/2021 ? 01:42, Federico Miyara a ?crit?: >> >> I'm not completely sure, but I think this is not possible since what >> is passed to the function isn't a variable but the value contained in >> the variable. > No. Internally, input arguments are passed as references to the true > object. There is no copy unless an input argument is modified in the > function (in that case a copy with local scope only). >> The name is lost in the process. > Yes, before the first line of the function body the original object > has the name of the argument, although both names refer to the same > object. >> >> An alternative way (but I don't know if this would be acceptable for >> you) is that the function had as its argument a variable name (hence, >> a string), so your x would be "xNum", instead of 123. Then you could >> use evstr() to get the value of the variable to proceed with the >> processing. > > I think that we are in the presence of an XY problem > (https://xyproblem.info/) and that Jens should explain the whole story. > > S. > >> >> Regards, >> >> Federico Miyara >> >> >> On 23/11/2021 17:18, Jens Simon Strom wrote: >>> >>> Hi Scilab friends, >>> Given a numeric variable like xNum as an input argument of a >>> function call, how can I produce the variable name string "xNum" >>> within the function? >>> >>> Example: >>> >>> function [name,y]=foo(x) >>> ?? name=??? >>> ?? y=x^2 >>> endfunction >>> >>> xNum=123. >>> [name,y]=foo(xNum) >>> The result for name should be the string "xNum" >>> >>> Regards >>> Jens >>> _______________________________________________ >>> users mailing list >>> users at lists.scilab.org >>> http://lists.scilab.org/mailman/listinfo/users >>> >>> >> >> >> >> Libre de virus. www.avast.com >> >> >> >> <#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2> >> >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > -- > St?phane Mottelet > Ing?nieur de recherche > EA 4297 Transformations Int?gr?es de la Mati?re Renouvelable > D?partement G?nie des Proc?d?s Industriels > Sorbonne Universit?s - Universit? de Technologie de Compi?gne > CS 60319, 60203 Compi?gne cedex > Tel : +33(0)344234688 > http://www.utc.fr/~mottelet > > _______________________________________________ > users mailing list > users 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 Dec 4 20:59:59 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Sat, 4 Dec 2021 20:59:59 +0100 Subject: [Scilab-users] Getting the variable name used for a function input argument In-Reply-To: References: <1989424254.375799.1605881328060.JavaMail.zimbra@insa-rennes.fr> <740fb2a0-d406-6aa5-b02c-0fd2fcb9bf49@hslmg.de> <1250650f-0161-3eff-37ee-1ea69b625508@fceia.unr.edu.ar> Message-ID: <96236b82-9bd2-34a1-b9d0-d832dad35e0f@free.fr> Hello Jens, Le 04/12/2021 ? 20:39, Jens Simon Strom a ?crit?: > Hi, > Thanks for all the responses and sorry for not beeing able to answer > before now. > > The background of my question was to write a function for formatted > output of complex variables in polar form with > mprintf like > function printc(c) > > which returns the name of c on calling level, |c|, and the angle. > > I understand now that I have to write e. g. > > function printc(c,cname) > > where cname is the wanted string. This can even give some additional > freedeom in modifying the output name. So, /unless you need to know the name *inside* printc() for some unsaid purpose/, what would be the difference between in one hand [name, mag, arg] = printc(myvar, "myvar") and on the other hand name = "myvar"; [mag, arg] = printc(myvar) ? BR Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From p.muehlmann at gmail.com Sun Dec 5 07:23:30 2021 From: p.muehlmann at gmail.com (P M) Date: Sun, 5 Dec 2021 07:23:30 +0100 Subject: [Scilab-users] clarification in data type preciscion needed In-Reply-To: References: Message-ID: ... Is it possible to delete this question? I guess a int64_t variable should not be represented by a floating point datatype... Scilab 6 offers int64 datatype... Seems more correct. BR Philipp Am Samstag, 4. Dezember 2021 schrieb P M : > Dear programmers, > > I need/want to follow some C-library code with Scilab. > > The C-libarary defines a lot of variables by "int64_t". > > - So far I understand int64_t is a datatype of exactly 64bit length (8 > byte signed integer) > > > > What would be the correct equivalent data type in Scilab? > > - Normally I'd use doubles in Scilab, but is that correct? > > > > Thank you, > Philipp > > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Sun Dec 5 20:02:03 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Sun, 5 Dec 2021 20:02:03 +0100 Subject: [Scilab-users] Getting the variable name used for a function input argument In-Reply-To: <96236b82-9bd2-34a1-b9d0-d832dad35e0f@free.fr> References: <1989424254.375799.1605881328060.JavaMail.zimbra@insa-rennes.fr> <740fb2a0-d406-6aa5-b02c-0fd2fcb9bf49@hslmg.de> <1250650f-0161-3eff-37ee-1ea69b625508@fceia.unr.edu.ar> <96236b82-9bd2-34a1-b9d0-d832dad35e0f@free.fr> Message-ID: <66966863-f3d9-d325-d840-4a2e90d5b6da@free.fr> Le 04/12/2021 ? 20:59, Samuel Gougeon a ?crit?: > > So, /unless you need to know the name *inside* printc() for some > unsaid purpose/, what would be the difference between in one hand > > [name, mag, arg] = printc(myvar, "myvar") > > and on the other hand > > name = "myvar"; > [mag, arg] = printc(myvar) > > ? > So, after your mail in private, you actually needs the variable's name inside the function. Then, the easiest way to do what you expect could be to pass only the name: function printc(name) execstr("c = "+name) //Drucken einer komplexen Zahl mit Betrag und Winkel/? mprintf([name+': %f /_%7.2f?\n'],abs(c), 180/%pi*atan(imag(c),real(c))) endfunction --> myVar = 3 - 2*%i myVar = 3. - 2.i --> printc myVar myVar: 3.605551 /_ -33.69? Regards Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From j.s.strom at hslmg.de Mon Dec 6 10:40:09 2021 From: j.s.strom at hslmg.de (Jens Simon Strom) Date: Mon, 6 Dec 2021 10:40:09 +0100 Subject: [Scilab-users] Getting the variable name used for a function input argument In-Reply-To: <66966863-f3d9-d325-d840-4a2e90d5b6da@free.fr> References: <1989424254.375799.1605881328060.JavaMail.zimbra@insa-rennes.fr> <740fb2a0-d406-6aa5-b02c-0fd2fcb9bf49@hslmg.de> <1250650f-0161-3eff-37ee-1ea69b625508@fceia.unr.edu.ar> <96236b82-9bd2-34a1-b9d0-d832dad35e0f@free.fr> <66966863-f3d9-d325-d840-4a2e90d5b6da@free.fr> Message-ID: <8de44f6d-31df-1f6a-9210-750c2208f3a7@hslmg.de> Hi Samuel, Your solution is quite sophisticated. To me it was confusing to call a function without the input being bracketed. And on top of this, that a variable of type /constant/ is accepted as a /string/ within the function. Scilab seems to be more flexible than I would dare to imagine before now. However it works fine. Thanks again. Regards Jens ------------------------------------------------------------------------------------------------------------------------------------------------------------- Am 05.12.2021 um 20:02 schrieb Samuel Gougeon: > Le 04/12/2021 ? 20:59, Samuel Gougeon a ?crit?: >> >> So, /unless you need to know the name *inside* printc() for some >> unsaid purpose/, what would be the difference between in one hand >> >> [name, mag, arg] = printc(myvar, "myvar") >> >> and on the other hand >> >> name = "myvar"; >> [mag, arg] = printc(myvar) >> >> ? >> > > So, after your mail in private, you actually needs the variable's name > inside the function. > Then, the easiest way to do what you expect could be to pass only the > name: > > function printc(name) > execstr("c = "+name) > //Drucken einer komplexen Zahl mit Betrag und Winkel/? > mprintf([name+': %f /_%7.2f?\n'],abs(c), 180/%pi*atan(imag(c),real(c))) > endfunction > --> myVar = 3 - 2*%i > myVar = > 3. - 2.i > > --> printc myVar > myVar: 3.605551 /_ -33.69? > > Regards > 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 stephane.mottelet at utc.fr Mon Dec 6 10:55:20 2021 From: stephane.mottelet at utc.fr (=?UTF-8?Q?St=c3=a9phane_Mottelet?=) Date: Mon, 6 Dec 2021 10:55:20 +0100 Subject: [Scilab-users] Getting the variable name used for a function input argument In-Reply-To: <8de44f6d-31df-1f6a-9210-750c2208f3a7@hslmg.de> References: <1989424254.375799.1605881328060.JavaMail.zimbra@insa-rennes.fr> <740fb2a0-d406-6aa5-b02c-0fd2fcb9bf49@hslmg.de> <1250650f-0161-3eff-37ee-1ea69b625508@fceia.unr.edu.ar> <96236b82-9bd2-34a1-b9d0-d832dad35e0f@free.fr> <66966863-f3d9-d325-d840-4a2e90d5b6da@free.fr> <8de44f6d-31df-1f6a-9210-750c2208f3a7@hslmg.de> Message-ID: Hello Jens. Nothing sophisticated here. print myVar is considered by the parser as print("myVar") See "Calling function"/item 4. https://help.scilab.org/docs/6.1.1/en_US/functions.html S. Le 06/12/2021 ? 10:40, Jens Simon Strom a ?crit?: > Hi Samuel, > Your solution is quite sophisticated. To me it was confusing to call a > function without the input being bracketed. And on top of this, that a > variable of type /constant/ is accepted as a /string/ within the > function. Scilab seems to be more flexible than I would dare to > imagine before now. However it works fine. Thanks again. > > Regards > Jens > ------------------------------------------------------------------------------------------------------------------------------------------------------------- > > > Am 05.12.2021 um 20:02 schrieb Samuel Gougeon: >> Le 04/12/2021 ? 20:59, Samuel Gougeon a ?crit?: >>> >>> So, /unless you need to know the name *inside* printc() for some >>> unsaid purpose/, what would be the difference between in one hand >>> >>> [name, mag, arg] = printc(myvar, "myvar") >>> >>> and on the other hand >>> >>> name = "myvar"; >>> [mag, arg] = printc(myvar) >>> >>> ? >>> >> >> So, after your mail in private, you actually needs the variable's >> name inside the function. >> Then, the easiest way to do what you expect could be to pass only the >> name: >> >> function printc(name) >> execstr("c = "+name) >> //Drucken einer komplexen Zahl mit Betrag und Winkel/? >> mprintf([name+': %f /_%7.2f?\n'],abs(c), 180/%pi*atan(imag(c),real(c))) >> endfunction >> --> myVar = 3 - 2*%i >> myVar = >> 3. - 2.i >> >> --> printc myVar >> myVar: 3.605551 /_ -33.69? >> >> Regards >> Samuel >> >> >> _______________________________________________ >> users mailing list >> users at lists.scilab.org >> http://lists.scilab.org/mailman/listinfo/users > > > _______________________________________________ > users mailing list > users at lists.scilab.org > https://antispam.utc.fr/proxy/v3?i=SHV0Y1JZQjNyckJFa3dUQiblhF5YcUqtiWCaK_ri0kk&r=T0hnMlUyVEgwNmlmdHc1NTiGTQVgIg9a1MYkHb_GeosOO-jCQ_NnAucfYCLceioT&f=V3p0eFlQOUZ4czh2enpJS67gBdM2WVME2HqVPefA4FpGU6HeKhrEzrhzAHs-d_Wu&u=http%3A//lists.scilab.org/mailman/listinfo/users&k=ZVd0 -- St?phane Mottelet Ing?nieur de recherche EA 4297 Transformations Int?gr?es de la Mati?re Renouvelable D?partement G?nie des Proc?d?s Industriels Sorbonne Universit?s - Universit? de Technologie de Compi?gne CS 60319, 60203 Compi?gne cedex Tel : +33(0)344234688 http://www.utc.fr/~mottelet -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Mon Dec 6 18:33:04 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Mon, 6 Dec 2021 18:33:04 +0100 Subject: [Scilab-users] Getting the variable name used for a function input argument In-Reply-To: <8de44f6d-31df-1f6a-9210-750c2208f3a7@hslmg.de> References: <1989424254.375799.1605881328060.JavaMail.zimbra@insa-rennes.fr> <740fb2a0-d406-6aa5-b02c-0fd2fcb9bf49@hslmg.de> <1250650f-0161-3eff-37ee-1ea69b625508@fceia.unr.edu.ar> <96236b82-9bd2-34a1-b9d0-d832dad35e0f@free.fr> <66966863-f3d9-d325-d840-4a2e90d5b6da@free.fr> <8de44f6d-31df-1f6a-9210-750c2208f3a7@hslmg.de> Message-ID: <79f45132-90d2-22c9-16e3-8cdd49dc766a@free.fr> Hello Jens, Le 06/12/2021 ? 10:40, Jens Simon Strom a ?crit?: > Hi Samuel, > Your solution is quite sophisticated. On the opposite, it aims to be simpler. > To me it was confusing to call a function without the input being > bracketed. And on top of this, that a variable of type /constant/ is > accepted as a /string/ within the function. As a cherry on the cake, the syntax will work as well for literal values: function printc(name) execstr("c = "+name) //Drucken einer komplexen Zahl mit Betrag und Winkel/? Format = strsubst(name,"%","%%")+': %f /_%7.2f?\n' mprintf(Format, abs(c), 180/%pi*atan(imag(c), real(c))) endfunction --> printc 3-4*%i 3-4*%i: 5.000000??? /_ -53.13? > Scilab seems to be more flexible than I would dare to imagine before now. Handiness is one of the signatures of high level languages. Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Wed Dec 15 19:54:16 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Wed, 15 Dec 2021 19:54:16 +0100 Subject: [Scilab-users] Is http://mailinglists.scilab.org over? In-Reply-To: <4f734900-bccb-4e9c-2914-46bc58e54e4d@utc.fr> References: <4f734900-bccb-4e9c-2914-46bc58e54e4d@utc.fr> Message-ID: <9bf01319-0671-a9fd-33c5-f8396134299d@free.fr> Hello, Le 07/09/2021 ? 15:13, St?phane Mottelet a ?crit?: > Hi, > > is https://www.mail-archive.com/users at lists.scilab.org/ the new place > to look for the list archives ? Yes, for users@ and dev@ lists. This archives interface is poorer than the Nabble? interface, but it exists: that's already a major point! * Its search engine is welcome, although it is not as handy as the former Nabble's one. I will use it for the "uman .. @" command in the next uman 3.1 release (soon). * All binary inclusions? -- screenshots of figures, etc -- are simply ignored, and without any reference (blank lline). So they become completely invisible. This make related messages quite strange, since readable comments might become about invisible contents. * Apparently, any plain/text attachment is appended to the displayed message. * The display of the posted code samples may be corrupted, with removed \newline. This makes copy/pasting hazardous. See for instance https://www.mail-archive.com/users at lists.scilab.org/msg10674.html : plot3d(t,t,z) gce().thickness = 0; There were 2 \newline between plot3d and gce() in the posted and received message... Apparently, the interface needs semi-colons to not concatenate distinct rows..! > Le 07/09/2021 ? 15:37, St?phane Mottelet a ?crit?: >> legacy archive starting in 2007 (and ending in february 2014) >> >> http://lists.scilab.org/pipermail/users/ >> >> could be easily uploaded (e.g. mbox format) to www.mail-archive.com >> Good idea. Thanks for the reference. The pipermail archive of enseignement at lists.scilab.org is already up to date (=> 2021): http://lists.scilab.org/pipermail/enseignement/ For all other lists -- users-fr@, etc -- , indeed these archives stop in 2013. Regards Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Wed Dec 15 20:12:49 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Wed, 15 Dec 2021 20:12:49 +0100 Subject: [Scilab-users] Is http://mailinglists.scilab.org over? In-Reply-To: References: Message-ID: Hello Cl?ment, Le 21/07/2021 ? 15:37, Cl?ment David a ?crit?: > Hello Samuel, hello all, > > Indeed we noticed that but where in a hurry delivering the 6.1.1 release. The Nabble maintainers stopped the development [1] and started some action to stop the service [2]. IMHO we need to switch to another service for archiving and searching the Scilab mailing lists. We investigated on Discourse a while ago but the operating cost is too costly for us ; there is also an option to have a full switch to Mailman v3 hosted services. > > Currently there is no free equivalent to Nabble so the mailinglists archive might not be available for a time. Hopefully we can ask Nabble maintainers to restore the access but it really is a temporary solution. > > [1]:https://support.nabble.com/The-Future-of-Nabble-tt7605923.html > [2]:https://support.nabble.com/Downsizing-Nabble-tt7609715.html Thanks for the news. After displaying the help home/welcome (or CHANGES) page in Scilab, the page's header is made of links on each item: Scilab Homepage | Online Help | Wiki | Bug Tracker | Forge | Mailing Lists Archives | ATOMS | File Exchange Clicking on "Mailing Lists Archives" leads to htt*p**s*://lists.scilab.org/roundcubemail/?_task=login I have tried to login with my usual LDAP Scilab id and password: refused. What is this URL for ? The same link is proposed at the top of https://help.scilab.org/docs/6.1.1/en_US/index.html but in htt*p*:// instead of https:// Then an automatic redirection leads to the removed page http://mailinglists.scilab.org/ Regards Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Fri Dec 17 03:18:46 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Fri, 17 Dec 2021 03:18:46 +0100 Subject: [Scilab-users] console: instruction moving the scrollbar to the top In-Reply-To: <54F4E1B6.3080000@free.fr> References: <54F4E1B6.3080000@free.fr> Message-ID: <67a0dc7d-ba51-8bd5-0095-a4a128d3bf19@free.fr> Hello, Le 02/03/2015 ? 23:18, Samuel Gougeon a ?crit?: > Hello, > Are there any instructions to move the console's vertical scrollbar up > to the top? > I mean, not the caret (tohome() does it), but the scrollbar. > Even a hack through java/JIMS would be welcome. Well, this is still a very needed feature : for instance, after a clc() and the display of a help page in the console with uman(), going up to the top of the console to start viewing the top of? the page would be more handy. Digging a bit among available Java classes: jimport org.scilab.modules.gui.bridge.CallScilabBridge; jgetmethods(CallScilabBridge) shows many interesting (and working) methods addressing the console -- including CallScilabBridge.toHome(); // -- but nothing addressing directly the vertical scrolbar position. Maybe digging more would work... Any hints? The same feature would be useful for uicontrol listbox, as in the right pannel of the ATOMS interface, where the description of a selected module is displayed. Each time the scrolbar is down to the bottom. Having a way to put it at the top would be fine. BR Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From stephane.mottelet at utc.fr Fri Dec 17 18:29:02 2021 From: stephane.mottelet at utc.fr (=?UTF-8?Q?St=c3=a9phane_Mottelet?=) Date: Fri, 17 Dec 2021 18:29:02 +0100 Subject: [Scilab-users] Sundials ode solvers In-Reply-To: References: Message-ID: Dear Scilab users, A new version 0.2 of sci-sundials has been just released: https://atoms.scilab.org/toolboxes/sci_sundials/0.2 Among other internal improvements and code factorization -the differential-algebraic solver IDA is now available -the documentation is now exhaustive about the features of solvers and the options There has been an important change in the api. For example for CVODE, the two gateways cvode_solve() and cvode_extend() have been fused in cvode() and the extension is done by giving the solution as first argument: ??????????? [t,y] = cvode(f,tspan,y0,options) ??????????? [t,y,te,ye,ie] = cvode(f,tspan,y0,options) ??????????? sol = cvode(...) ??????????? solext = cvode(sol,tfinal,options) Still no gateway for ARKODE but I will now focus on the upgrade of SUNDIALS in Sscilab itself. Merry Christmas (in advance). S. Le 25/10/2021 ? 16:35, St?phane Mottelet a ?crit?: > > Hi all, > > As discussed in this thread last month > > https://www.mail-archive.com/users at lists.scilab.org/msg10679.html > > I am glad to annouce that a first version of the? sci-sundials toolbox > (maybe part of Scilab in the future) is available on Atoms in the > "Differential Equations" category (refresh the package list if you > don't see it).? To have an idea of its features I pasted below the > content of the README.md file on the gitlab project of sci-sundials > (https://gitlab.com/mottelet/sci-sundials/). > > If you appreciate the work and want to help, doc, demos, or even more > if you know how to code in C and C++ you are welcome ! > > S. > > > What has been done and what is to be done > > Until now only CVODE has been interfaced but many common features have > been developped in the OdeManager class, hence interfacing IDA will be > quite easy. ARKODE (various modern explicit, implicit and mixed > explicit/implicit Runge-Kutta solvers) does not exist in the old 2.4.0 > version of Sundials which is used in Scilab hence won't be interfaced > unless an upgrade is done (Sundials is now at version 5.7.0). The > support of Sparse Jacobians is also missing for the same reason. > > > Features > > The CVODE gateway cvode_solve() implements the following features > which were missing by the legacy LSODE/LSODA/LSODAR/... ode() gateway : > > * full a posteriori access to solver continuous extension of > solution at arbitrary points via a MList output when only one lhs > is given: > > |sol = cvode_solve(f, [t0 tf], y0) t = linspace(t0, tf, 1000) plot(t, > sol(t)) | > > The |sol| MList fields gathers all information related to the obtained > solution (time steps, solution at time steps, events, ...). The solver > can be restarted by giving the MLlist as first argument to > |cvode_extend| : > > |sol2 = cvode_extend(sol, tx, ...)| > > where |tx| is the time point to which solution has to be extended. The > options of the call that yielded |sol| are used and can be changed as > optional named parameters after |tx|. > > * a user-friendly access to solver options via optional named > parameters in cvode_solve call, i.e. > > |cvode_solve(f, tspan, y0, h0=0.01, rtol=1e-3)| > > * a really simpler way to give time span of integration allowing to > choose between error driven solver internal time steps and user > fixed time steps, i.e. > > |[t,y] = cvode_solve(f, [t0 tf], y0) [t,y] = cvode_solve(f, [t0 t1 ... > tf], y0) [t,t] = cvode_solve(f, tspan, y0, t0=0)| > > the latter style being the closest to actual |ode()| behavior where > solution is by default given at user time steps and |t0| is not > necessarily equal to |tspan(1)|, which is the default in the two > former calls above. > > * a better and user-friendly specification of events via a variable > number of outputs event function (giving value of event equations, > wheter to stop integration for a given event and event direction > selection), minimal style beeing a single output. Information > about events is also simpler to get: > > |function [eq,term,dir] = evfun(t,y) eq = y(1)-1.7; term = %f; dir = > 1; end [t,y,te,ye,ie] = cvode_solve(f, tspan, y0, events = evfun) sol > = cvode_solve(f, tspan, y0, events = evfun)| > > in the latter call information about events is recovered in > |sol.te,sol.ye,sol.ie|. > > * support of complex solution with detection of complexity in |y0| > or |f(t0,y0)|, e.g. > > |function out = crhs(t,y) out = 10*exp(2*%i*%pi*t)*y; end [t,y] = > cvode_solve(crhs, [0,5], 1) plot(t,real(y),t,imag(y))| > > * Support of a callback function called after each successfull step, > giving access to current solver statistics and allowing to stop > integration (e.g. by a "stop" button on a GUI), e.g. > > |function stop = scicallback(t,y,flag,stats) stop = %f if flag == > "step" mprintf("%s : hlast=%g\n", flag, stats.hlast) end end [t,y] = > cvode_solve(f, tspan, y0, intcb=scicallback);| > > * support of an arbitrary number of dimensions of ode state > > > Performance > > |cvode_solve()| is roughly two times faster than |ode()| for both > fixed methods (Adams and BDF). As |ode()| already did, compiled and > dynamically linked C,C++ or Fortran externals are supported by > |cvode_solve()|. When using such externals instead of Scilab functions > |cvode_solve()| is generally an order of magnitude faster. > > -- > St?phane Mottelet > Ing?nieur de recherche > EA 4297 Transformations Int?gr?es de la Mati?re Renouvelable > D?partement G?nie des Proc?d?s Industriels > Sorbonne Universit?s - Universit? de Technologie de Compi?gne > CS 60319, 60203 Compi?gne cedex > Tel : +33(0)344234688 > http://www.utc.fr/~mottelet > > _______________________________________________ > users mailing list > users at lists.scilab.org > https://antispam.utc.fr/proxy/v3?i=cWdzUmRSM0ZiRHpoUDkxTSw3-90dQgKDkqmWWemZ6js&r=WXNQOUY5VXRSNUlTdlVTTgAgPzRHrDev93-c71JTxG3gYERdftx8enpEGCicW5Zy&f=R0pWUVNEaUFuMTBCTlptbqaYxU0NWnHz-Aov_fSSM1D4vfIz2L0jb50-moW0RphD&u=http%3A//lists.scilab.org/mailman/listinfo/users&k=8YLU -- St?phane Mottelet Ing?nieur de recherche EA 4297 Transformations Int?gr?es de la Mati?re Renouvelable D?partement G?nie des Proc?d?s Industriels Sorbonne Universit?s - Universit? de Technologie de Compi?gne CS 60319, 60203 Compi?gne cedex Tel : +33(0)344234688 http://www.utc.fr/~mottelet -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Tue Dec 21 17:09:50 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Tue, 21 Dec 2021 17:09:50 +0100 Subject: [Scilab-users] Gridding uiframes. subplot and xsetech Message-ID: <8d9480dc-fc26-0e47-5150-21f2394f955e@free.fr> Dear co-Scilabers, Scilab 5.5 extended newaxes(handle)? to uiframes (uicontrol("style","frame"..)). From there, the extension of subplot() and xsetech() to uiframes is now implemented and is on review for Scilab 6.1.2. I use to use subplot() and xsetech() on figures. I hardly understand the interest of uiframes, with respect to figures. The only interesting feature i see with uiframes is that they can be stacked on different tabs in the same figure (*). Do you use uiframes for other reasons ? By the way, the layout-grid-gridbag gridding system of uiframes (and figures) looks (very) complicated to me. Does it aim to "group" several interactive components? There are a lot of pages about this in the Scilab documentation... It's easy to get lost. While using subplot will still be very simple. Thanks for any hints or comments about this topic. Regards Samuel Gougeon (*) If we were able to control the docking of figures or other interfaces with some code (not interactively), we could do the same by docking figures on each others, selectable with tabs, without uiframes. From sgougeon at free.fr Wed Dec 22 12:21:28 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Wed, 22 Dec 2021 12:21:28 +0100 Subject: [Scilab-users] uman 3.1 is released In-Reply-To: <5825F6E8.6000409@free.fr> References: <5825F6E8.6000409@free.fr> Message-ID: <9d461150-2a8e-7fcb-ad56-d2f7d248699d@free.fr> uman 3.1 is released. User manual in console. Advanced multimodal and multilingual Scilab documentation * https://atoms.scilab.org/toolboxes/uman/3.1 https://atoms.scilab.org/toolboxes/uman/3.1#leave_a_comment * Changes: https://atoms.scilab.org/toolboxes/uman/3.1/files/changelog.txt * Manuals: https://atoms.scilab.org/toolboxes/uman/3.1/files/uman_3.1_en.pdf https://atoms.scilab.org/toolboxes/uman/3.1/files/uman_3.1_fr.pdf Crashes on Scilab 6.1.1 are fixed. @ mode: New mailing list archives are used. @d will search on dev at lists. w mode (web): Version 6.1.0 is used for missing online pages v.6.1.1. The user manual is now available as well in PDF (english, french). 16 improvements & bugs fixed. 26 references added. Since Scilab 6.1.0, uman can be used in the Advanced console (supporting extended characters). !-!-!-! If you are installing uman 3.1 while you were already using uman on your computer, please delete your SCIHOME/uman directory before the first run of uman 3.1. ------ Best regards Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From cfuttrup at gmail.com Wed Dec 22 18:27:17 2021 From: cfuttrup at gmail.com (Claus Futtrup) Date: Wed, 22 Dec 2021 18:27:17 +0100 Subject: [Scilab-users] uman 3.1 is released In-Reply-To: <9d461150-2a8e-7fcb-ad56-d2f7d248699d@free.fr> References: <5825F6E8.6000409@free.fr> <9d461150-2a8e-7fcb-ad56-d2f7d248699d@free.fr> Message-ID: <9c9e581a-b41e-2bc4-8c7d-8d122ee73a2c@gmail.com> Hi Samuel Thank you for the update on uman. Good documentation and help is one of the most important essentials of any software. BTW, Merry Christmas to everybody. Cheers, Claus On 22-12-2021 12:21, Samuel Gougeon wrote: > uman 3.1 is released. > > User manual in console. Advanced multimodal and multilingual Scilab > documentation > > * https://atoms.scilab.org/toolboxes/uman/3.1 > https://atoms.scilab.org/toolboxes/uman/3.1#leave_a_comment > > * Changes: > https://atoms.scilab.org/toolboxes/uman/3.1/files/changelog.txt > > * Manuals: > https://atoms.scilab.org/toolboxes/uman/3.1/files/uman_3.1_en.pdf > https://atoms.scilab.org/toolboxes/uman/3.1/files/uman_3.1_fr.pdf > > Crashes on Scilab 6.1.1 are fixed. > @ mode: New mailing list archives are used. @d will search on dev at lists. > w mode (web): Version 6.1.0 is used for missing online pages v.6.1.1. > The user manual is now available as well in PDF (english, french). > 16 improvements & bugs fixed. > 26 references added. > > Since Scilab 6.1.0, uman can be used in the Advanced console > (supporting extended characters). > > !-!-!-! > If you are installing uman 3.1 while you were already using uman on > your computer, > please delete your SCIHOME/uman directory before the first run of uman > 3.1. > ------ > > Best regards > > 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 arctica1963 at gmail.com Wed Dec 29 09:00:05 2021 From: arctica1963 at gmail.com (Lester Anderson) Date: Wed, 29 Dec 2021 08:00:05 +0000 Subject: [Scilab-users] Bernoulli numbers calculation Message-ID: Hello, A quick query. Have adapted existing Matlab code for Scilan to calculate Bernoulli numbers using an explicit formula (www.bernoulli.org). The code works fine for numbers from 0 to 10, but 11 onwards the values are incorrect: Not the most efficient code but do need to understand where the errors are coming in. clear function Binomial_coefficient=bcoeff(n,k) Binomial_coefficient=factorial(n)/(factorial(k)*factorial(n-k)) endfunction B=[]; for m=0:20 sum2=0; for k=0:m sum1=0; for v=0:k sum1=sum1+ (((-1)^v)*bcoeff(k,v)*(v^m)/(k+1)); end sum2=sum2+sum1; end B(m+1)=sum2; end Output of B(n) for 0 to 20 (left column), right column = expected values; note B(7) and B(9) show rounding issues* 1. -0.5 0.1666667 0. -0.0333333 0. 0.0238095 7.503D-12* 0.0 -0.0333333 2.215D-08* 0.0 0.0757573 0.0000024 0.0 -0.2520505 ?0.253113553 -0.0072098 0.0 1.2467346 +1.166666666 -12.6875 0.0 -827.875 ?7.092156862 12752.25 0.0 -2091400. +54.97117794 2.104D+09 0.0 6.417D+10 ?529.1242424 Also, is it possible to print/write values in a more readable form, e.g.: B(0) = 1 B(1) = -0.5 ...etc B(20) = ?529.1242424 Thanks for any pointers Lester -------------- next part -------------- An HTML attachment was scrubbed... URL: From Christophe.Dang at sidel.com Wed Dec 29 09:35:26 2021 From: Christophe.Dang at sidel.com (Dang Ngoc Chan, Christophe) Date: Wed, 29 Dec 2021 08:35:26 +0000 Subject: [Scilab-users] Bernoulli numbers calculation In-Reply-To: References: Message-ID: Sorry for the spam, I'd better collect all the information before posting ^_^ To be clear: The function binomial() is for the binomial distribution. The binomial coefficient is obtained with nchoosek(). Regards -- Christophe Dang Ngoc Chan Mechanical calculation engineer General 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 Wed Dec 29 09:29:15 2021 From: Christophe.Dang at sidel.com (Dang Ngoc Chan, Christophe) Date: Wed, 29 Dec 2021 08:29:15 +0000 Subject: [Scilab-users] Bernoulli numbers calculation In-Reply-To: References: Message-ID: Hello, Concerning my former message, it seems that binomial() is no longer documented (although it works). There is the function nchoosek() that is documented, with a diagram showing the overflow limit: https://help.scilab.org/docs/6.1.1/en_US/nchoosek.html regards -- Christophe Dang Ngoc Chan Mechanical calculation engineer General 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 Wed Dec 29 09:24:41 2021 From: Christophe.Dang at sidel.com (Dang Ngoc Chan, Christophe) Date: Wed, 29 Dec 2021 08:24:41 +0000 Subject: [Scilab-users] Bernoulli numbers calculation In-Reply-To: References: Message-ID: Hello Lester, > De : Lester Anderson > Envoy? : mercredi 29 d?cembre 2021 09:00 > > Have adapted existing Matlab code for Scilan to calculate Bernoulli > numbers using an explicit formula [...] 11 onwards the values are incorrect: I don't know what you already investigated but did you consider the possibility of overflow or underflow? You may already know these documents but if need be: Micha?l Baudin, /Scilab is not na?ve/, 2010 https://www.scilab.org/sites/default/files/scilabisnotnaive.pdf Micha?l Baudin, /Floating point numbers in Scilab/, 2011 https://www.scilab.org/sites/default/files/floatingpoint-so_v0.4.pdf Concerning the binomial coefficient, you should maybe use binomial(p, k)($) Hope this helps Regards -- Christophe Dang Ngoc Chan Mechanical calculation engineer General 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 Wed Dec 29 21:32:47 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Wed, 29 Dec 2021 21:32:47 +0100 Subject: [Scilab-users] partial fractions In-Reply-To: <286c21c3-10b7-9610-0314-83770c7ecd07@fceia.unr.edu.ar> References: <286c21c3-10b7-9610-0314-83770c7ecd07@fceia.unr.edu.ar> Message-ID: <30cf5d9d-32c1-fc72-d316-8bd34fc0f29e@free.fr> Hello Federico, Le 16/07/2021 ? 21:11, Federico Miyara a ?crit?: > > Dear All, > > I'm wonderig whether there is a standard method to obtain the partial > fraction expansion of a rational function. > > Searching, I've found the function pfss(), which purportedly is meant > for that, but I find it doesn't give a complete solution. For instance: > > // Poles and zeros > p = [-8:-1]; > z = [0 0 0 0]; > > // Numerator and denominator > N = prod(%s - z) > D = prod(%s - p) > > // Rational function > H = N/D > > // Partial fractions > HH = pfss(H) > > The result is > > HH? = > ?????? HH(1) > > ?? -8 -5.7428571s -3.9515873s? +0.2960317s? -0.0946429s? -0.006746s? > -0.0001984s? > ------------------------------------------------------------------------------ > > ????????????? 40320 +69264s +48860s? +18424s? +4025s? +511s? +35s? +s? > > ?????? HH(2) > > ?? 0.0001984 > ?? --------- > ???? 1 +s > > The second component in the list is indeed one of the partial > fractions, but the first one is not an irreductible version. The pfss() rmax option must be used, and set to a big value, for instance 1/%eps. https://help.scilab.org/docs/6.1.0/en_US/pfss.html Then: --> D = list2vec(pfss(H,1/%eps))' ?D? = ?? -0.8126984? 3.3347222? -5.4? 4.3402778? -1.7777778? 0.3375 -0.0222222? 0.0001984 ?? ----------? ---------? ----? ---------? ----------? ------ ----------? --------- ????? 8 +s?????? 7 +s???? 6 +s??? 5 +s??????? 4 +s????? 3 +s????? 2 +s?????? 1 +s --> clean(sum(D)-H) ?ans? = ?? 0 ?? - ?? 1 > Computing HH(1) + HH(2) yields H with good approximation. > > I guess I could proceed iteratively with HH(1), but it would be nice > to have a function performing this automatically. I couldn't find such > a function In addition, partfrac() is available on FileExchange since 2015 @ https://fileexchange.scilab.org/toolboxes/451000 It manages poles multiplicity. With it, your example (with only simple poles) gives the following: --> H = N/D ?H? = s? ------------------------------------------------------------------- ?? 40320 +109584s +118124s? +67284s? +22449s? +4536s? +546s? +36s? +s? --> [I, R, F, T] = partfrac(H); --> I? // integer part of the fraction ?I? = ?? 0. --> R?? // Undecomposed remainder of the fraction ?R? = s? ------------------------------------------------------------------- ?? 40320 +109584s +118124s? +67284s? +22449s? +4536s? +546s? +36s? +s? --> F?? // Decomposition: row #1 = numerators ; row #2 = poles value ; row #3 = poles multiplicity ?F? = ? -0.8126984?? 3.3347222? -5.4?? 4.3402778? -1.7777778?? 0.3375 -0.0222222?? 0.0001984 ? -8.???????? -7.???????? -6.?? -5.???????? -4.???????? -3. -2.???????? -1. ?? 1.????????? 1.????????? 1.??? 1.????????? 1. 1.?????? 1.????????? 1. --> T? // Decomposition output as text ?T? = ? "??? -0.8126984?? 3.3347222?? -5.4?? 4.3402778?? -1.7777778 0.3375?? -0.0222222?? 0.0001984" ? "0 + ---------- + --------- + ---- + --------- + ---------- + ------ + ---------- + ---------" ? "?????? 8+%s??????? 7+%s????? 6+%s???? 5+%s???????? 4+%s 3+%s?????? 2+%s??????? 1+%s?? " --> D = F(1,:)./((%s-F(2,:)).^F(3,:)) ?D? = ?? -0.8126984? 3.3347222? -5.4? 4.3402778 -1.7777778? 0.3375? -0.0222222? 0.0001984 ?? ----------? ---------? ----? ---------? ----------? ------ ----------? --------- ????? 8 +s?????? 7 +s???? 6 +s??? 5 +s??????? 4 +s????? 3 +s????? 2 +s?????? 1 +s -->? clean(R-sum(D)) ?ans? = ?? 0 ?? - ?? 1 Regards Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From sgougeon at free.fr Wed Dec 29 23:45:50 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Wed, 29 Dec 2021 23:45:50 +0100 Subject: [Scilab-users] Bernoulli numbers calculation In-Reply-To: References: Message-ID: Hello Lester, Le 29/12/2021 ? 09:00, Lester Anderson a ?crit?: > Hello, > > A quick query. Have adapted existing Matlab code for Scilan to > calculate Bernoulli numbers using an explicit formula > (www.bernoulli.org ). Not so explicit. Could you please provide the formula, before implementing it in Scilab language? The following is a "vectorized" version of your code, likely with the same mistake: B=[]; for m = 0:20 Sum = 0; for k=0:m v = 0:k; Sum = Sum + sum(((-1).^v).*nchoosek(k,v).*(v.^m)/(k+1)); end B(m+1) = Sum; end A working implementation based on the recurrent formula Bm=?1m+1?k=0m?1(m+1k)Bk could be: mMax = 20; B = zeros(1,mMax); B(1:2) = [1 -1/2]; for m = 2:2:mMax B(1,m+1) = -sum(nchoosek(m+1,0:m-1).*B(1,1:m))/(m+1); end--> B?ans? =???????? column 1 to 13?? 1.? -0.5?? 0.1666667?? 0.? -0.0333333?? 0.?? 0.0238095?? 0.? -0.0333333?? 0.?? 0.0757576?? 0.? -0.2531136 ???????? column 14 to 21 ?? 0.?? 1.1666667?? 0.? -7.0921569?? 0.?? 54.971178?? 0. -529.12424 To fasten the loop, the call to nchoosek() could be replaced with the 3 last rows of Pascal's triangle. Regards Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: From fmiyara at fceia.unr.edu.ar Thu Dec 30 03:01:11 2021 From: fmiyara at fceia.unr.edu.ar (Federico Miyara) Date: Wed, 29 Dec 2021 23:01:11 -0300 Subject: [Scilab-users] partial fractions In-Reply-To: <30cf5d9d-32c1-fc72-d316-8bd34fc0f29e@free.fr> References: <286c21c3-10b7-9610-0314-83770c7ecd07@fceia.unr.edu.ar> <30cf5d9d-32c1-fc72-d316-8bd34fc0f29e@free.fr> Message-ID: <2c895237-8962-5897-3243-df60128f6b72@fceia.unr.edu.ar> Samuel, Thanks for the tip! Any possibility that partfrac() ever become part of Scilab? I think it should actually replace pfss(), since it seems to be exactly what a user expects from a partial fraction function. Regards, Federico Miyara On 29/12/2021 17:32, Samuel Gougeon wrote: > Hello Federico, > > Le 16/07/2021 ? 21:11, Federico Miyara a ?crit?: >> >> Dear All, >> >> I'm wonderig whether there is a standard method to obtain the partial >> fraction expansion of a rational function. >> >> Searching, I've found the function pfss(), which purportedly is meant >> for that, but I find it doesn't give a complete solution. For instance: >> >> // Poles and zeros >> p = [-8:-1]; >> z = [0 0 0 0]; >> >> // Numerator and denominator >> N = prod(%s - z) >> D = prod(%s - p) >> >> // Rational function >> H = N/D >> >> // Partial fractions >> HH = pfss(H) >> >> The result is >> >> HH? = >> ?????? HH(1) >> >> ?? -8 -5.7428571s -3.9515873s? +0.2960317s? -0.0946429s? -0.006746s? >> -0.0001984s? >> ------------------------------------------------------------------------------ >> >> ????????????? 40320 +69264s +48860s? +18424s? +4025s? +511s? +35s? +s? >> >> ?????? HH(2) >> >> ?? 0.0001984 >> ?? --------- >> ???? 1 +s >> >> The second component in the list is indeed one of the partial >> fractions, but the first one is not an irreductible version. > > > The pfss() rmax option must be used, and set to a big value, for > instance 1/%eps. > https://help.scilab.org/docs/6.1.0/en_US/pfss.html > Then: > > --> D = list2vec(pfss(H,1/%eps))' > ?D? = > > ?? -0.8126984? 3.3347222? -5.4? 4.3402778? -1.7777778? 0.3375 > -0.0222222? 0.0001984 > ?? ----------? ---------? ----? ---------? ----------? ------ > ----------? --------- > ????? 8 +s?????? 7 +s???? 6 +s??? 5 +s??????? 4 +s????? 3 +s????? 2 > +s?????? 1 +s > > --> clean(sum(D)-H) > ?ans? = > > ?? 0 > ?? - > ?? 1 > >> Computing HH(1) + HH(2) yields H with good approximation. >> >> I guess I could proceed iteratively with HH(1), but it would be nice >> to have a function performing this automatically. I couldn't find >> such a function > > > In addition, partfrac() is available on FileExchange since 2015 @ > https://fileexchange.scilab.org/toolboxes/451000 > It manages poles multiplicity. With it, your example (with only simple > poles) gives the following: > > --> H = N/D > ?H? = > s? > ------------------------------------------------------------------- > ?? 40320 +109584s +118124s? +67284s? +22449s? +4536s? +546s? +36s? +s? > > --> [I, R, F, T] = partfrac(H); > > --> I? // integer part of the fraction > ?I? = > ?? 0. > > --> R?? // Undecomposed remainder of the fraction > ?R? = > s? > ------------------------------------------------------------------- > ?? 40320 +109584s +118124s? +67284s? +22449s? +4536s? +546s? +36s? +s? > > --> F?? // Decomposition: row #1 = numerators ; row #2 = poles value ; > row #3 = poles multiplicity > ?F? = > > ? -0.8126984?? 3.3347222? -5.4?? 4.3402778? -1.7777778 0.3375? > -0.0222222?? 0.0001984 > ? -8.???????? -7.???????? -6.?? -5.???????? -4. -3.????? -2.???????? -1. > ?? 1.????????? 1.????????? 1.??? 1.????????? 1. 1.?????? 1.????????? 1. > > --> T? // Decomposition output as text > ?T? = > ? "??? -0.8126984?? 3.3347222?? -5.4?? 4.3402778 -1.7777778?? 0.3375?? > -0.0222222?? 0.0001984" > ? "0 + ---------- + --------- + ---- + --------- + ---------- + ------ > + ---------- + ---------" > ? "?????? 8+%s??????? 7+%s????? 6+%s???? 5+%s 4+%s?????? 3+%s?????? > 2+%s??????? 1+%s?? " > > > --> D = F(1,:)./((%s-F(2,:)).^F(3,:)) > ?D? = > > ?? -0.8126984? 3.3347222? -5.4 4.3402778? -1.7777778? 0.3375? > -0.0222222? 0.0001984 > ?? ----------? ---------? ----? ---------? ----------? ------ > ----------? --------- > ????? 8 +s?????? 7 +s???? 6 +s??? 5 +s??????? 4 +s????? 3 +s????? 2 > +s?????? 1 +s > > -->? clean(R-sum(D)) > ?ans? = > > ?? 0 > ?? - > ?? 1 > > Regards > Samuel > > > _______________________________________________ > users mailing list > users at lists.scilab.org > http://lists.scilab.org/mailman/listinfo/users -- El software de antivirus Avast ha analizado este correo electr?nico en busca de virus. https://www.avast.com/antivirus -------------- next part -------------- An HTML attachment was scrubbed... URL: From arctica1963 at gmail.com Thu Dec 30 08:59:33 2021 From: arctica1963 at gmail.com (Lester Anderson) Date: Thu, 30 Dec 2021 07:59:33 +0000 Subject: [Scilab-users] Bernoulli numbers calculation In-Reply-To: References: Message-ID: Hello Samuel, Thanks for the solution. As pointed out it is best to show the equation being assessed (from www.bernoulli.org). The one I looked at was the following: [image: Explicit_formula.PNG] Using nchoosek in the original code gives the same issue. Lester On Wed, 29 Dec 2021 at 22:46, Samuel Gougeon wrote: > Hello Lester, > > > Le 29/12/2021 ? 09:00, Lester Anderson a ?crit : > > Hello, > > A quick query. Have adapted existing Matlab code for Scilan to calculate > Bernoulli numbers using an explicit formula (www.bernoulli.org). > > > Not so explicit. Could you please provide the formula, before implementing > it in Scilab language? > The following is a "vectorized" version of your code, likely with the same > mistake: > > B=[];for m = 0:20 > Sum = 0; > for k=0:m > v = 0:k; > Sum = Sum + sum(((-1).^v).*nchoosek(k,v).*(v.^m)/(k+1)); > end > B(m+1) = Sum;end > > A working implementation based on the recurrent formula Bm=?1m+1?k=0m?1(m+ > 1k)Bk > > could be: > > mMax = 20;B = zeros(1,mMax);B(1:2) = [1 -1/2];for m = 2:2:mMax > B(1,m+1) = -sum(nchoosek(m+1,0:m-1).*B(1,1:m))/(m+1);end > > --> B > ans = > column 1 to 13 > 1. -0.5 0.1666667 0. -0.0333333 0. 0.0238095 0. -0.0333333 0. 0.0757576 0. -0.2531136 > > > column 14 to 21 > 0. 1.1666667 0. -7.0921569 0. 54.971178 0. -529.12424 > > To fasten the loop, the call to nchoosek() could be replaced with the 3 > last rows of Pascal's triangle. > > Regards > Samuel > _______________________________________________ > 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: Explicit_formula.PNG Type: image/png Size: 13849 bytes Desc: not available URL: From sgougeon at free.fr Thu Dec 30 21:17:48 2021 From: sgougeon at free.fr (Samuel Gougeon) Date: Thu, 30 Dec 2021 21:17:48 +0100 Subject: [Scilab-users] Bernoulli numbers calculation In-Reply-To: References: Message-ID: Hello Lester, Le 30/12/2021 ? 08:59, Lester Anderson a ?crit?: > Hello Samuel, > > Thanks for the solution. As pointed out it is best to show the > equation being assessed (from www.bernoulli.org > ). The one I looked at was the following: > > Explicit_formula.PNG > > Using nchoosek in the original code gives the same issue. The inner sum over v is very prone to cumulative rounding errors: The term v^n gets huge rapidly -- so is numerically truncated --, while the (-1)^v term makes the sum alternate, which enhances residues... that then mainly come from numerical truncations. With n_max = 20, the maximum value of nchoosek(20,10)=184756 and is definitely not an issue. While even only 13^13 --> 13^13 ?ans? = ?? 3.029D+14 is already not far from 1/%eps. The recurrent implementation proposed earlier and based on B? =? -?_k=0_? m-1 (C_^k _m+1 ).B_k /(m+1) \frac{-1}{m+1}{\sum _{{k=0}}^{{m-1}}{m+1 \choose k}B_k has neither alternate terms nor huge power values that make a direct computation numerically catastrophic. Regards Samuel -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: Explicit_formula.PNG Type: image/png Size: 13849 bytes Desc: not available URL: