Home Forums Shops Trade Avatar Inbox Games Donate
  
Not Logged In
Reply
 
Thread Tools
Potironette Potironette is offline
petite fantaisiste
Default   #49  
No.... M isn't used for that--I just got lazy and put "M" for mew. I think my science teacher might have used it once, but I should have used μ, and maybe it was actually μ but written so it looked liked "M". I've never seen it written as "u" yet though.


I think I forgot the force balancing f_smax on the first diagram existed, woops. Thanks for the answer again! Doing the one with .5 makes it make more sense, I think.


Last edited by Potironette; 12-13-2016 at 12:10 AM.
Old Posted 12-13-2016, 12:01 AM Reply With Quote  
Default   #50   Coda Coda is offline
Developer
Glad to help! Looks like you've got a handle on it.
Games by Coda (updated 4/8/2025 - New game: Marianas Miner)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)

Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
Old Posted 12-13-2016, 12:38 AM Reply With Quote  
Potironette Potironette is offline
petite fantaisiste
Default   #51  
What's the difference between Work and Kinetic Energy in physics?

I get that Work is Force times distance. Kinetic Energy is somehow mass in motion? (Not really sure what KE is).

I learned today that Net Work was somehow equal to final Kinetic Energy, but I'm not sure how that works either.


Last edited by Potironette; 12-15-2016 at 12:05 AM.
Old Posted 12-14-2016, 11:57 PM Reply With Quote  
Default   #52   Coda Coda is offline
Developer
You're not wrong to find the two concepts confusing. They're measured in the same units, and they measure different aspects of the same thing.

The short version is that energy is the ability to do work. In order to do X joules of work, you have to have X joules of energy. Kinetic energy is always positive. (You can see this in the math -- the velocity is squared, which means if you had a negative velocity it would still end up as a positive answer.)

Conversely, work is a measurement of how much energy is transferred. It represents a net change in kinetic energy. Saying "final" kinetic energy is only true if the initial kinetic energy was zero. It could have already been moving and ended up moving faster, or it could have been slowing down instead of speeding up (though in that case, the work is negative, which means the force was applied in the opposite direction of motion; equivalently, it means that energy was taken away).

The reason you have to say "net work" is because you might be dealing with multiple forces. For example, if there's a box sitting on the floor, and you push it, you did positive work on the box, because you applied a force over a distance. But the box isn't moving at the end, so its kinetic energy before and after is zero, so the net work must also be zero. The resolution to this is that friction was performing negative work on the box -- an opposite force over the same amount of time.
Games by Coda (updated 4/8/2025 - New game: Marianas Miner)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)

Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
Old Posted 12-15-2016, 01:32 AM Reply With Quote  
Potironette Potironette is offline
petite fantaisiste
Default   #53  
Thanks for answering!

So..
Energy is the ability to do work, and this is measured in Joules (Nm)
Kinetic energy is one form of energy (the other being potential energy). And this always positive, as KE = 1/2 * mv^2, and the only variable that can be negative is v, but v is squared so Kinetic energy is always positive.

What does "transfer of energy" mean..?

In measuring the "transfer of energy," work is what measures the difference between the final state of kinetic energy from the initial state of kinetic energy as KE_f - KE_i. If KE_f is greater (by having greater speed, v), then work is positive because energy was gained through the "transfer." If KE_f is the same as KE_i (by having same speed, v), then no work has been done because no energy was lost or gained. If KE_f is less than KE_i (by having slower speed, v), then negative work was done because energy was lost in the "transfer."

Is "transfer of energy" just related to the speed of an object and thus it is measured by comparing the final state of kinetic energy to the initial state of kinetic energy?

Work itself measures kinetic energy focusing on how one force acts with a distance, or on how one force changes an object from one speed to the next (or does this have nothing to do with speed?) while net work measures how multiple forces are acting with distances...and that can be measured too from the difference between KE_f and KE_i?


Old Posted 12-15-2016, 01:58 AM Reply With Quote  
Default   #54   Coda Coda is offline
Developer
There are way more kinds of energy than just kinetic and potential. Electrical energy can do work too (motors!) and heat is a form of energy that isn't doing work. But yes, for these basic mechanics questions, kinetic and potential are the only ones you're going to be concerned with.

"Transfer of energy" isn't jargon; it's not a piece of scientific vocabulary that always has to be used a certain way or you're wrong. When I say that, I really just mean that energy is moving from one place to another, or from one state to another. (Converting potential energy to kinetic is work, done by the force of gravity.)

It sounds like you've basically got everything straight here.
Games by Coda (updated 4/8/2025 - New game: Marianas Miner)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)

Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
Old Posted 12-15-2016, 02:17 AM Reply With Quote  
Potironette Potironette is offline
petite fantaisiste
Default   #55  
Quote:
"Transfer of energy" isn't jargon; it's not a piece of scientific vocabulary that always has to be used a certain way or you're wrong. When I say that, I really just mean that energy is moving from one place to another, or from one state to another. (Converting potential energy to kinetic is work, done by the force of gravity.)
Ohh, okay. I wasn't too sure what transferring energy referred to ^^;;.


I'm doing homework again, and I'm stuck on a question that reads: "A 2.1E3 kg car starts from rest at the top of a driveway that is sloped at the angle of 20.0 degrees with the horizontal. An average friction force of 4E3 N impedes the car’s motion so that the car’s speed at the bottom of the driveway is 3.8 m/s. What is the length of the driveway?"

I actually did find how to solve for my homework problems here,
but I don't really understand what I'm supposed to be thinking, and I don't understand how or why I'm meant to relate net force to kinetic friction...I think I just don't understand what there is to understand about work and kinetic energy :/


Old Posted 12-15-2016, 02:28 AM Reply With Quote  
Default   #56   Coda Coda is offline
Developer
So... the car is accelerating down the hill, right? Its acceleration is the result of the sum of all forces acting on it. You know that gravity is pulling it downward, and you can calculate how much force it exerts in the direction of motion. You know how much force friction is applying in the opposite of the direction of motion (which saves you the effort of calculating it, since they didn't give you the coefficient of sliding friction). That means you can find the net force causing it to accelerate.

Once you know the net force, you can find the actual rate of acceleration.

You know the car's velocity at two points in time (one of which is v=0 at time=0). That combined with the acceleration will allow you to determine how long it takes the car to get up to that speed.

Once you know the time, you can plug it into the whole position equation, which you now have all the variables for, and find out where the car is after that amount of time.
Games by Coda (updated 4/8/2025 - New game: Marianas Miner)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)

Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
Old Posted 12-15-2016, 02:51 AM Reply With Quote  
Potironette Potironette is offline
petite fantaisiste
Default   #57  
m = 2.1 * 10^3 kg
angle = 20.0 degrees
F_f = 4.0 * 10^3 N
v_f = 3.8 m/s

F_g = mg
F_g = (2.1 * 10^3 kg) * 9.81 m/s^2 = 20601 N = 2.1 * 10^4 N


F_N = cos(20.0 degrees) * F_g
F_N = cos(20.0 degrees) * (2.1 * 10^4 N)
F_N = 19733.5 N = 2.0 * 10 ^4 N
don't need this because I'm not calculating for friction related things, I think.

F_x' = sin(20.0 degrees) * F_g
F_x' = sin(20.0 degrees) * (2.1 * 10^4 N)
F_x' = 7182.42 N = 7200 N

F_net = F_x' - F_f
F_net = 7200 N - 4.0 * 10^3 N = 3200 N

F_net = ma
F_net/m = a
3200 N / (2.1 * 10^3 kg) = a
a = 1.5 m/s^2

a = v/t
t = v/a
t = 3.8 m/s / 1.5 m/s^2
t = 2.5 s

d = d_i + v_i*t + .5at^2
d = .5at^2
d = .5(1.5 m/s^2)*2.5^2
d = 4.7 m


This way is simpler :o! So, ultimately I can use the position equation because I can solve for the acceleration, initial velocity and time? Is this something that I just need to do a lot of problems for before recognizing a sort of pattern :/ ?

Thanks for helping me with this!


Old Posted 12-15-2016, 03:22 AM Reply With Quote  
Default   #58   Coda Coda is offline
Developer
Quote:
Originally Posted by Potironette View Post
This way is simpler :o! So, ultimately I can use the position equation because I can solve for the acceleration, initial velocity and time? Is this something that I just need to do a lot of problems for before recognizing a sort of pattern :/ ?

Thanks for helping me with this!
Pretty much, yep. There are two general strategies to the pattern:

1. Look at what you're trying to figure out and identify what information you lack to determine it, then figure out how to get that information.
2. Look at the things you know and see what you can figure out using that to try to manipulate it into a form you know how to solve.

I saw that I was looking for a distance, so I knew that either I'd be using the position function, or I'd be using the work formula, since both of those have distance as a term.

In this particular case, either of those choices would work out just fine. It would be good for you to figure out how to solve it using work -- it's actually several fewer steps to do it that way; I'm just used to solving the acceleration route because it doesn't involve mass, and 2D video game physics don't care much about mass.

Happy to help!
Games by Coda (updated 4/8/2025 - New game: Marianas Miner)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)

Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
Old Posted 12-15-2016, 11:36 AM Reply With Quote  
Potironette Potironette is offline
petite fantaisiste
Default   #59  
What's the difference between text/javascript and application/javascript?
I was trying to figure out what the canvas thing was and mozilla showed me both in their examples here: https://developer.mozilla.org/en-US/...al/Basic_usage.

Uh, I don't know anything about javascript and mostly nill about html--I was actually trying to make a moveable character after I bumped across this (http://www.williammalone.com/article...e-character/1/) while internet surfing x'D. After I couldn't get it to work, I figured I might as well try to figure out what this "canvas" thing was...and then there was the whole text/javascript and application/javascript difference.

From what I gathered online it seems like there really isn't a difference except sometimes the application one doesn't work..?


Old Posted 01-02-2017, 03:54 AM Reply With Quote  
Default   #60   Coda Coda is offline
Developer
Heh. What an interesting question.

Use "text/javascript".

The story goes that "application/javascript" was introduced in 2006 in an attempt to standardize the MIME types of executable content, and "text/javascript" was deprecated. Most browsers supported it right away because they didn't pay a whole lot of attention to the MIME type of scripts, because they only supported Javascript anyway. Mozilla picked up the change and updated all of their examples to match it, because that's what the standards said to do.

Unfortunately for the standards committee, Internet Explorer didn't pick up support for it until 2011. (IE had support for other scripting languages in the browser, most notably VBScript.)

Five years is a LONG FREAKING TIME on the Internet, and when one of the most well-known browsers in the world doesn't support something, that basically means you can't use it. And by then, pretty much everyone but standards purists had forgotten about "application/javascript". As a result, the HTML5 standard requires support for "text/javascript". It has this to say:

Quote:
Originally Posted by HTML5 spec
Note: The term "JavaScript" is used to refer to ECMA262, rather than the official term ECMAScript, since the term JavaScript is more widely known. Similarly, the MIME type used to refer to JavaScript in this specification is text/javascript, since that is the most commonly used type, despite it being an officially obsoleted type according to RFC 4329.
EDIT: As for <canvas> itself, I'm pretty good with it if you need any help. Gravity Runner (in the thread linked in my sig) is canvas-based.
Games by Coda (updated 4/8/2025 - New game: Marianas Miner)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)

Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
Old Posted 01-03-2017, 01:22 PM Reply With Quote  
Potironette Potironette is offline
petite fantaisiste
Default   #61  
Oh, wow. So application/javascript has a history :o
Thanks for the answer!

How do I use images from my computer on canvas instead of drawing boxes and things with javascript? Also, based on the Mozilla tutorial, I keep using: <body onload="aasdf();">
What's something else I can do? Do I just put onload somewhere else somehow..?


Old Posted 01-03-2017, 11:12 PM Reply With Quote  
Default   #62   Coda Coda is offline
Developer
Using the "onload" attribute like that is old-school Javascript and while it's still supported it's not recommended because it has a LOT of limitations.

<script> tags get executed immediately, as soon as they're encountered by the browser, before the rest of the page is allowed to load. This is true even if the script has to be loaded from another URL, in contrast to CSS files in a <link> attribute, which are loaded in the background.

The "load" event (which is what causes the "onload" attribute to execute) happens when all content on the page is finished loading. If you don't actually NEED all of the content on the page to have finished loading, you can just put your <script> tag near the bottom of the file and all of the document above it (but not necessarily CSS files or images) is guaranteed to already be ready.

If you DO need to wait for the "load" event (for example, if you want to work with image files, like you described) then the recommended way to do it is like this:

Code:
document.body.addEventListener('load', aasdf);
Notice that there's no () on "aasdf" there; this is intentional -- you aren't invoking the function; you're passing the function AS AN OBJECT to the addEventListener method, which will invoke it when the "load" event is triggered.

As for actually drawing images, it's not too hard. Put the image you want in an <img> tag on the page (you can hide it with CSS if you want), grab it from the page with "document.getElementById", and draw it to the canvas using "drawImage".

The code might look something like this:

Code:
<img src='example.png' id='exampleImage' />
<canvas id='workCanvas' />
<script type='text/javascript'>
function startup() {
  var context = document.getElementById('workCanvas').getContext('2d');
  var imgData = document.getElementById('exampleImage');
  context.drawImage(imgData, 10, 10);
}
document.body.addEventListener('load', startup);
</script>
Games by Coda (updated 4/8/2025 - New game: Marianas Miner)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)

Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
Old Posted 01-03-2017, 11:28 PM Reply With Quote  
Potironette Potironette is offline
petite fantaisiste
Default   #63  
Thanks for the detailed answer and especially the examples!


Why is it that with
Code:
document.body.addEventListener('load', aasdf);
nothing shows up? Although, it does show up if I replace "document.body" with "window"?

Also, what is context? And what does something.somethingElse() mean? (as in document.getElementById('workCanvas') and context.drawImage(imgData, 10, 10)
Actually, what's a period?

..And what's loading?


Old Posted 01-04-2017, 05:47 AM Reply With Quote  
Default   #64   Coda Coda is offline
Developer
Doing some research... It looks like document.body.onload is a very old function that's only retained for compatibility, and it was never updated to the new addEventListener-based mechanisms. (I had assumed that it followed the upgrade path that everything else did.) Use "window" because that's supported.

Loading is the process of downloading the content and converting it into internal structures that the browser can use to render on the screen. The "load" event on the "window" object is triggered when everything on the page -- the page itself, images, stylesheets, and scripts -- have finished this process. <img> tags have a "load" event too, so you can specifically respond to a single image finishing its load process; this is especially useful when you're adding new images after the page is loaded.




In general, a "context" is a fairly nebulous concept in computer science. One thing that various uses of the word "context" have in common is that you have an object or handle that allows you to operate on a single instance of some resource. (It was hard for me to write that sentence; it's the kind of thing you just sort of treat as jargon until you start picking up an intuition for it.)

In this specific case, you're looking at a 2D rendering context. It's an object that gives you a bunch of functions to do stuff with the canvas.




I'm not sure I'm the right person to talk to about periods; I'm pretty sure you have more experience in that regard than I do. A dot, on the other hand, is a member accessor. (Some languages use an arrow -> instead.) "x.y" means that x is an object, and y is one of the things stored in that object or one of the methods defined on that object. In those examples, "getElementById" is a function defined on the "document" object, and "drawImage" is a function defined on the "context" object.

I cannot underemphasize just how fundamental this concept is to modern software development. I've been in the industry long enough to remember trying to write code WITHOUT objects, and it is VERY difficult to keep things organized without them. (I also remember trying to write code without functions. Those were the dark ages.)

One bit of jargon: A "method" (sometimes "member function") is a specific kind of function. When an object contains a method, that method knows what object it belongs to when you call it. In Javascript, if you call "x.y()" then inside y, the special variable "this" is x. If z is another object of the same type as x, z.y() is the same function but "this" means z inside.
Games by Coda (updated 4/8/2025 - New game: Marianas Miner)
Art by Coda (updated 8/25/2022 - beatBitten and All-Nighter Simulator)

Mega Man: The Light of Will (Mega Man / Green Lantern crossover: In the lead-up to the events of Mega Man 2, Dr. Wily has discovered emotional light technology. How will his creations change how humankind thinks about artificial intelligence? Sadly abandoned. Sufficient Velocity x-post)
Old Posted 01-04-2017, 01:18 PM Reply With Quote  
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All content is copyright © 2010 - 2025 Trisphee.com
FAQ | E-Mail | Terms of Service | Privacy Policy | Forum Rules
Twitter | Facebook | Tumblr
Return to top
Powered by vBulletin®