SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 08:46 PM |
local slope="2/5"; local point=Vector3.new(2,3);
--seperating the slope local deno=tonumber(slope:sub(slope:find("/")+1)); local numo=tonumber(slope:sub(1,slope:find("/")-1)); local deci_slope=loadstring("return " .. slope)(); if numo and deno and deci_slope then --point-slope local ps=(point.y>0 and "y-" .. point.y or point.y<0 and "y+" .. (-1*point.y) or "y") .. "=" .. slope .. "(x" .. (point.x>0 and "-" .. point.x or point.x<0 and "+" .. (-1*point.x) or "") .. ")"; --slope-intercept local b=point.y-(point.x*deci_slope); local si="y=" .. slope .. "x" .. (b>0 and "+" .. b or b<0 and "-" .. (-1*b) or ""); --standard form local x,y,c; if (deci_slope*point.x)%1==0 and deci_slope%1==0 then x=deci_slope .. "x"; y="y"; c=point.y+(point.x*deci_slope); else x=(deci_slope*deno) .. "x"; y=deno .. "y"; c=(point.y*deno)+(point.x*deci_slope*deno); end local standard=x .. "+" .. y .. "=" .. c; print(ps); print(si); print(standard); end
All it should do is take the slope and a point then put it in point-slope, slope-intercept and standard form ( being that that's the stupid algebra II homework I got today :/ )
But I'd like it if someone could double check my math ( mostly on the standard form one ) |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 12 Sep 2011 08:48 PM |
SDuuke, I'm sorry.No ones probably gonna help you XD
I'll guess I'll try.To me this script feels like japense but I'm just taking a guess... The second line of the variable where's the 3rd Vector3 number? I failed XD |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 08:51 PM |
| There's such thing as a Vector2. The script runs, I just want to make sure that I did my math right. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Sep 2011 08:52 PM |
Your code is very messy o.e.
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
McDeviant
|
  |
| Joined: 21 May 2009 |
| Total Posts: 88 |
|
|
| 12 Sep 2011 08:53 PM |
| Good job.. Idk what much about scripting but that looks like it should work |
|
|
| Report Abuse |
|
|
GoldenUrg
|
  |
| Joined: 23 Aug 2009 |
| Total Posts: 6428 |
|
|
| 12 Sep 2011 08:54 PM |
You might need more tolerance on the whole number checking.
It'd probably be easier to check the outputs directly rather than the script itself.
|
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 08:54 PM |
| No it isn't, you just think it is. You can easily see where I calculated the different things by just looking at the comments and then I made sure that all my variables made sense ( deno and numo being short for denominator and numerator ) |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Sep 2011 08:58 PM |
Well, it doesn't include spaces after and equals sign, although, I never use spaces either, and most people call my code messy :3
Also, why do you put in semi-colons?
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 08:59 PM |
@golden
As you can see, I'm too tired from football to make proper decisions, thanks all that was off was I had to multiply the x for the standard form by -1, but does that seem correct just how I tried to calculate the standard form to be only whole numbers? |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 09:06 PM |
| Keeps the code more organized by knowing exactly where it ends and also helps it be a bit more efficent. Also force of habit after learning php. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Sep 2011 09:07 PM |
Thought you picked it up off Java. Java is about 10x more confusing and more difficult to learn than Lua.
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
|
| 12 Sep 2011 09:08 PM |
| Eyyy! I'm doing Algebra II too! Not very good at it though. This is the full script, yes? |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 09:10 PM |
@nate I'm still learning java, computer science.
@dark yes it is, only change being that on the two lines where it declares the x for the standard form I added a "-1*" at the beggining and it seems to be working. |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 09:12 PM |
| Now I'm just wanting to know if there's a better way to do it and/or if I calculated all the stuff right or if there's some error in the way I did it. |
|
|
| Report Abuse |
|
|
|
| 12 Sep 2011 09:13 PM |
I feel like you're me. I just bame back from a game(We lost 14 - 0, but I made last game tackle which makes me feel good), and of all the days my teachers decide to pile on the homework.
Anyways, I'm not sure what's wrong. My minds a little fuzzy though. I'm gonna crash and finish my on the bus or somethin' tomarrow. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Sep 2011 09:14 PM |
Computer science? That a course you take? My school has nothing related to any programming language. I might take a class on it outside of school, but I just got a book for now.
I was comparing Java to Lua, and they only have some similarities.
System.out.lnprint("") kind of struck me of annoying, as to the common print.
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 09:15 PM |
"We lost"
Nope, I'm 3-0 :P
But I'm kickoff and backside reciever then second CB. |
|
|
| Report Abuse |
|
|
|
| 12 Sep 2011 09:17 PM |
| I'm on kickoff this year although I was on both special teams last year. I'm secondary linebacker(I play all of them. Inside, outside, and middle), but coaches were proud of that last tackel so they were hinting as putting me in as 1st string since the first string currently doesn't know anything but can tackle and run. And on offense i'm left-tackle, 2nd string. |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 09:18 PM |
| But seriously, can you give me an answer to the original question before I start using it for my homework? |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Sep 2011 09:20 PM |
What class are you taking that'll accept code for homework?
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
SDuke524
|
  |
| Joined: 29 Jul 2008 |
| Total Posts: 6267 |
|
|
| 12 Sep 2011 09:20 PM |
| I'm not giving the code, I'm just copying down the answers. |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Sep 2011 09:21 PM |
Ah, alright.
I wish my school had a computer science class that would teach some programming languages, or language.
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 12 Sep 2011 09:30 PM |
@SDuke
Why don't you just print and find it out on the output
I don't play football.I don't play sports that risk my body getting hurt.I play
Baseball:Pitcher, shortstop Basketball: Pointguard, center wrestling:Did for one year fencing:Did for like 2 seasons.Intermediete
|
|
|
| Report Abuse |
|
|
theopfor
|
  |
| Joined: 08 Feb 2011 |
| Total Posts: 11003 |
|
|
| 12 Sep 2011 09:34 PM |
^I play ROBLOX!
@nate Yeah my school had a robot programming subject in an engineering class. I was so mad that I was in that class for three trimesters so excited about robots to find out we use RoboPro a drag and drop program!
"Death to lazy builders. Remove the CFrame tools. Command bar all the way"~pauljkl "If it tastes bad, it's probably healthy" -RadioactiveWafflez |
|
|
| Report Abuse |
|
|
nate890
|
  |
| Joined: 22 Nov 2008 |
| Total Posts: 21686 |
|
|
| 12 Sep 2011 09:35 PM |
I didn't bother trying out for football. If they have tennis, I might join, but I doubt it, tennis bores me, but I'm fairly good at it. I might join soccer, along with hockey, if they have hockey at the school still.
Anyway, back to the Java book.
<'+1 Post. Ujelly?'> |
|
|
| Report Abuse |
|
|