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 Greg Locock  
#1 Posted : 20 September 2009 20:11:06(UTC)
Greg Locock


Rank: Advanced Member

Groups: Registered
Joined: 30/08/2009(UTC)
Posts: 52
Location: Australia

Not to sure how it is coded, but would it be possible to explicitly state the output variable within a function.

For instance


func(a,b):=some complicated stuff which ends up in M
M=

Edited by moderator 21 September 2009 05:05:39(UTC)  | Reason: Smile removed

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

Offline Andrey Ivashov  
#2 Posted : 21 September 2009 05:05:49(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)
Not sure I understand. Please, post detailed explanation, maybe I'll implement it.
Offline Greg Locock  
#3 Posted : 21 September 2009 15:45:07(UTC)
Greg Locock


Rank: Advanced Member

Groups: Registered
Joined: 30/08/2009(UTC)
Posts: 52
Location: Australia

http://smath.info/wiki/G...unday_insert_problem.zip

for example. The procedure to insert a row works, but the function doesn't because you can't explixitly return the answer.

Something like ans:=B would be the way i'd expect to do it, where ans is a reserved word like in Matlab

Offline omorr  
#4 Posted : 21 September 2009 18:11:06(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)
Greg Locock wrote:
http://smath.info/wiki/GetFile.aspx?File=gregpics%5csunday_insert_problem.zip

for example. The procedure to insert a row works, but the function doesn't because you can't explixitly return the answer.

Something like ans:=B would be the way i'd expect to do it, where ans is a reserved word like in Matlab


This is, actually, the possibility to make Mathcad-like multiline functions with "line" (extension of SMath programing capability). It is on my "wishlist" as well. I really do not have the slightest idea how complicated could that be to implement in SMath, considering differences between SMath and Mathcad.

As far as I know (hope I am right) the only way to define a function in more then one line (just visually) is with "if":
func(x)←if(x≤5;5;x)
func(2)=5
func(10)=10

Regards,
Radovan

Edited by user 21 September 2009 18:23:37(UTC)  | Reason: Not specified

When Sisyphus climbed to the top of a hill, they said: "Wrong boulder!"
Offline Greg Locock  
#5 Posted : 21 September 2009 18:36:03(UTC)
Greg Locock


Rank: Advanced Member

Groups: Registered
Joined: 30/08/2009(UTC)
Posts: 52
Location: Australia

other syntax suggestions, these would go as the last line in a multiline function

Code:
B=

return(B)

B


I don't really have a preference, although B= is probably a bit weird.

Edited by user 21 September 2009 18:43:02(UTC)  | Reason: smiley

Users browsing this topic
Guest
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.