1 страниц (20 вхождений)
Queston on programming a plugin - Сообщения
#1 Опубликовано: 18.03.2011 10:45:54
I started getting ambitious and was programming the financial functions in a plugin when I got stumped. How do you program the equation below? The problem is the j value is an index within the sum that identifies which element of the matrix to process at each step. Its a variable of the sum function. The plugin example shown in the wiki uses constants. By that I mean the values are all set and constant when the function is called. For the sum function the j index of the pmt# matrix has to vary.
You can get an idea of how the plugin should be programmed by looking at the SMath sm file using a text editor. But in the sm file j has been typed, is visible on the screen and is in the "Store". For the sum function to work properly in a plugin a new variable has to be created in the plugin program and placed in Store and fed to the sum function. Haven't been able to figure that out.

Any suggestions?
You can get an idea of how the plugin should be programmed by looking at the SMath sm file using a text editor. But in the sm file j has been typed, is visible on the screen and is in the "Store". For the sum function to work properly in a plugin a new variable has to be created in the plugin program and placed in Store and fed to the sum function. Haven't been able to figure that out.

Any suggestions?
Ed
#2 Опубликовано: 18.03.2011 15:28:54
[MATH][/MATH]Using the same Cf as your example, I added a third arguement to fvc. So I have fvc(rate,pmt,n)
Not sure how you displayed your function !
I used fcv(rate, pmt,n):= SUM (from j=1 to n)pmt(sub j)* (1+rate)^(n-j+1)
My result from fvc(0.05,cf,n) was 13,814.98 agrees with an Excel worksheet I used for the same calculation
If there was a function to count size of a vector we could dispense with n
best wishes
fvc(rate,pmt,n)←sum((el(pmt,j)*((1+rate)^{n-j+1})),j,1,n)
How to get this to look like Smath?
Not sure how you displayed your function !
I used fcv(rate, pmt,n):= SUM (from j=1 to n)pmt(sub j)* (1+rate)^(n-j+1)
My result from fvc(0.05,cf,n) was 13,814.98 agrees with an Excel worksheet I used for the same calculation
If there was a function to count size of a vector we could dispense with n
best wishes
fvc(rate,pmt,n)←sum((el(pmt,j)*((1+rate)^{n-j+1})),j,1,n)
How to get this to look like Smath?
#3 Опубликовано: 18.03.2011 16:24:32
Hello,
Paste a math region from SMath inside Math tags from BBcode Tags [ MATH ] [ /MATH ]. If you use point as decimal separator and comma as function argumets separator then just add "=eng" like "[ MATH=eng ]"
[MATH=eng]fvc(rate,pmt,n)←sum((el(pmt,j)*((1+rate)^{n-j+1})),j,1,n)[/MATH]
Regards,
Radovan
Paste a math region from SMath inside Math tags from BBcode Tags [ MATH ] [ /MATH ]. If you use point as decimal separator and comma as function argumets separator then just add "=eng" like "[ MATH=eng ]"
WroteHow to get this to look like Smath?
[MATH=eng]fvc(rate,pmt,n)←sum((el(pmt,j)*((1+rate)^{n-j+1})),j,1,n)[/MATH]
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#4 Опубликовано: 18.03.2011 16:59:08
bliengme,
I'm using Windows so I'll describe how I do it. For Linux and others don't know.
First I Print Screen to capture the SMath image to the clip board.
Then in Paint I cut out the portion I want to display on this forum and save it to a png file.
Next I upload to the wiki. Click on the Wiki button on the SMath forum. I select File Management and then forum_attach. I created a directory for myself. You can create your own or just plop them into forum_attach. At the top of this page is a browse and upload button to pick a file from your computer and load it to the wiki.
Now when I'm composing a topic or reply I include the following in the body of my text. Type exactly as shown with the img, /img and %2f. I save this in a text file and simply cut and paste everytime I post a new picture. It easy once you get used to it.
There's a tutorial "Adding images to an article" on the main wiki page. Good luck.
Radovan's method works for one equation at a time.
I'm using Windows so I'll describe how I do it. For Linux and others don't know.
First I Print Screen to capture the SMath image to the clip board.
Then in Paint I cut out the portion I want to display on this forum and save it to a png file.
Next I upload to the wiki. Click on the Wiki button on the SMath forum. I select File Management and then forum_attach. I created a directory for myself. You can create your own or just plop them into forum_attach. At the top of this page is a browse and upload button to pick a file from your computer and load it to the wiki.
Now when I'm composing a topic or reply I include the following in the body of my text. Type exactly as shown with the img, /img and %2f. I save this in a text file and simply cut and paste everytime I post a new picture. It easy once you get used to it.
[img]https://smath.com/wiki/GetFile.aspx?File=forum_attach%2fTheWizEd%2fsome_file_name.png[/img]
There's a tutorial "Adding images to an article" on the main wiki page. Good luck.
Radovan's method works for one equation at a time.
Ed
#5 Опубликовано: 19.03.2011 08:20:27
Well it might not be the most efficient but I figured out a solution. This example is different than the wiki code example in that the mathematics is done in code. The wiki example is done by stacking operations and passing back to SMath to do the math.
I had to pick apart the args passed to the VB code and what I discovered is that a number is not just a floating point number but a series of Terms. For example 1.1 is stored as 11,10,/. To get around this, cause I wouldn't know how many Terms a number may be composed of, was to use SMath Calculate function to pull the element out of the matrix. I create a small Term stack that requests the iRow-th element of the matrix and convert to floating point. Then do all the math in VB and return the results. Not sure if this is fool proof but it worked for test cases I performed.
This technique will only work if there is only one value for each input and there are not units.
I had to pick apart the args passed to the VB code and what I discovered is that a number is not just a floating point number but a series of Terms. For example 1.1 is stored as 11,10,/. To get around this, cause I wouldn't know how many Terms a number may be composed of, was to use SMath Calculate function to pull the element out of the matrix. I create a small Term stack that requests the iRow-th element of the matrix and convert to floating point. Then do all the math in VB and return the results. Not sure if this is fool proof but it worked for test cases I performed.
ElseIf root.Type = TermType.Function And root.Text = "fvc" And root.ChildCount = 2 Then
Dim i As Integer
Dim iRows As Integer
Dim dRate As Double
Dim dPmt As Double
Dim dResult As Double
Dim arg1 As Term() = Decision.Preprocessing(args(0), store)
Dim arg2 As Term() = Decision.Preprocessing(args(1), store)
dRate = SMath.Math.Numeric.Expression.Calculate(arg1, store).obj.ToDouble
answer.Add(arg2(arg2.GetUpperBound(0) - 2)) ' Get number of rows
iRows = SMath.Math.Numeric.Expression.Calculate(answer.ToArray, store).obj.ToDouble
For i = 1 To iRows
answer.Clear()
answer.AddRange(arg2)
answer.AddRange(Converter.ToTerms(i))
answer.Add(New Term("el", TermType.Function, 2))
dPmt = SMath.Math.Numeric.Expression.Calculate(answer.ToArray, store).obj.ToDouble
dResult = dResult + (dPmt * (1 + dRate) ^ (iRows - i))
Next
answer.Clear()
answer.AddRange(Converter.ToTerms(dResult))
result = answer.ToArray()
Return True
This technique will only work if there is only one value for each input and there are not units.
Ed
#6 Опубликовано: 20.03.2011 13:30:35
I've discovered a pecular side effect of using multiple value for variables. This effects both user functions and plugins.
The first example is the "combin" plugin example from the wiki, the second is a user function "combinf".
As shown below "a" has 2 values 5 and 6. You would expect 2 results, one for 5 and another for 6. But because "a" occurs twice in the equation you get 4 values. In the plugin "a" is pushed onto the stack twice so the equation is calculated twice for each occurance of "a".

The first example is the "combin" plugin example from the wiki, the second is a user function "combinf".
As shown below "a" has 2 values 5 and 6. You would expect 2 results, one for 5 and another for 6. But because "a" occurs twice in the equation you get 4 values. In the plugin "a" is pushed onto the stack twice so the equation is calculated twice for each occurance of "a".

Ed
#7 Опубликовано: 22.03.2011 06:39:40
Hello Ed,
I hope this would not be off the topic - I do not do programming and not able to make plugins.
The "Multiple value" operator makes me confused sometimes. I can not figure out what could be all of its uses and properties.
I thing that the two things are the main purpose of its using:
1 - Making multiple graphs
2 - using plus/minus, minus plus operators
[MATH=eng]7±8=sys(15,-1,2,1)[/MATH] [MATH=eng]7±8±3=sys(18,2,12,-4,4,1)[/MATH]
On the other hand, its elements are vector elements.
[MATH=eng]a←sys(4,6,9,3,1)[/MATH]
[MATH=eng]el(a,1)=4[/MATH] [MATH=eng]el(a,2)=6[/MATH][MATH=eng]el(a,3)=9[/MATH]
We can, say, add or multiply "Multiple value" elements
[MATH=eng]a+a=sys(8,10,13,12,15,18,6,1)[/MATH][MATH=eng]a*a=sys(16,24,36,54,81,5,1)[/MATH]
It seems that the operator will be performed on all the elements but the result will consist of only unique elements - the same elements will not be repeated (this is valid for the numerical result, not for the symbolical).
If you add some new vector elements:
[MATH=eng]el(a,6)←90[/MATH][MATH=eng]el(a,8)←19[/MATH]
The result might be confusing because there is the difference between numeric and symbolic result
[MATH=eng]a=sys(4,6,9,0,90,19,6,1)[/MATH][MATH=eng]a—sys(4,6,9,0,0,90,0,19,8,1)[/MATH]
Again, it seems that numerical result will not consist of repeated values in spite of the symbolic one. We can check this by:
[MATH=eng]el(a,8)=19[/MATH]
Moreover, if we assign the result to a variable - more surprises:
[MATH=eng]A←a+a[/MATH][MATH=eng]B←a*a[/MATH]
[MATH=eng]A=sys(8,12,18,3,1)[/MATH][MATH=eng]B=sys(16,36,81,3,1)[/MATH]
I guess this is due to the SMath symbolic behavior and processing of expression
[MATH=eng]a+a—2*sys(4,6,9,3,1)[/MATH][MATH=eng]a*a—sys(4,6,9,3,1)^2[/MATH]
We can also mix it with a vectors or matrix as well
[MATH=eng]c←mat(22,25,33,3,1)[/MATH]
[MATH=eng]a+c=sys(mat(26,29,37,3,1),mat(28,31,39,3,1),mat(31,34,42,3,1),mat(22,25,33,3,1),mat(112,115,123,3,1),mat(41,44,52,3,1),6,1)[/MATH][MATH=eng]a+c—mat(sys(4,6,9,0,0,90,0,19,8,1)+22,sys(4,6,9,0,0,90,0,19,8,1)+25,sys(4,6,9,0,0,90,0,19,8,1)+33,3,1)[/MATH]
Actually, the use of "Multiple values" still remained blurred to me.
Regards,
Radovan
I hope this would not be off the topic - I do not do programming and not able to make plugins.
The "Multiple value" operator makes me confused sometimes. I can not figure out what could be all of its uses and properties.
I thing that the two things are the main purpose of its using:
1 - Making multiple graphs
2 - using plus/minus, minus plus operators
[MATH=eng]7±8=sys(15,-1,2,1)[/MATH] [MATH=eng]7±8±3=sys(18,2,12,-4,4,1)[/MATH]
On the other hand, its elements are vector elements.
[MATH=eng]a←sys(4,6,9,3,1)[/MATH]
[MATH=eng]el(a,1)=4[/MATH] [MATH=eng]el(a,2)=6[/MATH][MATH=eng]el(a,3)=9[/MATH]
We can, say, add or multiply "Multiple value" elements
[MATH=eng]a+a=sys(8,10,13,12,15,18,6,1)[/MATH][MATH=eng]a*a=sys(16,24,36,54,81,5,1)[/MATH]
It seems that the operator will be performed on all the elements but the result will consist of only unique elements - the same elements will not be repeated (this is valid for the numerical result, not for the symbolical).
If you add some new vector elements:
[MATH=eng]el(a,6)←90[/MATH][MATH=eng]el(a,8)←19[/MATH]
The result might be confusing because there is the difference between numeric and symbolic result
[MATH=eng]a=sys(4,6,9,0,90,19,6,1)[/MATH][MATH=eng]a—sys(4,6,9,0,0,90,0,19,8,1)[/MATH]
Again, it seems that numerical result will not consist of repeated values in spite of the symbolic one. We can check this by:
[MATH=eng]el(a,8)=19[/MATH]
Moreover, if we assign the result to a variable - more surprises:
[MATH=eng]A←a+a[/MATH][MATH=eng]B←a*a[/MATH]
[MATH=eng]A=sys(8,12,18,3,1)[/MATH][MATH=eng]B=sys(16,36,81,3,1)[/MATH]
I guess this is due to the SMath symbolic behavior and processing of expression
[MATH=eng]a+a—2*sys(4,6,9,3,1)[/MATH][MATH=eng]a*a—sys(4,6,9,3,1)^2[/MATH]
We can also mix it with a vectors or matrix as well
[MATH=eng]c←mat(22,25,33,3,1)[/MATH]
[MATH=eng]a+c=sys(mat(26,29,37,3,1),mat(28,31,39,3,1),mat(31,34,42,3,1),mat(22,25,33,3,1),mat(112,115,123,3,1),mat(41,44,52,3,1),6,1)[/MATH][MATH=eng]a+c—mat(sys(4,6,9,0,0,90,0,19,8,1)+22,sys(4,6,9,0,0,90,0,19,8,1)+25,sys(4,6,9,0,0,90,0,19,8,1)+33,3,1)[/MATH]
Actually, the use of "Multiple values" still remained blurred to me.
Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
#8 Опубликовано: 22.03.2011 22:23:13
Radovan,
I agree with you, "multiple value" is not something I normally deal with, but since SMath has that feature, I figured developing a function or plug has to plan for that possibility. It like a "what if" scenario. What if a is 5? What if a is 6? You simply build a variable with multiple values and solve both. For example the combin function should result in the results below but what happens is there are four solutions
combin(5,3)=10
combin(6,3)=20
[MATH]a←sys(5,6,2,1)[/MATH]
combin(a,3) Gives you
5!/(3!*(5-3)!) = 10
6'/(3!*(6-3)!) = 20
5!/(3!*(6-3)!) = 3.333
6!/(3!*(5-3)!) = 60
It should have been if a = 5 or a = 6.
I agree with you, "multiple value" is not something I normally deal with, but since SMath has that feature, I figured developing a function or plug has to plan for that possibility. It like a "what if" scenario. What if a is 5? What if a is 6? You simply build a variable with multiple values and solve both. For example the combin function should result in the results below but what happens is there are four solutions
combin(5,3)=10
combin(6,3)=20
[MATH]a←sys(5,6,2,1)[/MATH]
combin(a,3) Gives you
5!/(3!*(5-3)!) = 10
6'/(3!*(6-3)!) = 20
5!/(3!*(6-3)!) = 3.333
6!/(3!*(5-3)!) = 60
It should have been if a = 5 or a = 6.
Ed
#9 Опубликовано: 06.04.2011 12:27:33
Ed,
I really want to continue learning myself about plugin development for Smath.
It would be great if you could edit existing pages and/or add new pages on the wiki under "Developer Guide" as you learn more about plugin development. Documentation on the Smath API is very sparse. I would like to see alot more on the wiki in this regard.
Would you be willing to post a link to your entire source code for the benefit of those who want to learn more about writing plugins? (A link to the source code could also be added to the wiki.)
I was the one would wrote the VB tutorial (and related video) on the wiki (using Andrey's C# example). I believe that the API has undergone some changes since that was written. I can post the Word document that was used to create the PDF tutorial if you would like to make any updates to it. Otherwise, I will try to update it as I pick up my learning process where I left off.
I really want to continue learning myself about plugin development for Smath.
It would be great if you could edit existing pages and/or add new pages on the wiki under "Developer Guide" as you learn more about plugin development. Documentation on the Smath API is very sparse. I would like to see alot more on the wiki in this regard.
Would you be willing to post a link to your entire source code for the benefit of those who want to learn more about writing plugins? (A link to the source code could also be added to the wiki.)
I was the one would wrote the VB tutorial (and related video) on the wiki (using Andrey's C# example). I believe that the API has undergone some changes since that was written. I can post the Word document that was used to create the PDF tutorial if you would like to make any updates to it. Otherwise, I will try to update it as I pick up my learning process where I left off.
Will Massie
Mechanical Engineer
Oregon, USA
#10 Опубликовано: 06.04.2011 17:32:59
Will,
There are differences in programming between SMath 0.89 and 0.89 Beta. I've been toying with VB Express in developing plugin and found that the calling sequence of SMath functions in the core DLL libraries are different between the Stable and Beta version.
I was waiting until Andrey had completed his latest version before publishing my plugins. Maybe some of them become obsolete. Others will have to be reprogrammed.
There are differences in programming between SMath 0.89 and 0.89 Beta. I've been toying with VB Express in developing plugin and found that the calling sequence of SMath functions in the core DLL libraries are different between the Stable and Beta version.
I was waiting until Andrey had completed his latest version before publishing my plugins. Maybe some of them become obsolete. Others will have to be reprogrammed.
Ed
#11 Опубликовано: 19.04.2011 09:09:09
Hi,
Im trying to follow the plugin tutorial with Visual Studio 2010, and found some errors:
Error 11 Value of type 'Boolean' cannot be converted to 'SMath.Manager.ArgumentInfo'. d:\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1\Class1.vb 18 144 ClassLibrary1
Error 12 Omitted argument cannot match a ParamArray parameter. d:\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1\Class1.vb 18 148 ClassLibrary1
Related to the line New TermInfo("dg", TermType.Function, 2, "(num, dig) - Devuelve num con dig dígitos significativos", FunctionSections.Unknown, True)
AND
Error 10 'Store' is a type and cannot be used as an expression. d:\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1\Class1.vb 64 66 ClassLibrary1
Related to the line Dim arg2 As Term() = Decision.Preprocessing(args(1), Store)
Can anyone help me? I need to create functions to emulate simple and double precision for educational purposes. Thanks
Im trying to follow the plugin tutorial with Visual Studio 2010, and found some errors:
Error 11 Value of type 'Boolean' cannot be converted to 'SMath.Manager.ArgumentInfo'. d:\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1\Class1.vb 18 144 ClassLibrary1
Error 12 Omitted argument cannot match a ParamArray parameter. d:\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1\Class1.vb 18 148 ClassLibrary1
Related to the line New TermInfo("dg", TermType.Function, 2, "(num, dig) - Devuelve num con dig dígitos significativos", FunctionSections.Unknown, True)
AND
Error 10 'Store' is a type and cannot be used as an expression. d:\documents\visual studio 2010\Projects\ClassLibrary1\ClassLibrary1\Class1.vb 64 66 ClassLibrary1
Related to the line Dim arg2 As Term() = Decision.Preprocessing(args(1), Store)
Can anyone help me? I need to create functions to emulate simple and double precision for educational purposes. Thanks
#12 Опубликовано: 19.04.2011 11:10:04
Which version of Smath are you using? The tutorial, as it is written now, will not work for version 89.8 (beta). But it should work for version 0.89 (stable).
The first problem line should be:
New TermInfo("dg", TermType.Function, 2, "(num, dig) - Devuelve num con dig dígitos significativos", FunctionSection.Unknown, True)
(You addded an "s" to the end of "FunctionSection".)
If the program you are trying to write differs significantly from the tutorial, you probably should post a link to your entire source code in the forum. That way, we can test your code and help you better.
The first problem line should be:
New TermInfo("dg", TermType.Function, 2, "(num, dig) - Devuelve num con dig dígitos significativos", FunctionSection.Unknown, True)
(You addded an "s" to the end of "FunctionSection".)
If the program you are trying to write differs significantly from the tutorial, you probably should post a link to your entire source code in the forum. That way, we can test your code and help you better.
Will Massie
Mechanical Engineer
Oregon, USA
#13 Опубликовано: 19.04.2011 14:56:46
Your're right about FunctionSection(s) but the debugger doesnt recognize de name without the "s".
Can you upload the class.vb from the example? Because all that i need is a working trivial plugin and then change the code.
Thanks
Can you upload the class.vb from the example? Because all that i need is a working trivial plugin and then change the code.
Thanks
#14 Опубликовано: 19.04.2011 15:45:22
What version of Smath are you using? This is important because the tutorial will not work if you are using a particular version. Please check and let us know. It will be under Help --> About Smath Studio.
Will Massie
Mechanical Engineer
Oregon, USA
#15 Опубликовано: 19.04.2011 16:10:06
My version is 89.8, i get the trivial plugin working with this line:
New TermInfo("dg", TermType.Function, "(num, dig) - Devuelve num con dig dígitos significativos", FunctionSections.Unknown, True)
But still having the same problem with the "store":
Dim num As Term() = Decision.Preprocessing(args(0), Store)
it says:
store is a type and cant be used as an expresion!!! Any idea?
New TermInfo("dg", TermType.Function, "(num, dig) - Devuelve num con dig dígitos significativos", FunctionSections.Unknown, True)
But still having the same problem with the "store":
Dim num As Term() = Decision.Preprocessing(args(0), Store)
it says:
store is a type and cant be used as an expresion!!! Any idea?
#16 Опубликовано: 19.04.2011 16:16:13
The tutorial, as written, will not work for version 89.8. Andrey is in the process of making changes to the API in the 89.8 beta version. I would recommend using the 89.0 stable version for writing plugins at this point until we learn from him what changes have been made. When that time comes, the tutorial will be updated to reflect the changes.
Will Massie
Mechanical Engineer
Oregon, USA
#17 Опубликовано: 19.04.2011 23:01:41
Almost done in 89.8!
The problem with "store" was solved whis way:
Dim sto As New Store
Dim arg0 As Term() = Decision.Preprocessing(args(0), sto)
Dim arg1 As Term() = Decision.Preprocessing(args(1), sto)
Now the only problem remaining is this: i've created a function (dg) that rounds real numbers to a certain number of digits but not decimals (educational purposes in Numerical Analysis). The functions was working ok in stable 0.89 and now in 0.89.8, but in this version...
if i do dg(3,14159;3) = 3.14
if i do a:= 3.14159 and then dg(a;3) = NOTHING! (it says that a is not defined)
Does anyone here knows about any change in 89.8 that can explain this? i think there is a problem with de args()() parameter, but can solve this
Even when the function works ok in 0.89, i need to program inside functions, and 0.89.8 is the only version doing it!
Thanks,
The problem with "store" was solved whis way:
Dim sto As New Store
Dim arg0 As Term() = Decision.Preprocessing(args(0), sto)
Dim arg1 As Term() = Decision.Preprocessing(args(1), sto)
Now the only problem remaining is this: i've created a function (dg) that rounds real numbers to a certain number of digits but not decimals (educational purposes in Numerical Analysis). The functions was working ok in stable 0.89 and now in 0.89.8, but in this version...
if i do dg(3,14159;3) = 3.14
if i do a:= 3.14159 and then dg(a;3) = NOTHING! (it says that a is not defined)
Does anyone here knows about any change in 89.8 that can explain this? i think there is a problem with de args()() parameter, but can solve this
Even when the function works ok in 0.89, i need to program inside functions, and 0.89.8 is the only version doing it!
Thanks,
#18 Опубликовано: 20.04.2011 12:44:50
Ok, I see.
Would you be willing to share your source code? It may help us help you better.
It would probably be better if you posted it as a link, instead of simply pasting it into your post. This wiki page gives help on how to add attachments to your postings: Notes on Using the Forum
Would you be willing to share your source code? It may help us help you better.
It would probably be better if you posted it as a link, instead of simply pasting it into your post. This wiki page gives help on how to add attachments to your postings: Notes on Using the Forum
Will Massie
Mechanical Engineer
Oregon, USA
#19 Опубликовано: 24.04.2011 20:16:13
ing.sosa,
I think there must be a typo in your coding. The function
Public Function ExpressionEvaluation(ByVal root As SMath.Manager.Term, ByVal args()() As SMath.Manager.Term, ByRef store As SMath.Manager.Store, ByRef result() As SMath.Manager.Term) As Boolean Implements IPluginLowLevelEvaluation.ExpressionEvaluation
which is the way SMath communicates with your plugin and passes a reference to "store" which contains all the variables that are input on the SMath tablet interface.
Now when you define a:=3.14159 and pass it as an argument to your function dg, SMath looks it up in "store" by its name "a" and can return its value which is a list of terms which could include units.
When you Dim sto in your program you've created a new empty store in which "a" does not reside.
I've been using SMath 0.89 but tried the beta. In the beta there are some minor differences in passing parameters to SMath core functions compared to the tutorial. The best way to find the differences is to examine the reference SMath dll in the VB environment.
I think there must be a typo in your coding. The function
Public Function ExpressionEvaluation(ByVal root As SMath.Manager.Term, ByVal args()() As SMath.Manager.Term, ByRef store As SMath.Manager.Store, ByRef result() As SMath.Manager.Term) As Boolean Implements IPluginLowLevelEvaluation.ExpressionEvaluation
which is the way SMath communicates with your plugin and passes a reference to "store" which contains all the variables that are input on the SMath tablet interface.
Now when you define a:=3.14159 and pass it as an argument to your function dg, SMath looks it up in "store" by its name "a" and can return its value which is a list of terms which could include units.
When you Dim sto in your program you've created a new empty store in which "a" does not reside.
I've been using SMath 0.89 but tried the beta. In the beta there are some minor differences in passing parameters to SMath core functions compared to the tutorial. The best way to find the differences is to examine the reference SMath dll in the VB environment.
Ed
#20 Опубликовано: 29.04.2011 09:45:47
ing,sosa,
I took a closer look at your post and realized it is a typo.
Change uppercase "Store" to lowercase "store".
Dim num As Term() = Decision.Preprocessing(args(0), Store)
"Store" is the SMath class name. "store" is the variable passed to function "ExpressionEvaluation".
Good luck.
I took a closer look at your post and realized it is a typo.
Change uppercase "Store" to lowercase "store".
Dim num As Term() = Decision.Preprocessing(args(0), Store)
"Store" is the SMath class name. "store" is the variable passed to function "ExpressionEvaluation".
Good luck.
Ed
1 страниц (20 вхождений)
-
Новые сообщения
-
Нет новых сообщений