Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

6 Pages123>»
Options
Go to last post Go to first unread
Offline Davide Carpi  
#1 Posted : 31 August 2012 16:06:51(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
Collection of multipurpose functions for SMath Studio.

2016-03-04 00_31_53-SMath Studio Desktop - [CustomFunctions_examples.sm].png



>>> PLEASE REPORT IN THIS THREAD ANY ISSUE, MORE DETAILED AS POSSIBLE <<<

Edited by user 04 March 2016 02:30:04(UTC)  | Reason: plugin updated

If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
thanks 4 users thanked Davide Carpi for this useful post.
on 31/08/2012(UTC),  on 01/03/2014(UTC),  on 17/01/2016(UTC),  on 23/04/2016(UTC)
Offline kilele  
#2 Posted : 01 September 2012 18:12:44(UTC)
kilele


Rank: Advanced Member

Groups: Registered
Joined: 30/03/2011(UTC)
Posts: 392

Was thanked: 132 time(s) in 113 post(s)
thanks! please consider adding you usolve fuction to deal with units,
I would also like to get my hands dirty with .NET to create some plugins but for some reason I don't know where I should start,
could you recommend some tutorials/tips to deal with Smath in this respect of creating plugins ?
Offline TheWizEd  
#3 Posted : 01 September 2012 18:55:08(UTC)
TheWizEd


Rank: Advanced Member

Groups: Registered
Joined: 04/07/2010(UTC)
Posts: 178
Man
United States

Was thanked: 19 time(s) in 13 post(s)
If you've done any programming, its relatively easy to develop custom functions for SMath. I've used Microsoft Visual Basic 2000 Express, which is free from the Microsoft web site. There is also an excellent example at the SMath wiki under Developers Guide. Its a little outdated and procedure calls have changed but when you compile and it complains about the calling sequence you can view the Object Browser and the SMath dlls and figure out the changes pretty easily. Good luck.
Ed
Offline Davide Carpi  
#4 Posted : 05 September 2012 16:21:12(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
Originally Posted by: kilele Go to Quoted Post
thanks! please consider adding you usolve fuction to deal with units,

You're welcome Good

I thought about it, when I have some free time I will try to see if I can set the problem in an intelligent way... for example I have not yet figured out if you can recover somehow the units placed by the user on the right of equality Huh ...

Originally Posted by: kilele Go to Quoted Post
I would also like to get my hands dirty with .NET to create some plugins but for some reason I don't know where I should start,
could you recommend some tutorials/tips to deal with Smath in this respect of creating plugins ?


like TheWizEd sais, it's relatively easy If you've done any programming experience previously...

However, I think you should follow these steps:

1) Chooose what programming language you want to use. In my background I have a little bit of C and PHP, so i preferred the Visual C# (C Sharp), but many other prefers the Visual Basic, and in the Visual SVN server there is also something in FORTRAN... so look in the web the differences and choose your...

2) Choose an IDE (integrated development environment)... here (IDEs and programming languages to use for developing plugins) there is a list of programming languages and IDEs (actually I'm using the SharpDevelop IDE).

3) Look in the wiki all the pages of the Developer Guide

4) Look in the SVN server all the plugings to try to understand how they are structured.

considers that the IDE usually have a converter to change the code from one language to another, so the examples on servers in other programming languages ​​can be analyzed. To analyze plugins in other languages (f.e. russian) copy and paste all the source code in the google translate window (from: russian to:english); some variable names are acronyms and cannot be translate dirctly, but if you separe the words where you see an uppercase letters almost certainly can be correctly transalte.


regards,

w3b5urf3r


P.S. I'll try to post the source of the plugins with more comments as possible, but consider that I am a noob so there may be something I have done that could have been done much more simply. Tongue

EDIT: sources added in 1st post attachments.

Edited by user 25 September 2012 20:04:23(UTC)  | Reason: Not specified

If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline mkraska  
#5 Posted : 03 October 2012 16:18:31(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,514
Germany

Was thanked: 805 time(s) in 515 post(s)
Hi,

When trying the plugin I had some problems with the functions OoM.10 and eOoM.10. They are related to non-standard settings of decimal delimiter (Komma) and argument delimiter (Semicolon), see image. With standard settings (decimal delimiter dot and argument delimiter komma) no problem.

When choosing the functions from the menu or from the dynamic assistant, they appeare verbatim (i.e. with visible dot and without subscript formatting) but work correctly. If the expression is keyed in or created or copy-pasted, then formatting is done but the function is not known to SMath any more.

Also, if the sheet with the correctly working but incorrectly displayed function is saved and than re-opened, then the display is correct and the function is unknown.

May be the plugin is not to be blamed for this, than this would be a bug in SMath, but I can't tell.

Best regards, Martin Kraska

Edited by user 03 October 2012 16:35:51(UTC)  | Reason: Not specified

File Attachment(s):
customFunctions.sm (24kb) downloaded 93 time(s).
mkraska attached the following image(s):
german1.PNG
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
thanks 1 user thanked mkraska for this useful post.
on 03/10/2012(UTC)
Offline Davide Carpi  
#6 Posted : 03 October 2012 18:13:13(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
Originally Posted by: mkraska Go to Quoted Post
Hi,

When trying the plugin I had some problems with the functions OoM.10 and eOoM.10. They are related to non-standard settings of decimal delimiter (Komma) and argument delimiter (Semicolon), see image. With standard settings (decimal delimiter dot and argument delimiter komma) no problem.

When choosing the functions from the menu or from the dynamic assistant, they appeare verbatim (i.e. with visible dot and without subscript formatting) but work correctly. If the expression is keyed in or created or copy-pasted, then formatting is done but the function is not known to SMath any more.

Also, if the sheet with the correctly working but incorrectly displayed function is saved and than re-opened, then the display is correct and the function is unknown.

May be the plugin is not to be blamed for this, than this would be a bug in SMath, but I can't tell.

Best regards, Martin Kraska


Fixed, thank you Good


P.S. same issue will be fixed on the next relase of NonLinearSolvers.dll (Homotopy solvers)


best regards,

w3b5urf3r
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline mkraska  
#7 Posted : 03 October 2012 18:57:07(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,514
Germany

Was thanked: 805 time(s) in 515 post(s)
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post


Fixed, thank you Good


P.S. same issue will be fixed on the next relase of NonLinearSolvers.dll (Homotopy solvers)




Thank you! Works perfectly. (Thanks button throws error message)

Best regards, Martin Kraska
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline mkraska  
#8 Posted : 14 October 2012 18:06:08(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,514
Germany

Was thanked: 805 time(s) in 515 post(s)
Hi,

I have some problems using the Min and Max functions from the customFunctions plugin. It is NOT a custom delim settings issue.

Best regards, Martin
File Attachment(s):
MinMax.sm (12kb) downloaded 86 time(s).
mkraska attached the following image(s):
minmax.PNG
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline Davide Carpi  
#9 Posted : 15 October 2012 20:59:56(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
Originally Posted by: mkraska Go to Quoted Post
Hi,

I have some problems using the Min and Max functions from the customFunctions plugin. It is NOT a custom delim settings issue.

Best regards, Martin


Thank you,

bug fixed and plugin updated Cool


regards,

w3b5urf3r

Davide Carpi attached the following image(s):
SMath Studio - [MinMax.sm].png
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline mkraska  
#10 Posted : 15 October 2012 23:34:22(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,514
Germany

Was thanked: 805 time(s) in 515 post(s)
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post

bug fixed and plugin updated Cool


Thank you for fixing the bug, Min/Max work fine now. However, there is a strange OS message when running your example file. It says something like "object reference not pointing to an object instance" or whatever might be the correct translation. It is not an smath message as it is in german even if I switch Interface language.

Also, this is not delimiter related.

Best regards, Martin.

File Attachment(s):
customFunctions.sm (23kb) downloaded 70 time(s).
mkraska attached the following image(s):
objekt.PNG
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline Davide Carpi  
#11 Posted : 15 October 2012 23:56:53(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
Originally Posted by: mkraska Go to Quoted Post
Originally Posted by: w3b5urf3r_reloaded Go to Quoted Post

bug fixed and plugin updated Cool


Thank you for fixing the bug, Min/Max work fine now. However, there is a strange OS message when running your example file. It says something like "object reference not pointing to an object instance" or whatever might be the correct translation. It is not an smath message as it is in german even if I switch Interface language.

Also, this is not delimiter related.

Best regards, Martin.



ooops Blush

fixed & updated, thank you again Thank you


best regards,

w3b5urf3r
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline Davide Carpi  
#12 Posted : 01 November 2012 17:08:29(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
PLUGIN UPDATED

- Added Zeros(...)
- Added Ones(...)
- Added mat2sys(...) and sys2mat(...)
- Added Diag(...) - this function, previously shown in a NonlinearSolvers.dll BETA, has been moved in that plugin.


regards,

w3b5urf3r

Edited by user 01 November 2012 21:33:32(UTC)  | Reason: Not specified

If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
thanks 1 user thanked Davide Carpi for this useful post.
on 02/11/2012(UTC)
Offline Davide Carpi  
#13 Posted : 14 December 2012 17:19:50(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
PLUGIN UPDATED

Added new function Clear(...)

Many thank to Rising Eagle Offline for the great trick Clap


best regards,

w3b5urf3r
Davide Carpi attached the following image(s):
SMath Studio - [customFunctions.sm].png
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline mkraska  
#14 Posted : 31 January 2013 02:52:04(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,514
Germany

Was thanked: 805 time(s) in 515 post(s)
Hello,

I came across a situation where using a Clear()ed variable is not equivalent to a virgin one. The attached example has two equations, where I introduce a dummy variable in order to solve for the numerical value of a physical quantity (because neither solve nor roots can solve for variables with units).

The approach allows to keep the equation readable and the unit used in the quantity split is arbitrary.

Instead of using a new dummy variable (x,y...) for the numeric value in successive solve operations I tried to always use just one variable. This fails by whatever reason.

The odd thing is that Clear(x) does not help... Thus we do not really have a Clear() function, or did I miss some detail?

Eventually I want to do some experiments with the NonlinearSolvers plugin.



File Attachment(s):
AS 7-7solve.sm (101kb) downloaded 68 time(s).
mkraska attached the following image(s):
AS 7-7solve.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline omorr  
#15 Posted : 31 January 2013 11:03:05(UTC)
omorr


Rank: Administration

Groups: Registered, Administrators, Advanced Member
Joined: 23/06/2009(UTC)
Posts: 1,731
Man
Serbia

Was thanked: 311 time(s) in 265 post(s)
Hello Martin,

It seems that Clear() is not doing the job correctly. If I am not wrong Clear(x) equals to line(x), and I suppose it is missing something. If you use the line like Rising Eagle proposed


x:line(x,1,1)

it will clear the x and the following roots() using x will be Ok, but line(x) will produce this

x:line(x,#,2,1)

I do not know how w3b5urf3r escaped from this additional placeholder. If you just use Clear(x) it reported that everything is Ok (result 1) but by using roots() afterwards line-function not defined error appeared. If you use line(x) then there is an empty placeholder and the error would be Fill in all empty ellements. which is logical. Therefore, I suppose that Clear() function needs to be revised. Then, this will also do the job

x:line(x,x,2,1)

as could be expected

Regards,
Radovan

Edited by user 31 January 2013 11:10:46(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
thanks 1 user thanked omorr for this useful post.
on 31/01/2013(UTC)
Offline Davide Carpi  
#16 Posted : 31 January 2013 13:00:07(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
PLUGIN UPDATED

- Added SettingsDirectory(): show the path of SMath settings directory (e.g. useful to easily get the output path of built-in function wfile())

- Fixed issue in Clear() shown by Martin and solved by Radovan

Originally Posted by: omorr Go to Quoted Post
[...] it will clear the x and the following roots() using x will be Ok, but line(x) will produce this

x:line(x,#,2,1)

I do not know how w3b5urf3r escaped from this additional placeholder. If you just use Clear(x) it reported that everything is Ok (result 1) but by using roots() afterwards line-function not defined error appeared. If you use line(x) then there is an empty placeholder and the error would be Fill in all empty ellements. which is logical. Therefore, I suppose that Clear() function needs to be revised. Then, this will also do the job

x:line(x,x,2,1)


Thank you very much Radovan Thank you

For future reference of SMath plugin developers, the previous Clear() function was based on an hack that is possible working with low-level evaluation: x=line(x) (that is not x=line(x,1,1)).


best regards,

w3b5urf3r

Edited by user 31 January 2013 13:04:02(UTC)  | Reason: Not specified

If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
thanks 3 users thanked Davide Carpi for this useful post.
on 31/01/2013(UTC),  on 31/01/2013(UTC),  on 01/02/2013(UTC)
Offline mkraska  
#17 Posted : 01 February 2013 02:02:53(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,514
Germany

Was thanked: 805 time(s) in 515 post(s)
Hello w3bsurf3r,

thanks for the fix! Now that Clear() does the job I see that I have to freeze (using eval) results prior to re-definition of x. Thus the approach with re-using x is a rather cumbersome workaround for roots() not being able to solve for quantities with units.

Martin
File Attachment(s):
AS 7-7solveClearx.sm (95kb) downloaded 69 time(s).
mkraska attached the following image(s):
AS 7-7solveClearx.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline Davide Carpi  
#18 Posted : 01 February 2013 04:39:57(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
Originally Posted by: mkraska Go to Quoted Post
Hello w3bsurf3r,

thanks for the fix! Now that Clear() does the job I see that I have to freeze (using eval) results prior to re-definition of x. Thus the approach with re-using x is a rather cumbersome workaround for roots() not being able to solve for quantities with units.

Martin


Indeed here I can see one of the (rare) situations where the use of the eval() function is clearly required Tongue (see the attachment)
File Attachment(s):
variables and parametrics.sm (12kb) downloaded 68 time(s).
Davide Carpi attached the following image(s):
SMath Studio - [variables and parametrics.sm]_3.png
SMath Studio - [variables and parametrics.sm]_4.png
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Offline mkraska  
#19 Posted : 10 February 2013 19:21:36(UTC)
mkraska


Rank: Advanced Member

Groups: Registered
Joined: 15/04/2012(UTC)
Posts: 1,514
Germany

Was thanked: 805 time(s) in 515 post(s)
Hi w3bsurf3r,

I am surprised by the behaviour of sys2mat, see the attached example. Is this a bug or a feature? For the latter I see no good reasons (ok, i might be blind).

Could the function sys2mat possibly be redesigned such that it does not require eval() in order to produce sensible results?

Martin

File Attachment(s):
sysmath.sm (10kb) downloaded 68 time(s).
mkraska attached the following image(s):
sysmath.png
Martin Kraska

Pre-configured portable distribution of SMath Studio: https://en.smath.info/wi...th%20with%20Plugins.ashx
Offline Davide Carpi  
#20 Posted : 10 February 2013 19:33:19(UTC)
Davide Carpi


Rank: Advanced Member

Groups: Registered, Advanced Member
Joined: 13/01/2012(UTC)
Posts: 2,213
Man
Italy
Location: Italy

Was thanked: 1120 time(s) in 731 post(s)
Originally Posted by: mkraska Go to Quoted Post
Hi w3bsurf3r,

I am surprised by the behaviour of sys2mat, see the attached example. Is this a bug or a feature? For the latter I see no good reasons (ok, i might be blind).

Could the function sys2mat possibly be redesigned such that it does not require eval() in order to produce sensible results?

Martin



mhhh... probably it's a bug; indeed the sys2mat() function it's quite simple, I'll try to think something a little bit more sophisticated...
If you like my plugins please consider a donation to SMath Studio; for personal contributions to me: paypal.me/dcprojects
Users browsing this topic
Similar Topics
[Custom Functions plugin] cases SS6179 (Bugs & Problems)
by PompelmoTell 07/02/2017 19:14:23(UTC)
6 Pages123>»
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.