Message Boards Message Boards

0
|
5938 Views
|
12 Replies
|
3 Total Likes
View groups...
Share
Share this post:

What does the | symbol mean when used as solution by Reduce?

Hi all,

I am trying to solve a system of 6 equations in 6 unknowns. The system is quite easy but trigonometric functions are widely used. Using Solve, I get the following message:

Solve::nsmet: This system cannot be solved with the methods available to Solve.

On the other hand, Reduce gives me a solution. However, the solution contains the following expression, which I wasn't able to understand:

(C[1] | C[2] | C[3]) \[Element] Integers

I do not understand the meaning of the VerticalSeparator |. At first, I thought that at least one of the elements C[#] must be an integer but then why using | instead of ||?

Can anyone explain to me how to read such a solution, please?

Thank you very much in advance.

Alessandro

12 Replies

It does look somewhat confusing, because the vertical bar |, which in this case means And, looks similar to the double bar ||, which means Or. Also, the name "Alternatives" usually means "either or", not And. However the documentation of Element states that the three following inputs are equivalent:

Element[x | y, Integers]
Element[x, Integers] && Element[y, Integers]
Element[{x, y}, Integers]

and they are different from

Element[x, Integers] || Element[y, Integers]

It is a design choice that probably has its rationale.

POSTED BY: Gianluca Gorni

This particular notation is also explained in the documentation for Element (third and fourth usage line) so it is not even necessary to search for the Alternatives symbol itself.

POSTED BY: Ilian Gachevski

I was unaware that the first argument of Element could be a pattern! Thanks for pointing out! Now the result makes more sense.

POSTED BY: Sander Huisman

@Alessandro Peloni you should really try to use docs. You can actually put this symbol | in the docs' search and get function called Alternatives - see image below. You can also see it by using FullForm on your expression, for example as a part of answer to:

Reduce[JacobiCS[x, 3] == 1 + I, x]

FullForm[(C[1] | C[2]) \[Element] Integers]
Out[]= Element[Alternatives[C[1], C[2]], Integers]

again arriving at Alternatives. Reading docs on Alternatives will make it clear what it does there in you answer from Reduce. The example I showed also comes from docs on Reduce.

enter image description here

POSTED BY: Sam Carrettie

Hi Sam,

Thank you for your answer. I am sorry I am a newbie with Mathematica. However, I also looked in the doc for all the symbols Mathematica uses and I didn't find it. Next time I will look deeper.

Cheers,

Alessandro

Please submit the entire code (and/or entire input), I have a feeling there is an error in it. Normally you expect || in the output (Or). A single | is Alternatives in Wolfram Language but is only used for pattern matching as far as I know.

POSTED BY: Sander Huisman

Hi Sander,

thank you for your reply.

I define my equations as (following there is the first one, but the other 5 equations are of the same form):

eq1[x1, x2, x3, x4, x5, x6] := x2 (Cos[x5] Cos[x3 x6] - Cos[x4] Sin[x5] Sin[x3 x6]) + x1 Sin[x4] Sin[x5];

I solve the system of equations with Reduce as follows:

sol = Reduce[ eq1[x1, x2, x3, x4, x5, x6] == eq1[x10, x20, x30, 0, 0, 0] && eq2[x1, x2, x3, x4, x5, x6] == eq2[x10, x20, x30, 0, 0, 0] && eq3[x1, x2, x3, x4, x5, x6] == eq3[x10, x20, x30, 0, 0, 0] && eq4[x1, x2, x3, x4, x5, x6] == eq4[x10, x20, x30, 0, 0, 0] && eq5[x1, x2, x3, x4, x5, x6] == eq5[x10, x20, x30, 0, 0, 0] && eq6[x1, x2, x3, x4, x5, x6] == 0, {x1, x2, x3, x4, x5, x6}]

And after that I use FullSimplify with the assumptions for my problem:

FullSimplify[sol, x10 [Element] Reals && x20 [Element] Reals && x20 > 0 && x30 [Element] Reals && x30 > 0 && x6 [Element] Reals && x1 [Element] Reals && x2 [Element] Reals && x2 > 0 && x3 [Element] Reals && x3 >= 0 && x5 [Element] Reals && x5 >= 0 && x5 < 2 Pi && x4 [Element] Reals && x4 >= 0 && x4 < Pi]

The solution I get contains several logical expressions and one of the solutions is the following:

x1 == x10 && (C[1] | C[2] | C[3]) [Element] Integers && x4 == 2 [Pi] C[3] && x3 == x30 && [Pi] + 2 [Pi] C[1] == x4 && x2 == x20 && [Pi] + 2 [Pi] C[2] == x30 x6

Please indent your code using tab in front of each line such that it is displayed correctly.

What are eq2...eq6 ? I can't reproduce it without all code.

Try minimizing your problem.

POSTED BY: Sander Huisman

Sander,

thank you for your help. However, Sam solved my problem showing me that the | symbol is actually Alternatives rather than VerticalSeparator. Now the solution makes sense to me.

Thank you again for your help.

Alessandro

Yeah, I said so too; quite unexpected output to be honest. But I see now that it is indeed returned by Reduce sometimes.

POSTED BY: Sander Huisman

It means that all the C[i] are integers. See also the documentation.

POSTED BY: Ilian Gachevski

Hi Ilian,

thank you for your reply. What I don't understand is why the symbol | (VerticalSeparator) has been used rather than something like one of the following?

{C[1], C[2], C[3]} [Element] Integers (as reported in the documentation for the Element operator)

{C[1] && C[2] && C[3]} [Element] Integers

Cheers,

Alessandro

Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard

Group Abstract Group Abstract