Custom Functions plugin - functions: extended Max and Min, Unit of Measurement, Order of Magnitude - Сообщения
- requirements: SMath Studio 0.97.5737 or later (previous versions may have different features);
- installation: SMath Studio: Tools > Plugins... > Online Gallery;
- documentation: Файл не найден. Файл не найден.;
- sources: SVN repository.
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 ?
Wrotethanks! please consider adding you usolve fuction to deal with units,
You're welcome

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

WroteI 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. :-p
EDIT: sources added in 1st post attachments.
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
WroteHi,
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

P.S. same issue will be fixed on the next relase of NonLinearSolvers.dll (Homotopy solvers)
best regards,
w3b5urf3r
Wrote
Fixed, thank you![]()
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
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
MinMax.sm (11 КиБ) скачан 176 раз(а).
WroteHi,
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 b)
regards,
w3b5urf3r
Wrote
bug fixed and plugin updated b)
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.
customFunctions.sm (22 КиБ) скачан 147 раз(а).
WroteWrote
bug fixed and plugin updated b)
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

fixed & updated, thank you again

best regards,
w3b5urf3r
- 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
Added new function Clear(...)
Many thank to [userlink]Rising Eagle[/userlink] for the great trick

best regards,
w3b5urf3r
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.
AS 7-7solve.sm (100 КиБ) скачан 147 раз(а).
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
[MATH=eng]x:line(x,1,1)[/MATH]
it will clear the x and the following roots() using x will be Ok, but line(x) will produce this
[math=eng]x:line(x,#,2,1)[/math]
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
[MATH=eng]x:line(x,x,2,1)[/MATH]
as could be expected
Regards,
Radovan
- 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
Wrote[...] it will clear the x and the following roots() using x will be Ok, but line(x) will produce this
[math=eng]x:line(x,#,2,1)[/math]
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
[MATH=eng]x:line(x,x,2,1)[/MATH]
Thank you very much Radovan

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
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
WroteHello 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 :-p (see the attachment)
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
WroteHi 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...
-
Новые сообщения
-
Нет новых сообщений