Rank: Advanced Member Groups: Registered
Joined: 18/05/2011(UTC) Posts: 36
Was thanked: 3 time(s) in 3 post(s)
|
Heya,
so here's my suggestion - hooked sections.
The idea is this,
lets say i have a section in a smath sheet
a:=5 b:=10
c:=a+b
what i'd like to do, is insert a 'hook' prior to this section
<hook 1> a:=5 b:=10
c:=a+b
</hook 1>
so right now
c=15
what i'd like to do, is be able to call the hook section, with a:=9
hook1(a:9) -> c=19
the reason im suggesting this concept, is that sometimes, i'll write a section that displays the information very nicely, but then i need to loop over the section with different variables.
This results in messy looking functions and loops, that i feel detract from the readability of the sheet.
By using hooked sections, i can display my methodology nicely, and still loop over the section with different variables.
I hope i've explained the concept well enough.
-Pete
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 10/12/2009(UTC) Posts: 246 Location: Cali, Colombia Was thanked: 85 time(s) in 65 post(s)
|
sublim21 wrote: <hook 1> a:=5 b:=10 c:=a+b
</hook 1> so right now c=15
what i'd like to do, is be able to call the hook section, with a:=9
hook1(a:9) -> c=19
In SMath you can define c as a function: a:5b:10c(a;:a+bc(a;=15a:9c(a;=19Regards, Oscar
|
|
|
|
Rank: Advanced Member Groups: Registered
Joined: 15/04/2012(UTC) Posts: 1,986 Was thanked: 1124 time(s) in 721 post(s)
|
In fact, you even do not need a function, just symbolic expressions. If you re-define the independent variables, then just display the dependent ones again. There is no need to repeat the definitions, as would be required in most programming languages. In the example you can change the ODE coefficients without having them in the parameter list of D. The odd thing is that this works only if D is defined with numeric optimization. Then the symbolic dependence is retained. If you use symbolic optimization, then the current (at definition time) values are hardwired and later changes do not have any effect. Edited by user 29 May 2013 22:17:03(UTC)
| Reason: Not specified File Attachment(s): mkraska attached the following image(s): |
|
|
|
|
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.