This is a read-only archive of the old Scratch 1.x Forums.
Try searching the current Scratch discussion forums.

#201 2011-04-20 05:20:49

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling all math lovers and good programmers

OK, sounds good.

Offline

 

#202 2011-04-20 05:25:43

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Calling all math lovers and good programmers

Yay, 9 pages!  big_smile

Last edited by Hardmath123 (2011-04-20 05:26:15)


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#203 2011-04-20 06:37:20

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Calling all math lovers and good programmers

I'm gonna be on a vacation 'till Sunday. Just letting you know. So, scimonster, can you take over my job:

I wrote:

Okay, I'm going to assign a few jobs:

Hardmath123: I'm going to build the string-list setup engine

scimonster: Once I'm done, remove commas (like in 1,000) and replace constant's names with values.

applejack: Make specific error backgrounds

amercbu: Once sci's done, add something to test for mismatched brackets and when you have something like 5√2 or (1)(2) replace them with 5*√2 or (1)*(2)

hpotter134: Once amercbu's done, add something to report the innermost nested bracket set. So 1+(2+3) would report 2+3


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#204 2011-04-20 07:44:52

Hardmath123
Scratcher
Registered: 2010-02-19
Posts: 1000+

Re: Calling all math lovers and good programmers

Sci, you have make an engine that:

•Converts the input to a list
  ~Keeps numbers and operation names like sin and sqrt as 1 item.
  ~Ex: Converts sqrt 1 + 2 into:
      ·sqrt
      ·1
      ·+
      ·2
•Ignores anything that isn't a number or an operator's symbol
•Ignores commas in numbers: 1,000 converts to 1000

and

•remove commas (like in 1,000)
•replace constant's names with values: e, π, ϕ, pi, phi, and a few more.


Hardmaths-MacBook-Pro:~ Hardmath$ sudo make $(whoami) a sandwich

Offline

 

#205 2011-04-20 10:57:11

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling all math lovers and good programmers

Yeah. I'll have to look up some of them, but never fear, Wikipedia is here!  tongue
I'll get to work on that now!

Offline

 

#206 2011-04-20 13:46:38

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Calling all math lovers and good programmers

Got it, sounds good.

Offline

 

#207 2011-04-20 14:25:56

recycle49
Scratcher
Registered: 2009-12-21
Posts: 1000+

Re: Calling all math lovers and good programmers

Hardmath123 wrote:

Recycle, you're back!



Checkpoint
•Things we accomplished:
  ~Figured out what setup engine will do
•Things we decided:
  ~This'll be made in Scratch, not BYOB
•What we need do do:
  ~Program setup engine:

Ok, progress has been made... What should i do?


"Every challenge must be met, every battle must be won, and every story will end." -Me
Recycle49 December 09 - November 11 Goodbye

Offline

 

#208 2011-04-20 17:54:00

hpotter134
Scratcher
Registered: 2010-02-21
Posts: 100+

Re: Calling all math lovers and good programmers

Hardmath123 wrote:

Okay, I'm going to assign a few jobs:
...
hpotter134: Once amercbu's done, add something to report the innermost nested bracket set. So 1+(2+3) would report 2+3

What would expressions such as (1+2)*(3+4) or ((1+2)*(3+(4+5))) report? Or do you want it to report a list of all of the innermost bracketed sets, and maybe their locations?

Last edited by hpotter134 (2011-04-20 20:38:58)


http://i45.tinypic.com/fxgtvc.png

Offline

 

#209 2011-04-20 20:38:22

hpotter134
Scratcher
Registered: 2010-02-21
Posts: 100+

Re: Calling all math lovers and good programmers

Another idea: To check if the parenthesis are unmatched, we can have two variables in the list setup engine, one for ( and one for ), and at the end of the setup we can check whether or not there are sufficient parenthesis, ie var(=var)

And after testing some stuff on my graphing calculator, I got an idea: If there are less ) parenthesis than ( parenthesis, we can

Code:

Repeat var( - var)
     add ) to list

That way, 5(8 = 5(8) = 40

Just an idea, but it might be a nice feature.


http://i45.tinypic.com/fxgtvc.png

Offline

 

#210 2011-04-21 00:46:54

applejack
Scratcher
Registered: 2010-03-23
Posts: 100+

Re: Calling all math lovers and good programmers

That could just as easily be solved with just one variable, it would start as zero, and for every ( there would be 1 added to the varable, and for every ) 1 would be subtracted from the varable. if at the end the variable was not equal to zero, there would be a syntax error.

hpotter134 wrote:

Another idea: To check if the parenthesis are unmatched, we can have two variables in the list setup engine, one for ( and one for ), and at the end of the setup we can check whether or not there are sufficient parenthesis, ie var(=var)

And after testing some stuff on my graphing calculator, I got an idea: If there are less ) parenthesis than ( parenthesis, we can

Code:

Repeat var( - var)
     add ) to list

That way, 5(8 = 5(8) = 40

Just an idea, but it might be a nice feature.


http://i.imgur.com/zKzps.png
http://blocks.scratchr.org/API.php?action=onlineStatus&type=square&user=applejack -I'm http://blocks.scratchr.org/API.php?action=onlineStatus&type=text&user=applejack

Offline

 

#211 2011-04-21 01:28:10

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling all math lovers and good programmers

hpotter134 wrote:

Another idea: To check if the parenthesis are unmatched, we can have two variables in the list setup engine, one for ( and one for ), and at the end of the setup we can check whether or not there are sufficient parenthesis, ie var(=var)

And after testing some stuff on my graphing calculator, I got an idea: If there are less ) parenthesis than ( parenthesis, we can

Code:

Repeat var( - var)
     add ) to list

That way, 5(8 = 5(8) = 40

Just an idea, but it might be a nice feature.

Hmm, maybe.  neutral

hpotter134 wrote:

Hardmath123 wrote:

Okay, I'm going to assign a few jobs:
...
hpotter134: Once amercbu's done, add something to report the innermost nested bracket set. So 1+(2+3) would report 2+3

What would expressions such as (1+2)*(3+4) or ((1+2)*(3+(4+5))) report? Or do you want it to report a list of all of the innermost bracketed sets, and maybe their locations?

No, it would find the first ) and then look for the ( before.
For example...

Code:

((1+2)*(3+(4+5)))
1+2
3
(3*(3+(4+5)))
4+5
9
(3*(3+9))
3+9
12
(3*12)
3*12
36

Last edited by scimonster (2011-04-21 13:42:05)

Offline

 

#212 2011-04-21 12:49:50

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Calling all math lovers and good programmers

hpotter134 wrote:

Another idea: To check if the parenthesis are unmatched, we can have two variables in the list setup engine, one for ( and one for ), and at the end of the setup we can check whether or not there are sufficient parenthesis, ie var(=var)

And after testing some stuff on my graphing calculator, I got an idea: If there are less ) parenthesis than ( parenthesis, we can

Code:

Repeat var( - var)
     add ) to list

That way, 5(8 = 5(8) = 40

Just an idea, but it might be a nice feature.

TI 84 graphing calculator?  That's what I have.  I think that this could be achieved, as applejack said, with one variable.  After scanning the list, if the number of leftpar-rightpar is greater than 0, then you add a certain number of rightpar on the end.  If the number of leftpar-rightpar is less than 0, you add some leftpar at the beginning.

Offline

 

#213 2011-04-21 15:03:15

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling all math lovers and good programmers

I'm rounding constants to 5 decimals.

Offline

 

#214 2011-04-21 19:46:25

applejack
Scratcher
Registered: 2010-03-23
Posts: 100+

Re: Calling all math lovers and good programmers

TI84? I have one too! I'm making tetris on it.

amcerbu wrote:

hpotter134 wrote:

Another idea: To check if the parenthesis are unmatched, we can have two variables in the list setup engine, one for ( and one for ), and at the end of the setup we can check whether or not there are sufficient parenthesis, ie var(=var)

And after testing some stuff on my graphing calculator, I got an idea: If there are less ) parenthesis than ( parenthesis, we can

Code:

Repeat var( - var)
     add ) to list

That way, 5(8 = 5(8) = 40

Just an idea, but it might be a nice feature.

TI 84 graphing calculator?  That's what I have.  I think that this could be achieved, as applejack said, with one variable.  After scanning the list, if the number of leftpar-rightpar is greater than 0, then you add a certain number of rightpar on the end.  If the number of leftpar-rightpar is less than 0, you add some leftpar at the beginning.


http://i.imgur.com/zKzps.png
http://blocks.scratchr.org/API.php?action=onlineStatus&type=square&user=applejack -I'm http://blocks.scratchr.org/API.php?action=onlineStatus&type=text&user=applejack

Offline

 

#215 2011-04-21 20:35:54

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Calling all math lovers and good programmers

Same here!  I already made Snake and a version of this.

Offline

 

#216 2011-04-21 23:56:37

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling all math lovers and good programmers

[/offtopic]

Offline

 

#217 2011-04-22 00:39:40

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling all math lovers and good programmers

Rexpup's suggestion would make this so much easier! It's getting a bit hard remembering where each code is.  tongue
Edit: I just counted 8 C blocks nested!  yikes

Last edited by scimonster (2011-04-22 01:13:30)

Offline

 

#218 2011-04-22 01:10:32

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling all math lovers and good programmers

Should we include a pick random operator? Some calcs use that...

Offline

 

#219 2011-04-22 02:08:54

TRocket
Scratcher
Registered: 2009-08-18
Posts: 1000+

Re: Calling all math lovers and good programmers

can i join i can program the brackets (i used them in my programming language in scratch)


http://i.imgur.com/1QqnHxQ.png

Offline

 

#220 2011-04-22 02:11:12

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling all math lovers and good programmers

TRocket wrote:

can i join i can program the brackets (i used them in my programming language in scratch)

Sorry, but I think we have enough members right now. We also have someone who will do brackets (hpotter134). Anyways, it's not me making decisions, it's Hardmath123, and he won't be back for a few days.  hmm
------------------
What I've done so far:
Adds numbers into 1 item
Adds ops
Adds brackets
Does the following multiple letter ops:
  sqrt
  abs (and ||)
  mod
  round
  sin
  cos
  tan
  atan
  asin
  acos

Last edited by scimonster (2011-04-22 08:11:07)

Offline

 

#221 2011-04-22 08:12:06

scimonster
Community Moderator
Registered: 2010-06-13
Posts: 1000+

Re: Calling all math lovers and good programmers

Xenon keeps crashing!  mad

Offline

 

#222 2011-04-22 14:31:48

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Calling all math lovers and good programmers

scimonster wrote:

What I've done so far:
Adds numbers into 1 item
Adds ops
Adds brackets
Does the following multiple letter ops:
  sqrt
  abs (and ||)
  mod
  round
  sin
  cos
  tan
  atan
  asin
  acos

You may have a TI84 or not, but I think that the multi-letter operations should work only within parentheses.  That is, sin(5), not sin 5, sqrt(5), not sqrt 5, etc.  That will clear up any unclear operations like sin 5*5: sin(5)*6 or sin(5*6)?  The "sin()" part itself will work as a unit, so 5sin(5)+2 will report 5*sin(5)+2. 

As far as your list of operations goes, I don't see anything missing. 

I think we should also provide support for user defined variables, so an input that reads "define x" will create a variable named x, and setting a variable's value will be achieved by "x=8" (storing values can be handled by two parallel lists, one for names, one for values). 

Me- Awaiting deployment.

Offline

 

#223 2011-04-22 18:52:01

applejack
Scratcher
Registered: 2010-03-23
Posts: 100+

Re: Calling all math lovers and good programmers

hardmath told us not to get ahead of ourselves yet, should we in clude i ?

amcerbu wrote:

scimonster wrote:

What I've done so far:
Adds numbers into 1 item
Adds ops
Adds brackets
Does the following multiple letter ops:
  sqrt
  abs (and ||)
  mod
  round
  sin
  cos
  tan
  atan
  asin
  acos

You may have a TI84 or not, but I think that the multi-letter operations should work only within parentheses.  That is, sin(5), not sin 5, sqrt(5), not sqrt 5, etc.  That will clear up any unclear operations like sin 5*5: sin(5)*6 or sin(5*6)?  The "sin()" part itself will work as a unit, so 5sin(5)+2 will report 5*sin(5)+2. 

As far as your list of operations goes, I don't see anything missing. 

I think we should also provide support for user defined variables, so an input that reads "define x" will create a variable named x, and setting a variable's value will be achieved by "x=8" (storing values can be handled by two parallel lists, one for names, one for values). 

Me- Awaiting deployment.


http://i.imgur.com/zKzps.png
http://blocks.scratchr.org/API.php?action=onlineStatus&type=square&user=applejack -I'm http://blocks.scratchr.org/API.php?action=onlineStatus&type=text&user=applejack

Offline

 

#224 2011-04-22 21:17:02

amcerbu
Scratcher
Registered: 2009-07-21
Posts: 500+

Re: Calling all math lovers and good programmers

applejack wrote:

hardmath told us not to get ahead of ourselves yet, should we include i ?

I don't think we should.  The calculator would have to express things in terms of i, and it won't want to deal with anything imaginary.

Last edited by amcerbu (2011-04-22 21:38:10)

Offline

 

#225 2011-04-23 11:38:34

applejack
Scratcher
Registered: 2010-03-23
Posts: 100+

Re: Calling all math lovers and good programmers

Kay.  smile

amcerbu wrote:

applejack wrote:

hardmath told us not to get ahead of ourselves yet, should we include i ?

I don't think we should.  The calculator would have to express things in terms of i, and it won't want to deal with anything imaginary.


http://i.imgur.com/zKzps.png
http://blocks.scratchr.org/API.php?action=onlineStatus&type=square&user=applejack -I'm http://blocks.scratchr.org/API.php?action=onlineStatus&type=text&user=applejack

Offline

 

Board footer