Saturday, July 13, 2013

Hexadecimal to Decimal and Decimal to Hexadecimal Conversion


Hexadecimal to Decimal Conversion

In this post below, I have a simple example that can lead you to answer on converting manually from hexadecimal to decimal conversion. I have just drawn this into my whiteboard, so anyway, hope this can help you answer your questions on conversion.

Example problem is,




Convert hexadecimal value: 4AC to its decimal form.





Decimal to Hexadecimal Conversion

Example problem is,




Convert the decimal value: 65 (which is letter "A" in ASCII) to its decimal form.




So this means that the value of ASCII "A" or decimal 65 is equivalent to hexadecimal 41.

Hope this helps.


Monday, May 20, 2013

Geometry: How to determine if lines are parallel or perpendicular

So let say you have a lines in a graph,

to determine if these are perpendicular, they must have relevant values which the first line's slope must be the reciprocal of the other line intersecting the first line.

Below is an example of determining a parallel lines.

L1 = {-1, -2} and {1, 2}
L2 = {2, 0} and {0, 4}

To solve the slopes,

m1 = 2-(-2)/1- (-1)
      = 2+2/ 1+1
      = 4/2
      = 2

m2 = 4 - 0/ 0 - (-2)
      = 4/2
      = 2


since they are both identical then this lines are both parallel.

For perpendicular lines,


L1 = {0, -4} and {-1, -7}
L2 = {3, 0} and {-3, 2}


m1 = -7 - (-4)/ -1 -0
      = -7 + 4/ -1
      = -3/-1
      = 3

m2  = 2 - 0 /-3 - (3)
       = 2 / -6
       = - 1/3

so m1 and m2 slopes have the reciprocal values. No matter where do we start on measuring, still, perpinduclar lines will result to reciprocal values and perpendicular lines have an "angle of 90 degrees".


This page can be a great reference to look at http://www.purplemath.com/modules/slope2.htm

Calculus: Purpose of derivative

Below is a chat log that that is relevant to the derivative.


[5:46pm] chomping: guys, I have a question. I am using python here, and if I do, math.atan(0.38), this gives me 0.36314700994617627 which is in radians. Now, I am not sure if I'm right but is this correct,  f(x) = acrtan x  and f'(x) = 1/1+x^2. Now I tried to solve using f'(x) = 1/1+0.38^2 but I can't get the same result. What should be the proper way to push 0.38 to derivatives value
[5:46pm] w41 joined the chat room.
[5:46pm] chomping: any help?
[5:46pm] Karlo_: What does "solve using f'(x) = 1/1+0.38^2" mean?
[5:47pm] PigFlu: ...what is the actual assignmet?
[5:47pm] PigFlu: assignment*
[5:47pm] PigFlu: nvm
[5:47pm] Waynes1: in any case, f'(x) = 1/(1+x^2)
[5:47pm] chomping: Karlo_: I don't know if I understand correctly but the derivative is f'(x) = 1/1+x^2 == arctangent x
[5:48pm] chomping: so I'm trying to solve using the derivative but the result is different
[5:48pm] Karlo_: chomping: Yes, and for x = 0.38, f'(x) = 1/(1 + 0.38^2), as it should be.  So what's the problem?
[5:48pm] Karlo_: Solve WHAT, using the derivative?
[5:48pm] Waynes1: use parenthesis
[5:48pm] chomping: I'm using python, using math.atan(0.38) == 0.36314700994617627
[5:49pm] St_Marx joined the chat room.
[5:49pm] Karlo_: [And yes, Waynes1 is correct that you should use parens properly, but I'm still wondering what you're expecting your output to be.]
[5:49pm] Karlo_: Did you try typing  1/(1+0.38^2)  into Python?
[5:49pm] Vornicus: chomping: the derivative is
[5:49pm] Vornicus: uh, how do I put this... the derivative isn't the function.
[5:49pm] chomping: 1.0/(1.0 + (0.38**2)) = 0.8738203425375742
[5:49pm] chomping: did I make it wrong?
[5:50pm] Karlo_: I get 0.8738203425375742 using Lisp, also.  Looks like the right answer.
[5:50pm] Vornicus: The derivative tells you which direction the function is going.
[5:50pm] roxlu left the chat room.
[5:50pm] Vornicus: It's not going to tell you the value of the function at that point.
[5:50pm] chomping: Karlo_: why is that math.atan(0.38) has a different answer?
[5:50pm] Vornicus: because why would it?
[5:50pm] pwca: Vornicus is telling you, chomping.
[5:50pm] sir_matthew left the chat room. (Ping timeout: 252 seconds)
[5:50pm] chomping: math.atan(0.38) == 0.36314700994617627
[5:50pm] Vornicus: A function, and the function's derivative, often have surprisingly little to do with each other.
[5:50pm] chomping: and 1.0/(1.0 + (0.38**2)) = 0.8738203425375742
[5:50pm] Karlo_: Because math.atan(0.38) computes arctan(0.38), and the other thing is some OTHER function.
[5:51pm] pwca: atan(x) isn't 1/(1 + x^2)
[5:51pm] Karlo_: There's no reason to expect a function and its derivative to be equal.
[5:51pm] Vornicus: this is particularly true of inverses of elementary functions.
[5:51pm] Karlo_: If g(x) = x^2, then g'(x) = 2x, and you'll note that g(5) = 25 while g'(5) = 10.
[5:52pm] Zaba left the chat room. (Read error: Operation timed out)
[5:52pm] oriig joined the chat room.
[5:52pm] aslant__ joined the chat room.
[5:53pm] aslant_ left the chat room. (Ping timeout: 256 seconds)
[5:53pm] chomping: Vornicus: so what does it mean in my case where I solve for 0.38 in math.atan(0.38) ?
[5:53pm] Vornicus: So what it means is that you've misunderstood derivative, basically.
[5:53pm] Engen joined the chat room.
[5:53pm] Vornicus: The derivative only tells you the rate of change of the function.
[5:53pm] Vornicus: It doesn't tell you the actual value of the function.
[5:53pm] chomping: ahhh
[5:54pm] chomping: Vornicus: to be clear, 0.38 is actually the slope of a line where I wanted to get the angle using artangent, so by that means, I am wrong if i have to use the derivative not unless if there's a rate of change, am I right?
[5:54pm] Vornicus: If you want to calculate arctangent yourself (You don't), you'll have to use something better.
[5:55pm] chomping: what I mean is, only if there's a rate of change, then it's proper to use the derivative of arctangent?
[5:55pm] introom joined the chat room.
[5:55pm] chomping: not on the case I am trying to solve?
[5:55pm] Karlo_: chomping: You're confused on multiple levels.
[5:55pm] Vornicus: Geometrically: 0.38 in this case is the slope of a particular line.  arctangent(0.38) is the angle that line makes against the x axis.
[5:56pm] Vornicus: the /derivative/ of the arctangent tells you by what amount the angle will change, if the slope changes a very small amount.
[5:57pm] Vornicus: So, consider a laser aiming at something that's moving in a straight line: the arctangent will tell you which way the laser is pointing.  The derivative of the arctangent will tell you how fast you have to turn the laser.
[5:58pm] Vornicus: And I should have been in bed an hour ago.
[5:58pm] chomping: ahh thank you, so to be clarified, arctangent x = f'(x) = 1/1+x^2 <> math.atan(x) that I'm trying to do. So the latter has a different meaning to solve for.
[5:58pm] Karlo_: It sounds as if the 0.38 figure is itself the result of calculating a derivative.  If you need the angle rather than the slope, then you should indeed use an arctan here.  But there's probably no reason for you to be considering the derivative of arctan at all.
[5:58pm] chomping: thanks Karlo_
[5:58pm] Waynes1: Or a mountain analogy: The value of the function tells you at which height you are and the derivative tells you how fast it goes down.
[5:58pm] Zaba joined the chat room.
[5:59pm] chomping: Waynes1: thank you, that's really clear to me!
[5:59pm] chomping: makes sense to me.
[5:59pm] Vornicus: (my analogy is specific to the function in question)
[5:59pm] Vornicus: (technically, 'up', but)
[5:59pm] chomping: thanks for the help guys!



Another helpful tip that I found from mathforum.org at this link which I referred,


Date: 12 Jan 1995 14:11:43 -0500
From: Dr. Ken
Subject: Re: Help!

Hello there!

There are lots of reasons we'd want to take the derivative of
something.  First of all, let's say you're riding in your shiny 
new sports car and you have the best odometer in the world. It 
will tell you to the nearest thousandth of a mile (or something 
like that) how far you've gone. If you graphed what the odometer 
tells you as a function of time, so that time is on the x-axis and 
distance is on the y-axis, you could take the derivative of this 
function and figure out your speed for every point in your journey.  
So all the information about your speed and acceleration and
everything can be gotten from the odometer, as long as you know 
how to take derivatives.

Here's a question my calculus teacher once asked me: in cars, there's 
both an odometer and a speedometer. Essentially, the speedometer 
takes the derivative of the odometer information (before it gets to 
the odometer though; it's straight from the wheels). How does it do 
that?  It's been doing that since way before on-board computers 
happened to cars. So essentially, they've found a purely mechanical 
way to take derivatives. Neat stuff, worth researching.

The derivative is also quite an intuitive concept, I think.  Let's 
say you have a growth chart on your wall. If you're a human (which I 
believe you are) you'll probably have a couple of periods when you 
grew faster than at other times in your life. If the marks were made 
at regular intervals, they'd be more spread out in certain periods 
and more clustered together in others. So it's not hard to figure out 
from this chart that you grew faster in those growth spurt times than 
in the lull times. Well, how fast you grew is just the derivative 
with respect to time of how tall you were. So the derivative will be 
big sometimes, small sometimes, and once you hit 40 years old, it 
will be negative (some people say).

So these are a couple of real-life examples. Other examples that 
are based on integration (the inverse of differentiation) would 
include finding the volume of some objects, finding the area of 
some regions in a plane, and stuff like that. And trust me, if you 
go on and do some more in math, taking the derivative of functions 
will be SHEER BLISS compared with some of the more nasty stuff 
(which is more rewarding. Stick with math!).

So that's how I feel about derivatives.

Date: 12 Jan 1995 15:23:35 -0500
From: Dr. Elizabeth
Subject: Re: Help!

Hi Jenny!

One of the nicest things you can do with derivatives is to find out 
where the maximum value of a function is - which can be a very useful 
thing to know. The derivative of a function is its slope at any given 
point (actually it's the slope of the tangent line to the point, but 
even though a point can't have a slope, I always found it easier just 
to think of the derivative this way). At the highest point of a 
function (its maximum value), it's gone as far up as it's going to, 
and it's about to start heading back down. Its slope at this point, 
then, will be zero, since it isn't going up, and it isn't going down.  

Let's say you had a function and you wanted to know where, exactly, 
it would reach a maximum (I'll give you an example of why you might 
want to know this in a minute). Take the derivative of the function 
and set it equal to zero. Then solve for x or a or the number of 
feet of fence or the number of frogs or whatever it is that your 
independant variable happens to be.
  
Here's my example: I throw a ball straight up at a speed of 6 meters
per second somewhere where there's absolutely no air (no air 
resistance). When will it be at its highest point?

I can write the ball's height in an equation: the height at any 
time t will be the ball's upward velocity times the amount of time 
it's been going up (6m/sec times time, t) minus its gravitational 
acceleration downward times the amount of time it's been up there 
squared (10 m/sec/sec *that's the acceleration of gravity* times 
time squared, t^2).  

Leaving out the units so that the math is easier to see here:

   Height = 6t-10t^2.

If we take the derivative of this function, we have an equation for 
the slope of this function at any given time, t. The value of t for 
which this new equation is equal to zero is the same t at which the 
height of the ball will be a maximum.

Derivative of height = 6-20t = 0
                   6 = 20t
                   t = 6/20 second

The ball will reach its maximum height in 6/20 of a second.

Hope this helps! 
Elizabeth, a math doctor

Geometry: How to get the angle from a slope?


To get the angle from a slope,

First, you must need to identify the slope of a line.

To get the slope of a line, you need to use the formula dy/dx or

∆y/∆x as distance of y and distance of x.

That is,

m = y1-y2/x1-x2


To get the angle, you can use arctangent, the inverse of tan, as

tan -1 x = arctangent or arctan

so

angle = arctangent(m)

m = tangent(angle)

For example, in Python,


>>> math.atan(0.38)* 180/math.pi
20.80679101271123
>>> math.tan(20.80679101271123 * math.pi/180)
0.37999999999999995


math.atan and tan are in radians, so I convert them from radians to degrees or degrees to radians.



Saturday, May 18, 2013

Geometry: Slope of a Straight Line



To get the slope of a line, you can use the equation below



A good and perfect explanation of this can be check on this link http://www.purplemath.com/modules/slope.htm


Other's also use this way of method to explain it's coordinates.


where:
Ax  the x coordinate of point A
Ay  the y coordinate of point A
Bx  the x coordinate of point B
By  the y coordinate of point B

and for this one, you can check on this link http://www.mathopenref.com/coordslope.html


Additionally, if lines with vertical lines, slope is undefined or doesn't exist. And if lines is going horizontal, then slope will always be 0.

Example:

m = (5) - (-3)/ (4) - (4) = 8/0 which is undefined for points (4, 5) and (4, -3) or UNDEFINED SLOPE

and

m = (4) - (4) / (5) - (-3) = 0/8 = 0 for points/coordinates at (-3, 4) and (5, 4) or ZERO BASED SLOPE