Using Boolean Logic on Vectors

Using Boolean Logic on Vectors - How to use logic vectors as input to Boolean Experssions - Messages

#1 Posted: 2/28/2016 11:26:20 PM
Eddie

Eddie

0 likes in 2 posts.

Group: User

Hi everyone,

I am a relative novice at SMath Studio, so please forgive any display of ignorance.

I want to use Boolean expressions with vectors, but I cannot find a way of doing this. It is relatively simple with Mathcad, but I want to use SMath Studio, as I am a student, and I am trying to show other students how to simplify logic circuits using Boolean algebra.

For example, the circuit described by ( A&B )|((B&C)&(B|C)) can be simplified to B&(B|C). I want to be able to call the three vectors (A, B, C) and have the output of the two expressions shown as a vector of zeros and ones (in this example the output vectors are the same as the simplified second-expression is the equivalent of the more-complex first-expression.

Is there a way of achieving this in SMath Studio.

Thanks in advance.

Eddie
#2 Posted: 2/29/2016 1:00:11 PM
Davide Carpi

Davide Carpi

1416 likes in 2873 posts.

Group: Moderator

Hello EddieAust,

To accomplish your task you have to use the programming loops (for, while) available in the right panel, and then you have to apply your logic to any element of the matrix/vector.

You can take a look here for an alternative way: Language-Integrated Query (Linq)
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
#3 Posted: 2/29/2016 1:51:39 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Hello Eddie,

As far as I have experimented/compared Mathcad 11/Smath,
they work both the same way, though Smath does not accept
the "maybe YES/maybe NO" logic unlike Mathcad apparently
more flexible but not correct in real instances.
Neither one of these applications will imitate Programmable
Logic Controllers. Hardly imitate a push button Start/Stop.

The attached is a good example of logic within a "While loop"
You have so many random pts in the circle, depending upon "h"
all the randoms are in there, but in larger/smaller area,
i.e: a random compressor. Great to demonstrate the gas
molecules compressed or relaxed.

Jean

Inst_Segment Partial Random.sm (39 KiB) downloaded 48 time(s).
#4 Posted: 3/1/2016 9:10:23 AM
Eddie

Eddie

0 likes in 2 posts.

Group: User

Hi Davide and Jean,

Thanks for your prompt replies, I appreciate your efforts.

Unfortunately, as I am showing other students how to use logic, I wanted something simple for them to use. In Mathcad 15 it is easy to show an original expression, and alongside it a simplified expression resulting from using Boolean Algebra, and I was hoping that SMath Studio would do the same, as I do not expect my fellow students to pay for a copy of Mathcad. Unfortunately, SMath Studio does not have to option of a simple use for logic on vectors as does Mathcad 15 (see attached .jpg image from Mathcad 15 - I hope this works, as this is the first time I have tried to attach an image).

Once again, thanks for your assistance.

Regards
Eddie

Mathcad15_Logic.jpg


#5 Posted: 3/1/2016 10:13:30 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Eddie: like this !

Jean

Utilities Matrix Vectorise LOGIC .sm (44 KiB) downloaded 67 time(s).
Utilities Matrix Vectorise Friendly .sm (17 KiB) downloaded 62 time(s).
3 users liked this post
Alexander O. Melnik 3/1/2016 2:29:00 PM, Davide Carpi 3/1/2016 1:59:00 PM, sergio 3/1/2016 1:47:00 PM
#6 Posted: 3/1/2016 1:46:05 PM
sergio

sergio

115 likes in 329 posts.

Group: User

if you want to automate the operation, then define two functions as those suggested by Jean. The aesthetic result is not comparable, but the functionality yes
sergio
[albumimg]1428[/albumimg]
2 users liked this post
frapuano 3/1/2016 2:54:00 PM, Davide Carpi 3/1/2016 1:55:00 PM
#7 Posted: 3/1/2016 4:59:22 PM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

... automate much simpler and more general.

Jean

Utilities Matrix Vectorise LOGIC .sm (12 KiB) downloaded 57 time(s).
1 users liked this post
ioan92 3/3/2016 10:12:00 AM
#8 Posted: 3/4/2016 2:35:35 PM
Andrey Ivashov

Andrey Ivashov

2270 likes in 3734 posts.

Group: Super Administrator

FYI, I'm currently working on this feature.

vectorize_1.png

Regards.
8 users liked this post
Ernesto 3/4/2016 4:51:00 PM, Radovan Omorjan 3/5/2016 3:54:00 AM, Jaan Praks 3/28/2016 5:20:00 PM, ioan92 3/4/2016 2:38:00 PM, Вячеслав Мезенцев 3/4/2016 2:46:00 PM, Alexander O. Melnik 3/4/2016 2:56:00 PM, Davide Carpi 3/4/2016 3:11:00 PM, sergio 3/4/2016 4:30:00 PM
#9 Posted: 3/5/2016 12:49:42 AM
Jean Giraud

Jean Giraud

983 likes in 6866 posts.

Group: User

Wrote

FYI, I'm currently working on this feature.



Yes, please, thank you Andrey.
Maybe next: fft and picture operator.
In the mean time, "Vectorise EXPRESS"
for user to adapt wrt applicable project

Jean

Utilities Matrix Vectorise EXPRESS.sm (27 KiB) downloaded 55 time(s).
#10 Posted: 3/5/2016 6:59:22 PM
Andrey Ivashov

Andrey Ivashov

2270 likes in 3734 posts.

Group: Super Administrator

Regarding initial question: see vectorize(..) function into new nightly build release: http://en.smath.info/forum/yaf_postst7329_SMath-Studio-0-98-5908--05-March-2016.aspx

Regards.
1 users liked this post
Davide Carpi 3/5/2016 9:05:00 PM
  • New Posts New Posts
  • No New Posts No New Posts