... first of all, I think Paddle2See already made something like this.
you won't be able to do complex numbers at all probably unless you create some sort of complex number class... but if you handle the complex number data structure, I know a lot about complex numbers.
but if you don't do them, that's great... I still have another suggestion.
Include hyperbolic trig functions, and allow it to use radians... probably like a button you press to turn radians on or off. you just have to change how you do all your trig stuff by adding an if block and saying "sin( val ) " or "sin( pi / 180 * val )", and you really need to include pi as a global [static] variable...
and implementing factorial (could be tricky) but trickier would be the gamma function...
Offline
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
acosYou 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.
Yes, I already knew that. For the |-3| it would add
abs
(
-3
)
Also, "sin 3-7" is (sin(3)-7).
I hope it will check for parentheses after any multiple letter thing, and sqrt.
Edit:I don't have TI84.
NonDoubleEdit: Is "sin-1" taken as "asin" or "sin(-1)"?
Last edited by scimonster (2011-04-23 14:11:59)
Offline
scimonster wrote:
Is "sin-1" taken as "asin" or "sin(-1)"?
I think sin-1 should report sin(-1). asin is more elegant (and easier to check for) than sin-1, which contains both letters and numbers.
Offline
amcerbu wrote:
scimonster wrote:
Is "sin-1" taken as "asin" or "sin(-1)"?
I think sin-1 should report sin(-1). asin is more elegant (and easier to check for) than sin-1, which contains both letters and numbers.
OK, I'll remove those.
EDIT: Is it worth it to have arctangent become atan, natural log become ln, and square root become √?
Last edited by scimonster (2011-04-24 03:07:28)
Offline
Hi, I'm back! What did I miss?
Offline
Welcome back, Hardmath!
scimonster wrote:
amcerbu wrote:
scimonster wrote:
Is "sin-1" taken as "asin" or "sin(-1)"?
I think sin-1 should report sin(-1). asin is more elegant (and easier to check for) than sin-1, which contains both letters and numbers.
OK, I'll remove those.
EDIT: Is it worth it to have arctangent become atan, natural log become ln, and square root become √?
scimonster- I think that would just cloud the program. I don't think the user would want to write out "square root" anyway. It's really up to you, but I would say leave it to abbreviations. Of course, we could include a key to all of the operations in the project notes, but that will come later.
Offline
So, here's a list of operations/constants. I say we keep this list running, so people should definitely add whatever I forgot.
Constants:
pi
phi
e
Operations- note that commas cannot be removed from multi-argument expressions.
+, -, *, /,^
sqrt(x)
abs(x) (or |x|)
mod(x,y) or x%y- (in order of operations, comes before anything else.)
log(x,y)- y is base.
ln(x) (we may not need this if we have log(x) and constant e).
rand(x,y)- x and y are minimum, maximum respectively.
sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), possibly include sinh(x), cosh(x), tanh(x)?
round(x,y)- y is the power of 10 we round to.
Last edited by amcerbu (2011-04-25 22:15:09)
Offline
What did I miss?
Offline
amcerbu wrote:
Not much, we just discussed what the proper syntax for multi-letter operations would be. We decided that "sqrt 5" would confuse the program, so it will take "sqrt(5)" instead.
But it will interpret "sqrt 5" as "sqrt(5)" and "sqrt 5+5" as "(sqrt(5))+5)"
Last edited by scimonster (2011-04-25 15:02:09)
Offline
scimonster wrote:
amcerbu wrote:
Not much, we just discussed what the proper syntax for multi-letter operations would be. We decided that "sqrt 5" would confuse the program, so it will take "sqrt(5)" instead.
But it will interpret "sqrt 5" as "sqrt(5)" and "sqrt 5+5" as "(sqrt(5))+5)"
So how will it deal with "sqrt 5*5" ?
Offline
amcerbu wrote:
scimonster wrote:
amcerbu wrote:
Not much, we just discussed what the proper syntax for multi-letter operations would be. We decided that "sqrt 5" would confuse the program, so it will take "sqrt(5)" instead.
But it will interpret "sqrt 5" as "sqrt(5)" and "sqrt 5+5" as "(sqrt(5))+5)"
So how will it deal with "sqrt 5*5" ?
If I can pitch in, (sqrt(5)*5). Indices (including sqrt which is equivalent to ^0.5) take precedence over multiplication. With sqrt 5^5 it doesn't actually make a difference.
Offline
Taneb wrote:
amcerbu wrote:
scimonster wrote:
But it will interpret "sqrt 5" as "sqrt(5)" and "sqrt 5+5" as "(sqrt(5))+5)"So how will it deal with "sqrt 5*5" ?
If I can pitch in, (sqrt(5)*5). Indices (including sqrt which is equivalent to ^0.5) take precedence over multiplication. With sqrt 5^5 it doesn't actually make a difference.
If sqrt works differently from other functions, then it doesn't matter for 5^5 ...
Order does matter for things such as sin pi ^ 2, where it would make sense to normally interpret it as ( sin (pi) ) ^ 2. however, for something like atan x ^ 0.5, it would make more sense to interpret it as atan (x^0.5). For log a ^ b, I think that log (a^b) makes more sense.
Finally, are you going to only allow e^ x, or will you also include an exp[ x ] function?
Also, I am not sure which is the best way to interpret a^b^c
Offline
DarthPickley wrote:
Taneb wrote:
amcerbu wrote:
So how will it deal with "sqrt 5*5" ?If I can pitch in, (sqrt(5)*5). Indices (including sqrt which is equivalent to ^0.5) take precedence over multiplication. With sqrt 5^5 it doesn't actually make a difference.
If sqrt works differently from other functions, then it doesn't matter for 5^5 ...
Order does matter for things such as sin pi ^ 2, where it would make sense to normally interpret it as ( sin (pi) ) ^ 2. however, for something like atan x ^ 0.5, it would make more sense to interpret it as atan (x^0.5). For log a ^ b, I think that log (a^b) makes more sense.
Finally, are you going to only allow e^ x, or will you also include an exp[ x ] function?
Also, I am not sure which is the best way to interpret a^b^c
I am in favor of enclosing arguments for multi-letter expressions in parentheses always. See earlier post with list of expressions and constants.
About a^b^c, you evaluate from left to right, so (a^b)^c.
Offline
amcerbu wrote:
DarthPickley wrote:
Taneb wrote:
If I can pitch in, (sqrt(5)*5). Indices (including sqrt which is equivalent to ^0.5) take precedence over multiplication. With sqrt 5^5 it doesn't actually make a difference.
If sqrt works differently from other functions, then it doesn't matter for 5^5 ...
Order does matter for things such as sin pi ^ 2, where it would make sense to normally interpret it as ( sin (pi) ) ^ 2. however, for something like atan x ^ 0.5, it would make more sense to interpret it as atan (x^0.5). For log a ^ b, I think that log (a^b) makes more sense.
Finally, are you going to only allow e^ x, or will you also include an exp[ x ] function?
Also, I am not sure which is the best way to interpret a^b^cI am in favor of enclosing arguments for multi-letter expressions in parentheses always. See earlier post with list of expressions and constants.
About a^b^c, you evaluate from left to right, so (a^b)^c.
And so 15/3/5 is (15/3)/5. Always follow OOO.
No need for an exp(y) function.
EDIT:
amcerbu wrote:
scimonster wrote:
EDIT: Is it worth it to have arctangent become atan, natural log become ln, and square root become √?
scimonster- I think that would just cloud the program. I don't think the user would want to write out "square root" anyway. It's really up to you, but I would say leave it to abbreviations. Of course, we could include a key to all of the operations in the project notes, but that will come later.
amcerbu, you just made my life much easier in programming the setup engine. It should be done by tonight.
Last edited by scimonster (2011-04-25 23:45:11)
Offline
Time to remove all those redundant parts!
EDIT: Does (x%y) = ((x) mod (y))?
Last edited by scimonster (2011-04-26 00:10:33)
Offline
scimonster wrote:
Time to remove all those redundant parts!
EDIT: Does (x%y) = ((x) mod (y))?
Yeah, it might not need to be included though. It's used for modulo in Python. By the way, are the multi-argument operations I suggested earlier working out alright?
Offline
amcerbu wrote:
scimonster wrote:
Time to remove all those redundant parts!
EDIT: Does (x%y) = ((x) mod (y))?Yeah, it might not need to be included though. It's used for modulo in Python. By the way, are the multi-argument operations I suggested earlier working out alright?
I'll put it in anyways.
Where?
Everything from the () of () block is in; time to add the constants!
Last edited by scimonster (2011-04-26 00:27:09)
Offline
What is "pie"?
"pi*e" or an error?
Offline
scimonster wrote:
What is "pie"?
![]()
"pi*e" or an error?
I don't know... I guess (pi)(e). That'll have to be a little bonus, the apple crisp constant: 8.53973422. Remember it well.
Last edited by amcerbu (2011-04-26 00:30:40)
Offline
Here's the list from before. By multi-argument operations, I meant mod(x,y), rand(x,y), round(x,y). I was just wondering whether those were working alright.
EDIT: It may be that we don't want to include that, so modulo will just be x%y, round will only take one argument instead of 2. I'm not sure how we'll handle rand though.
Constants:
pi
phi
e
Operations- note that commas cannot be removed from multi-argument expressions.
+, -, *, /,^
sqrt(x)
abs(x) (or |x|)
mod(x,y) or x%y- (in order of operations, comes before anything else.)
log(x,y)- y is base.
ln(x) (we may not need this if we have log(x) and constant e).
rand(x,y)- x and y are minimum, maximum respectively.
sin(x), cos(x), tan(x), asin(x), acos(x), atan(x), possibly include sinh(x), cosh(x), tanh(x)?
round(x,y)- y is the power of 10 we round to.
Last edited by amcerbu (2011-04-26 00:51:50)
Offline
amcerbu wrote:
scimonster wrote:
What is "pie"?
![]()
"pi*e" or an error?
I don't know... I guess (pi)(e). That'll have to be a little bonus, the apple crisp constant: 8.53973422. Remember it well.
LOL.
Wikipedia isn't telling me the value of phi.
Why not "x mod y"?
Oh, I'll have to do "round (x) to (y)"
Offline
scimonster wrote:
amcerbu wrote:
scimonster wrote:
What is "pie"?
![]()
"pi*e" or an error?
I don't know... I guess (pi)(e). That'll have to be a little bonus, the apple crisp constant: 8.53973422. Remember it well.
LOL.
![]()
Wikipedia isn't telling me the value of phi.![]()
Why not "x mod y"?
Oh, I'll have to do "round (x) to (y)"
Phi is approx. 1.618... Also written as (1+sqrt 5)/2
I think x mod y might allow for some ambiguity, just like sqrt x+y. What would we do about 5 mod 2+3? Also, the operation would require spaces... Maybe we should only permit x%y.
Last edited by amcerbu (2011-04-26 00:58:10)
Offline