1 Pages (15 items)
While loop question - Messages
#1 Posted: 4/6/2023 6:28:44 PM
Hello everybody,
I'm really new to Smath and i am having an issue with the while loop. How can you write multiple conditions for your while loop. While a>b && b>c && c>d.
Would really appreciate some input.
I'm really new to Smath and i am having an issue with the while loop. How can you write multiple conditions for your while loop. While a>b && b>c && c>d.
Would really appreciate some input.
#2 Posted: 4/6/2023 7:44:47 PM
WroteHow can you write multiple conditions ...
If you want to piece wise plot conditional ...
if/otherwise ... as any as you want to condition.
From the directed visit Samples, iterative is bidirectional.
Or multiple conditional Golden ratio
More advanced conditional is generally Bolean... Example attached.
Show something of your Creation.
Cheers ... Jean.
Critical Triplet Demo.sm (16 KiB) downloaded 32 time(s).
#3 Posted: 4/7/2023 12:10:14 AM
Greetings!
In the boolean toolbar, you will notice "AND" and "OR" operators, denoted as ⋀ & ⋁ (respectively).
On that note, to specify more then (1) command under your while loop; utilize the "line(" command.
As such, you can copy and paste the following:
I hope this is of Good Help;
- Kenny Lemens, P.E. ᵂᴵ
WroteHello everybody,
I'm really new to Smath and i am having an issue with the while loop. How can you write multiple conditions for your while loop. While a>b && b>c && c>d.
Would really appreciate some input.
In the boolean toolbar, you will notice "AND" and "OR" operators, denoted as ⋀ & ⋁ (respectively).
On that note, to specify more then (1) command under your while loop; utilize the "line(" command.
As such, you can copy and paste the following:
line(a:20,b:5,c:1,d:0,while(((a>b)&(b>c))&(c>d),line(c
c+(b:b+5)),a:a+1,d:b*(-1),3,1)),stack(a,b,c,d),6,1)=#
I hope this is of Good Help;
- Kenny Lemens, P.E. ᵂᴵ
"No matter where you go, there you are." -Buckaroo BanzaiHotkeys: https://en.smath.com/forum/resource.ashx?a=45771&b=2
#5 Posted: 4/7/2023 4:12:52 PM
#6 Posted: 4/7/2023 4:33:31 PM
There are also;
ltlt(), altle(), alelt(), a≤b lele(), a≤b≤c
gtgt(), a>b>c
gtge(), a>b≥c
gegt(), a≥b>c
gege(), a≥b≥c
These functions are part of Custom Functions plugin.
Unfortunately, it supports only three arguments.
Despite that, some boolean expressions may shorten drastically.
Regards

ltlt(), altle(), alelt(), a≤b
gtgt(), a>b>c
gtge(), a>b≥c
gegt(), a≥b>c
gege(), a≥b≥c
These functions are part of Custom Functions plugin.
Unfortunately, it supports only three arguments.
Despite that, some boolean expressions may shorten drastically.
Regards
line(a:20,b:5,c:1,d:0,while((gtgt(b,a,c))&(c>d),line(c
c+(b:b+5)),a:a+1,d:b*(-1),3,1)),stack(a,b,c,d),6,1)=#
1 users liked this post
João Felipe Seráfico Melo 4/8/2023 2:45:00 PM
#7 Posted: 4/8/2023 10:17:59 AM
I've never thought about it, but I think that maybe I can add set of functions with unlimited arguments (>1), gt(#) ge(#) lt(#) le(#)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2 users liked this post
#8 Posted: 4/8/2023 2:08:03 PM
#9 Posted: 4/8/2023 4:20:10 PM
Wrotemaybe I can add set of functions with unlimited arguments
Would unlimited versions be mixed or same boolean expression?
#10 Posted: 4/8/2023 5:52:11 PM
#11 Posted: 4/8/2023 9:22:45 PM
WroteWrotemaybe I can add set of functions with unlimited arguments
Would unlimited versions be mixed or same boolean expression?
In addition to gt(#) ge(#) lt(#) le(#), some notes about a relseq function.
relseq.sm (24 KiB) downloaded 37 time(s).
Best regards.
Alvaro.
2 users liked this post
#12 Posted: 4/11/2023 6:03:38 AM
WroteWould unlimited versions be mixed or same boolean expression?
that way, it would be same boolean
lt(a,b,c,d,e,f)=a<b<c<d<e<f=(a<b)&(b<c)&(c<d)&(d<e)&(e<f)
WroteIn addition to gt(#) ge(#) lt(#) le(#), some notes about a relseq function.
relseq.sm (24 KiB) downloaded 37 time(s).
That's a good concept, I think that probaly it's feasible. I'll give it a try.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
2 users liked this post
#13 Posted: 4/13/2023 2:45:33 AM
#14 Posted: 4/18/2023 7:23:00 AM
WroteHi Davide. Something like this other?
this maybe?
also, prefix/postfix functions can be made for unlimited arguments.
I've tried something like postfix(F,x,y) but it isn't really user-friendly (e.g. it can't be used on the LHS of an assignment because it overvrites the postfix() function itself)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
1 users liked this post
Alvaro Diaz Falconi 4/18/2023 12:22:00 PM
#15 Posted: 4/18/2023 12:25:44 PM
Wrote... this maybe? ..
Hi Davide. Great implementation. But I'm thinking in ways to write set union a U b, intersection, function composition like f o g (x) := f(g(x)), logical binary operators like implies, iif and similar stuff.
Best regards.
Alvaro.
1 Pages (15 items)
-
New Posts
-
No New Posts