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 justhumm  
#1 Posted : 29 January 2019 00:16:22(UTC)
justhumm


Rank: Member

Groups: Registered
Joined: 02/03/2016(UTC)
Posts: 18
United States

I don't think this is possible, but I figured I would ask...

When dealing with long, multi-page function definitions, is it possible to break a function in multiple "sub-fuctions" (that will each fit on one page)?

...Is there some way to pass multiple local variables from one function to another?

Thanks!

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

Offline Jean Giraud  
#2 Posted : 29 January 2019 00:57:43(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: justhumm Go to Quoted Post
When dealing with long, multi-page function definitions, is it possible to break a function in multiple "sub-fuctions" (that will each fit on one page)?

...Is there some way to pass multiple local variables from one function to another?


Can't see how to relate your matrix to the the double question: split/pass.
You can do whatever you need whether from source or from work sheet result.
Too vague questions are hard to doctor w/o work sheet.

Split.PNG
Offline Davide Carpi  
#3 Posted : 29 January 2019 02:46:02(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
Of course it is possible.

variables.sm (20kb) downloaded 29 time(s).

cloud preview

Edited by user 29 January 2019 02:48:05(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline justhumm  
#4 Posted : 30 January 2019 03:14:43(UTC)
justhumm


Rank: Member

Groups: Registered
Joined: 02/03/2016(UTC)
Posts: 18
United States

Thanks for the responses, but I still thinking that I what I was hoping (not expecting) to achieve is not possible.

I am just working with some data table (matrix) calculation and manipulation. And, though simple, the functions / routines that I have come up with are rather long and can extend over the page breaks, which is making portions of them difficult or impossible to see.

My hope was that if I could break the longer function into a few smaller functions, then I could control the page break locations, as well as make the local equations more user-friendly (for checking) by having the local variables (and their values) pass from one embedded function to the next.

But I don't think the local variables will pass between the functions that way. :*(

function3 (x) = function2 (function1 (x))

Off_b = Off_a (names (table1, table2, value)) in the attached worksheet



piecewise - forum1.sm (73kb) downloaded 11 time(s).
Offline Jean Giraud  
#5 Posted : 30 January 2019 10:12:49(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Can't you just input/process the maths ?
At the very end plug the header and insert that bloody col [very easy].
That ease debugging wrt syntax is incorrect.
Offline Davide Carpi  
#6 Posted : 30 January 2019 14:06:36(UTC)
Davide Carpi


Rank: Advanced Member

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

Was thanked: 1329 time(s) in 875 post(s)
If in your worksheet you have to input the table once, move the data grouping outside the function on the canvas and everything will be available for any function.

However anything defined at some point is available at the same level and on deeper levels, thus you can make all more compact/readable by calling one or more functions after defining you data.

2019-01-30 12_01_34-Window.png

Edited by user 30 January 2019 14:15:00(UTC)  | Reason: Not specified

If you like my plugins consider to support SMath Studio buying a plan; to offer me a coffee: paypal.me/dcprojects
Offline alyles  
#7 Posted : 30 January 2019 16:18:57(UTC)
alyles


Rank: Advanced Member

Groups: Registered
Joined: 23/03/2016(UTC)
Posts: 276
United States

Was thanked: 91 time(s) in 57 post(s)
Originally Posted by: justhumm Go to Quoted Post
... My hope was that if I could break the longer function into a few smaller functions, then I could control the page break locations, as well as make the local equations more user-friendly (for checking) by having the local variables (and their values) pass from one embedded function to the next.

But I don't think the local variables will pass between the functions that way. :*(....


I believe you can do this, but you have to pass the function and their parameters in seperately. I do this for my Worst Case Analysis tool set I created which you can find here: https://en.smath.com/for...s-Toolset.aspx#post47624


You do have to be careful of how you define the function and it's inputs, but it works. Attached is a simple example as well using pythagorean theorem. pythagorean.sm (7kb) downloaded 10 time(s).Untitled.png

Edited by user 30 January 2019 16:27:32(UTC)  | Reason: Not specified

Feel free to join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW
Offline Jean Giraud  
#8 Posted : 30 January 2019 19:50:45(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: justhumm Go to Quoted Post
I am just working with some data table (matrix) calculation and manipulation. And, though simple, the functions / routines that I have come up with are rather long and can extend over the page breaks, which is making portions of them difficult or impossible to see.

My hope was that if I could break the longer function into a few smaller functions, then I could control the page break locations, as well as make the local equations more user-friendly (for checking) by having the local variables (and their values) pass from one embedded function to the next.

But I don't think the local variables will pass between the functions that way.


I get lost between your request and the work sheet. The way you do, you create
the system you process further. Just process the simple creation. once done,
easy to restore the header and rows "identity". We have the modules from Matrix Treasury. Just finish the maths, post and will do.
Those data you have entered, if they come from simple unique design: fine.
If they come from immense data base, per say from like a National Standard,
some more involved tools are needed, just to be adapted.
What page length have to do in there ? Use separators per piece maths.

CanYou.PNG
Offline Jean Giraud  
#9 Posted : 30 January 2019 21:20:10(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
... I don't understand completely the [H,V]lookup .
Maybe you can use the normal for loop construction.
Maybe otherwise from other modules attached

Utilities Matrix Truth Table [Locate row_col].sm (44kb) downloaded 11 time(s).
Users browsing this topic
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.