Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline Ragnedda  
#1 Posted : 23 July 2010 20:41:09(UTC)
Ragnedda

Rank: Newbie

Groups: Registered
Joined: 21/06/2010(UTC)
Posts: 3

I report a situation that can be a source of errors.
If you define the simple function:


F(a):=I a:=a+3
I a

and calculate F(1),
using the "symbolic" optimization the result is 7;
using the "numeric" optimization the result is 4.
No error message is reported by the program.
I think this situation must be clarified to avoid serious errors.
Also, I have not found any document explaining how parameters are
passed to a function (by reference, by value ...)

Many thanks

Ragnedda

Edited by moderator 23 July 2010 23:35:35(UTC)  | Reason: Not specified

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline omorr  
#2 Posted : 23 July 2010 23:32:25(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Hello,
Ragnedda wrote:

F(a):=I a:=a+3
I a

I can not understand this, sorry. Could you be more specific or try to use MATH tags - choose BB/ and MATH tag, please. Inside math tags, just copy and paste from SMath. Or, see some posts with math and choose "quote" to see the post source. You can see this post as well by "quote". Here is an example:
F(a)←I
F(a)—I
a←a+3
I←a
F(x)—3+x
F(a)—9+a
F(I)—12+a
F(1)=4
It might look a bit confusing and I am not sure if there is any use of this example. It is just a demonstration of SMath symbolic features.
Ragnedda wrote:

...Also, I have not found any document explaining how parameters are passed to a function (by reference, by value ...)

Visit this link on the Wiki, please User functions.
I hope that will clarify how is this working (including the above example).

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Andrey Ivashov  
#3 Posted : 24 July 2010 02:23:21(UTC)
Andrey Ivashov


Rank: Administration

Groups: Developers, Registered, Knovel Developers, Administrators, Advanced Member
Joined: 11/07/2008(UTC)
Posts: 1,616
Man
Russian Federation

Was thanked: 1978 time(s) in 666 post(s)
omorr, thanks.

Ragnedda, as I understood you are talking about
F(a):line(a:a+3,a,2,1)

Ragnedda wrote:
and calculate F(1)

To say truth I've never tested SMath Studio with lines and loops at right part of math expressions. The behavior you are mentioned was not even designed by me... it is what it is, so it is a bug, that SMath Studio is not raises an error on such expressions.

Ragnedda wrote:
Also, I have not found any document explaining how parameters are
passed to a function (by reference, by value ...)

All the arguments passes to functions by value.

Best regards.
Offline omorr  
#4 Posted : 24 July 2010 09:38:05(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Hello,

Please refer to this post concerning functions and lines
http://en.smath.info/forum/default.aspx?g=posts&m=2971#post2971

I continued to play with it, and here are the results:
I think this is Ragnedda problem reproduced:


Here is some more:


To be honest, I got confused now after all of these examples Sad
smath wrote:

To say truth I've never tested SMath Studio with lines and loops at right part of math expressions. The behavior you are mentioned was not even designed by me... it is what it is, so it is a bug, that SMath Studio is not raises an error on such expressions.

I am convinced, Andrey, that you will pay attention to this as soon as you can. I think that we will get the multiline functions working properly by solving this Good

Regards,
Radovan

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline omorr  
#5 Posted : 24 July 2010 13:42:30(UTC)
omorr


Rank: Administration

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

Was thanked: 318 time(s) in 268 post(s)
Hello,

Another simple test. Literal index, function as function arguments, multiline function (almost...)

As mentioned before. It is almost everything Ok. The variable "n" is problematic. It was defined twice ???, therefore it is "global" variable, seen outside the function "F". Variable "y" is "local" - not seen outside the function. It serves here to return the result.
As Andrey said, it is as it is - at the moment. I hope something could be done in the future about the problems mentioned in these posts. It would be a rather great improvement.

Regards,
Radovan
When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Users browsing this topic
Guest
Similar Topics
How to share user defined functions or plugins without programming? (Questions)
by fernando_92 19/12/2016 11:27:40(UTC)
Fun with user defined functions (Questions)
by mkraska 27/04/2014 10:34:50(UTC)
User Defined Functions(UDF) in the Insert Function Screen (Feature Requests)
by frapuano 07/11/2010 12:22:04(UTC)
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.