Using Boolean Logic on Vectors

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

#1 Pubblicato: 28/02/2016 23:26:20
Eddie

Eddie

0 apprezzamenti in 2 post.

Gruppo: 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 Pubblicato: 29/02/2016 13:00:11
Davide Carpi

Davide Carpi

1.443 apprezzamenti in 2.936 post.

Gruppo: 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 Pubblicato: 29/02/2016 13:51:39
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: 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,42 KiB) scaricato 1373 volta(e).
#4 Pubblicato: 01/03/2016 09:10:23
Eddie

Eddie

0 apprezzamenti in 2 post.

Gruppo: 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 Pubblicato: 01/03/2016 10:13:30
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: User

Eddie: like this !

Jean

Utilities Matrix Vectorise LOGIC .sm (44,69 KiB) scaricato 1359 volta(e).
Utilities Matrix Vectorise Friendly .sm (17,01 KiB) scaricato 1355 volta(e).
3 utenti hanno apprezzato questo post
Alexander O. Melnik 01/03/2016 14:29:00, Davide Carpi 01/03/2016 13:59:00, sergio 01/03/2016 13:47:00
#6 Pubblicato: 01/03/2016 13:46:05
sergio

sergio

127 apprezzamenti in 342 post.

Gruppo: 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 utenti hanno apprezzato questo post
frapuano 01/03/2016 14:54:00, Davide Carpi 01/03/2016 13:55:00
#7 Pubblicato: 01/03/2016 16:59:22
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: User

... automate much simpler and more general.

Jean

Utilities Matrix Vectorise LOGIC .sm (12,05 KiB) scaricato 1377 volta(e).
1 utenti hanno apprezzato questo post
ioan92 03/03/2016 10:12:00
#8 Pubblicato: 04/03/2016 14:35:35
Andrey Ivashov

Andrey Ivashov

2.343 apprezzamenti in 4.056 post.

Gruppo: Super Administrator

FYI, I'm currently working on this feature.

vectorize_1.png

Regards.
8 utenti hanno apprezzato questo post
Ernesto 04/03/2016 16:51:00, Radovan Omorjan 05/03/2016 03:54:00, Jaan Praks 28/03/2016 17:20:00, ioan92 04/03/2016 14:38:00, Вячеслав Мезенцев 04/03/2016 14:46:00, Alexander O. Melnik 04/03/2016 14:56:00, Davide Carpi 04/03/2016 15:11:00, sergio 04/03/2016 16:30:00
#9 Pubblicato: 05/03/2016 00:49:42
Jean Giraud

Jean Giraud

983 apprezzamenti in 6.866 post.

Gruppo: 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,61 KiB) scaricato 1387 volta(e).
#10 Pubblicato: 05/03/2016 18:59:22
Andrey Ivashov

Andrey Ivashov

2.343 apprezzamenti in 4.056 post.

Gruppo: 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 utenti hanno apprezzato questo post
Davide Carpi 05/03/2016 21:05:00
  • Nuovi post
  • Nessun nuovo post