Using Boolean Logic on Vectors

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

#1 已发布: 2016/2/28 23:26:20
Eddie

Eddie

0个赞,共2个帖子。

组: 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 已发布: 2016/2/29 13:00:11
Davide Carpi

Davide Carpi

1,443个赞,共2,936个帖子。

组: 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 已发布: 2016/2/29 13:51:39
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: 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)已下载 1387 次。
#4 已发布: 2016/3/1 09:10:23
Eddie

Eddie

0个赞,共2个帖子。

组: 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 已发布: 2016/3/1 10:13:30
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

Eddie: like this !

Jean

Utilities Matrix Vectorise LOGIC .sm (44.69 KiB)已下载 1371 次。
Utilities Matrix Vectorise Friendly .sm (17.01 KiB)已下载 1366 次。
3位用户喜欢此帖子
Alexander O. Melnik 2016/3/1 14:29:00, Davide Carpi 2016/3/1 13:59:00, sergio 2016/3/1 13:47:00
#6 已发布: 2016/3/1 13:46:05
sergio

sergio

127个赞,共342个帖子。

组: 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位用户喜欢此帖子
frapuano 2016/3/1 14:54:00, Davide Carpi 2016/3/1 13:55:00
#7 已发布: 2016/3/1 16:59:22
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: User

... automate much simpler and more general.

Jean

Utilities Matrix Vectorise LOGIC .sm (12.05 KiB)已下载 1393 次。
1位用户喜欢此帖子
ioan92 2016/3/3 10:12:00
#8 已发布: 2016/3/4 14:35:35
Andrey Ivashov

Andrey Ivashov

2,344个赞,共4,057个帖子。

组: Super Administrator

FYI, I'm currently working on this feature.

vectorize_1.png

Regards.
8位用户喜欢此帖子
Ernesto 2016/3/4 16:51:00, Radovan Omorjan 2016/3/5 03:54:00, Jaan Praks 2016/3/28 17:20:00, ioan92 2016/3/4 14:38:00, Вячеслав Мезенцев 2016/3/4 14:46:00, Alexander O. Melnik 2016/3/4 14:56:00, Davide Carpi 2016/3/4 15:11:00, sergio 2016/3/4 16:30:00
#9 已发布: 2016/3/5 00:49:42
Jean Giraud

Jean Giraud

983个赞,共6,866个帖子。

组: 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)已下载 1403 次。
#10 已发布: 2016/3/5 18:59:22
Andrey Ivashov

Andrey Ivashov

2,344个赞,共4,057个帖子。

组: 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位用户喜欢此帖子
Davide Carpi 2016/3/5 21:05:00
  • 有新帖
  • 无新帖