12 Replies - 2604 Views - Last Post: 19 October 2012 - 08:08 AM

#1 deprosun  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 289
  • Joined: 16-November 10

what does y:= x*x mean?

Posted 11 October 2012 - 08:01 AM

What does the y:= x*x mean in the following code?

if (x>100)
then y:= x*x


I am studying predicate logic.
Any good online references for it?

This post has been edited by deprosun: 11 October 2012 - 08:01 AM

Is This A Good Question/Topic? 0
  • +

Replies To: what does y:= x*x mean?

#2 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1291
  • View blog
  • Posts: 2,859
  • Joined: 30-January 11

Re: what does y:= x*x mean?

Posted 11 October 2012 - 08:03 AM

y becomes x multiplied by x (x squared)
Was This Post Helpful? 0
  • +
  • -

#3 AdamSpeight2008  Icon User is offline

  • MrCupOfT
  • member icon


Reputation: 2216
  • View blog
  • Posts: 9,351
  • Joined: 29-May 08

Re: what does y:= x*x mean?

Posted 11 October 2012 - 08:06 AM

:= is the mathematical symbol for Assignment.

So it say the label y assign it the value of multiply (assuming it means that) the content of label x by the contents of label x.

This post has been edited by AdamSpeight2008: 11 October 2012 - 08:59 AM

Was This Post Helpful? 2
  • +
  • -

#4 deprosun  Icon User is offline

  • D.I.C Regular

Reputation: 0
  • View blog
  • Posts: 289
  • Joined: 16-November 10

Re: what does y:= x*x mean?

Posted 11 October 2012 - 08:06 AM

View PostRyano121, on 11 October 2012 - 10:03 AM, said:

y becomes x multiplied by x (x squared)



Do you mean this y = x^2 is same as y:= x*x??
Was This Post Helpful? 0
  • +
  • -

#5 Ryano121  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 1291
  • View blog
  • Posts: 2,859
  • Joined: 30-January 11

Re: what does y:= x*x mean?

Posted 11 October 2012 - 08:08 AM

In the mathematical sense yes as if you square something you are essentially just multiplying it by itself.

However in programming it can often mean something different. Often it's the bitwise OR operator which will give very different results than raising powers.
Was This Post Helpful? 2
  • +
  • -

#6 lordofduct  Icon User is online

  • I'm a cheeseburger
  • member icon


Reputation: 2506
  • View blog
  • Posts: 4,615
  • Joined: 24-September 10

Re: what does y:= x*x mean?

Posted 11 October 2012 - 09:36 AM

View Postdeprosun, on 11 October 2012 - 10:06 AM, said:

View PostRyano121, on 11 October 2012 - 10:03 AM, said:

y becomes x multiplied by x (x squared)



Do you mean this y = x^2 is same as y:= x*x??


no...

in math the equals sign defines an equation:

y = x^2
or
y = x*x
or
y = 3
is a function that defines a curve in 2-space

y := x^2
or
y := x*x
or
y := 3
states that y is changed to become the 1d scalar

Both are not the same.

Consider:
as an equation this makes sense
3 + y = x * x
as an assignment this is gibberish
3 + y := x * x

this need for an 'assignment'/'defined as' symbol is necessary to communicate what you're doing. And it can't be the equal sign as that is already used to mean an equation (not the same).

This post has been edited by lordofduct: 11 October 2012 - 09:39 AM

Was This Post Helpful? 2
  • +
  • -

#7 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 609
  • Joined: 03-April 12

Re: what does y:= x*x mean?

Posted 16 October 2012 - 06:52 AM

What kind of math has assignment?

I guess it would break against some basic ideas of math.
The thing is: in math a value - say 3 is unique. There is only
one number 3. All expressions referring to 3 refer to the same 3.
Otherwise sets will not be same if the elements are the same.
(definition of natural numbers by sets)
Was This Post Helpful? 0
  • +
  • -

#8 lordofduct  Icon User is online

  • I'm a cheeseburger
  • member icon


Reputation: 2506
  • View blog
  • Posts: 4,615
  • Joined: 24-September 10

Re: what does y:= x*x mean?

Posted 16 October 2012 - 08:17 AM

assignment is definition... it means defined as, used rather frequently...

Say you want to define the variable g as gravity:

g := 9.8 m/s^2

now we know anywhere in the following math, g means 9.8 m/s^2

Some people just write at the top of the work:

"g is defined as 9.8 m/s^2"

but most mathematicians hate English and prefer short hand symbols for everything.

This even occurs in functional math. We can define a function that can take a function, and then define which functions you may use with in said function. Then this can build to algorithms where those definitions can change.

step 1 : define formula f
step 2 : define dependent formula g
step 3 : perform f with input g
step 4 : if result is positive g becomes h, else done
step 5 : goto step 3

again, all of this would be in symbols... because mathematicians tend to prefer symbols.




Give you common examples that we all use constantly and take for granted.

pi := 3.14159...
e := 2.71828...
golden ratio := (1 + sqrt(5)) / 2

we don't usually need to write out that these are defined as such... but if we HAD to, then well... here it is.

Math seldom deals with a single constant like '3'. It tends to deal with number sets, represented in variables and restricted by the set said set is defined as. Those sets can be defined as a constant, a number set like R (all real numbers), functions, all sorts of things. These things are stored inside some variable representation so that we don't have to write out (1 + sqrt(5) / 2) every time we need to reference it in our formula.

This post has been edited by lordofduct: 16 October 2012 - 08:36 AM

Was This Post Helpful? 0
  • +
  • -

#9 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 609
  • Joined: 03-April 12

Re: what does y:= x*x mean?

Posted 17 October 2012 - 06:48 AM

So you don't mean identity?
That notation is not familiar to me, and I believe it's more like writer's notation than standard math.

Quote

Math seldom deals with a single constant like '3'. It tends to deal with number sets, represented in variables and restricted by the set said set is defined as.


I didn't get all of that, but that's where OO typicallu goes wrong: It tahes the class of elements as a set, and tries to define operations as properties of the elements, whereas in math and algebraic construction typically consists od a set of elements AND operations between them (separately from the set and elements).

Basically it's not even question of operations, but mapping from one or more sets to another set (sorry, I'm not too familiar with the english terms of math - mapping into a set/onto a set/...
meaning injection/surjection/bijection/function.)

What I ment about the definition of 3 and the sets was ZF.

Basically math doesn't describe changes but snapshots. Even changes are described as invariants in the change, or snapshot of snapshots where each of the snapshots have different value for some parameter (one of which may be called "time").
Was This Post Helpful? 0
  • +
  • -

#10 lordofduct  Icon User is online

  • I'm a cheeseburger
  • member icon


Reputation: 2506
  • View blog
  • Posts: 4,615
  • Joined: 24-September 10

Re: what does y:= x*x mean?

Posted 17 October 2012 - 07:36 AM

What in god's name are you on about?

This isn't complicated shit.

":=" means "defined as"

All it appears your argument is, is that it's useless because in set theory you don't have a need for it. Well sorry bro, there's more to math then just that.


And yes, it's notation, for writing. And it's standard math as well. Because in math, you have to write things.

http://en.wikipedia....matical_symbols

You'll find it in there, just ctrl+f ':='

This post has been edited by lordofduct: 17 October 2012 - 07:42 AM

Was This Post Helpful? 0
  • +
  • -

#11 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 609
  • Joined: 03-April 12

Re: what does y:= x*x mean?

Posted 18 October 2012 - 05:42 AM

View Postlordofduct, on 17 October 2012 - 05:36 PM, said:

What in god's name are you on about?

This isn't complicated shit.

":=" means "defined as"

All it appears your argument is, is that it's useless because in set theory you don't have a need for it. Well sorry bro, there's more to math then just that.


And yes, it's notation, for writing. And it's standard math as well. Because in math, you have to write things.

http://en.wikipedia....matical_symbols

You'll find it in there, just ctrl+f ':='


Calm down, think of your blood pressure.

You just seem to have different idea of what the word "definition" means than it means in math.
Remember that math does not interpret the "meaning of the entities".
The consepts of math and the concepts of programming are different, even if they often look similar.

The definition in math is more close to textual replacement macro in programming.

Quote

The symbols below are usually synonymous with the corresponding concept (ultimately an arbitrary choice made as a result of the cumulative history of mathematics) but in some situations a different convention may be used.


Quote

x := y, y =: x or x ≡ y means x is defined to be another name for y, under certain assumptions taken in context.


That seems to me like usually ":=", "=:", or "≡" is used to express identity.
That is, alias names for the same thing.

To be more exact, math is almost all about rewriting rules, and the identity is exactly that:
A very strict and "unconditional" rewrite rule.
Was This Post Helpful? 0
  • +
  • -

#12 lordofduct  Icon User is online

  • I'm a cheeseburger
  • member icon


Reputation: 2506
  • View blog
  • Posts: 4,615
  • Joined: 24-September 10

Re: what does y:= x*x mean?

Posted 18 October 2012 - 06:37 AM

I'm sorry, but actually I know exactly what 'defined as' means in mathematics.

Do note, I was a math major long before I started programming. And I never spent a day in school for programming.

If you mean identity to mean, the identity of this symbol is... then yeah, they're synonyms. So you're on a semantic statement because you prefer the word 'identity'.

I also made no comment about "≡", and that wiki article that was linked points out that "≡" is also sometimes used to mean congruence as well (which is actually what I was taught it to mean).

:= means defined as, my example pi := 3.14159... and goldenratio = (1 + sqrt(5) / 2) are perfect examples of the use of it. The symbol pi is 3.14159... by definition.

This post has been edited by lordofduct: 18 October 2012 - 06:41 AM

Was This Post Helpful? 0
  • +
  • -

#13 turboscrew  Icon User is offline

  • D.I.C Addict

Reputation: 100
  • View blog
  • Posts: 609
  • Joined: 03-April 12

Re: what does y:= x*x mean?

Posted 19 October 2012 - 08:08 AM

Just:
assignment is quite different from textual replacement macro
(#define in C)

Both of them are basically different from
"callin 3 as X" in which case X is identically 3, or
X is the same thing as 3.

That is then different of a case, where x HAPPENS to be
EQUAL to 3. In slightly different situation x could probably be something else. (Here I'm thinking of equality as both predicate and assertion)

You know that, but I guess most people don't.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1