|
Malcolm Smart wrote: We've got distance = speed / time
that's a new kind of physics to me: the shorter you travel the farther you go?
as one of my professors repeated over and over: check the dimensions (units must match
on both sides).
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
OK - we've now got (after punching him repeatedly for using a made up formula....)
x = unknown time
total distance = (speed*time falling) + (speed*time running)
500 = 25x + 4(41-x) //41 - total time, x = time spent falling
500 = 25x + 164 - 4x
336 = 21x
x = 16.
25 * 16 = 400 - cool!!!
Thanks for not giving the answer - made us both think, and to realise something fundamental was wrong - distance = speed * time - doh.
I'll stick to C#, Higher Grade GCSE isn't my thing... )
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
Malcolm Smart wrote: Thanks for not giving the answer
You're welcome, always happy to help ... a little.
Malcolm Smart wrote: I'd stamp on it.
Malcolm Smart wrote: after punching him repeatedly
Please keep violence against kids and animals down to the necessary levels.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: say x = horizontal distance to reach cliff
say y = height of cliff
then total distance = x+y = 500 m
and total time = horizontal time + vertical time = 41 sec
so write down these times as an expression in x and y, you get a system of two
linear equations with two variables, that easily gets solved.
And indeed x=100, y=400 m
Hmmm, I have an Algebra test to administer next week, and I might just throw this at my students :->
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
Luc Pattyn wrote: BTW: real lemmings would follow a parabola, with an increasing vertical speed due to
gravity, until air friction would stop the vertical acceleration...
For something as small as a lemming terminal velocity would be reached very quickly so a constant linear velocity isn't a bad approximation.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
That would depend on the fur condition, hence the season.
Anyway, initially it would not be 25m/s so the real cliff would not be as tall.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: That would depend on the fur condition, hence the season.
Not much, even hairless they'd have a very low terminal velocity due to their low mass. The exact value might change slightly but that it would be very slow would remain a constant.
Luc Pattyn wrote: Anyway, initially it would not be 25m/s so the real cliff would not be as tall.
True, but with an initial acceleration of 9.8m/s/s, and the drag resulting in something similar (in appearance at least) to an exponential approach terminal velocity would be reached in 3ish seconds, with >90% of the fall near terminal velocity the initial conditions will have a fairly small impact on the result.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
Malcolm Smart wrote: The whole distance travelled is 500m. The time taken = 41seconds. How tall is the cliff?
Pretty damn tall :->
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
and it won't be just lemmings going over it if he ever gives me the wrong formula to work with again...... (perhaps I should have known better... )
"More functions should disregard input values and just return 12. It would make life easier." - comment posted on WTF
"This time yesterday, I still had 24 hours to meet the deadline I've just missed today."
|
|
|
|
|
First rule of debugging: don't trust anything or anyone.
Luc Pattyn [Forum Guidelines] [My Articles]
this months tips:
- use PRE tags to preserve formatting when showing multi-line code snippets
- before you ask a question here, search CodeProject, then Google
|
|
|
|
|
Luc Pattyn wrote: First rule of debugging: don't trust anything or anyone
Good point
"Find it your bloody self - immediately!" - Dave Kreskowiak
|
|
|
|
|
at least the debugger! Especially if there is a method in the Watch window that has side effects
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
As a general policy, members on this site do not respond to questions that are obviously homework. You should also assume that your instructor visits this site and has read your post. If he hands out unique assignments, you may need to change your user name to DeadMeat.
|
|
|
|
|
Hello all;
I'm currently working on encryption algorithm for small embedded systems.....I had selected a combination of RSA and Blowfish.....where RSA is used for the session key encryption...
Could any body suggest a method of transferring the public keys to the recipients with authentication without using the CA certification or PKI....as its dealing with embedded systems and having a third party to monitor the public key transfer is a major area of concern..
Any help in this regard will be greatly appreciated..
Thanking you'll in advance..
sc_emb
sc_emb
|
|
|
|
|
Be your own CA and install your public master key as trusted on the embedded system. Then the embedded system can trust all certificates signed by your master private key. Much the same as IE - it comes with a whole lot of certificates pre-installed from CAs that Microsoft has decided that you should trust.
If you don't use assymetric encryption for authentication you have to save some secret key in each device that could be vulnerable to detection.
Of course it all depends on what you are securing, if the embedded system is a nuclear detonation device or if failure of the system could otherwise lead to mass destruction, then this advice may not be applicable.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."
|
|
|
|
|
Perhaps I’m just going over semantics here but...are not public keys supposed to be public? The public key for your device can be public. Your device needs the public keys of authorized senders. And perhaps its own RSA key pair if it needs to say much in return.
In the following E(key, msg) is RSA encryption of msg with public key and D(key, msg) is RSA decryption using public key. E’() and D’() are the same except they use the private RSA key.
msg = D’(key, E(key, msg))
Alice: (plain text) I am Alice, an authorized sender.
Device: Oh? Prove it. Here is a time stamp...
Alice sends D’(keyAlice, Oct 9 2007 2228)
Note – Alice uses her private DEcryption key here.
(Device computes E(keyAlice, above message. All is okay.)
Note – Device encrypts to decrypt. I know it sounds strange.
Alice sends E(deviceKey, long random Blowfish key) + Blowfish encrypted message using the just sent key.
Device recovers Blowfish key with D’(deviceKey, key part of prior message)
The point is simple. The device needs only the public keys of trusted senders. If you need a CA for that then you need a CA.
You might find that Twofish is easier to implement. In particular you do not need over 4000 bytes of pi. And a place to keep them for the next encryption. But if you have a hard drive that should not be a problem. On a machine large enough to be reasonable to do Twofish I would hardcode q0 & q1 and generate a table of already permuted MDS stuff on the fly. I.e. 512 bytes of hard coded constants + 4096 bytes of table generated as part of your key setup.
Twofish ain’t that complex if I can implement the thing in both x86 and ARM assembly. I’ll do it for the Z80 or a PIC with several hundred bytes of RAM if someone will pay me. I bought Schneier’s book “used.” It made that nice cracking sound when I first opened it. My overall comments on Twofish: it appears more than a little over designed. And you don’t need 3 different encode / decode procedures for different key lengths.
. . . .
Oh wait. After writing the above I just reread your original message. Apparently you have multiple devices needing public keys.
You can only allow trusted public keys into your system. Start with your public key. Your machines trust you. Only you or someone you delegate may enter new authorized users. In effect YOU are the CA.
Don’t forget about physical access and how that can compromise your devices.
-Peter
|
|
|
|
|
i have a mathematical function,example x^2+sin(x),but it is String.i want it is mathematical function,it can return value float
leo
|
|
|
|
|
nta_3886 wrote: i want it is mathematical function,it can return value float
Ok.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
use a stack to convert the formula into Reverse Polish Notation (RPN). Then evaluate the RPN version. You can find many examples of how to do both steps of this via google.
--
If you view money as inherently evil, I view it as my duty to assist in making you more virtuous.
|
|
|
|
|
dan neely wrote: use a stack to convert the formula into Reverse Polish Notation (RPN). Then evaluate the RPN version. You can find many examples of how to do both steps of this via google.
Semi-on-topic... I just found my code for this from Pascal class back in the 80's. I used it on my first job to build an RPN based spreadsheet program in RPG II.
_________________________
Asu no koto o ieba, tenjo de nezumi ga warau.
Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)
|
|
|
|
|
a lot of work
Russell
|
|
|
|
|
If you are using the .net Framework then you can compile that into a method in a temporary assembly and execute it as normal code.
I'm sure you can find a sample about that in the WWW.
-^-^-^-^-^-
no risk no funk ................... please vote ------>
|
|
|
|
|
|
If you are using Rexx then
interpret say "string"
Except you first need to write sin(x) and other functions you use in Rexx. You also need to use Rexx rules for syntax.
Rexx can compile and execute on the fly.
With just a little more detail in dos one might type
rexx math 1.2*4.7
5.64 prints
The file math.cmd contains
/* execute incomming statement */
numeric digits 40
arg cmd
interpret say cmd
It's been a while but saving x to a environment variable or some such is not that hard.
My 40 digit ln() in ln.cmd is
/* ln(x) */
numeric digits 40
arg x
/* prescale to put x into reasonable range */
xp = 0
if x > 2 then do until x < 2
xp = xp + 1
x = x / 2
end
/* now that x <=2 compute ln(x)
method from Abramowitz etal section 4.1.39
ln(2) to 40 places takes 26 loops */
z = x-1
val = 0
do t = 26 to 1 by -1
t2z = t*t*z
val = t2z / (t+t+val+1)
val = t2z / (t+t+val)
end
val = z / (val+1)
/* account for prescale */
if xp = 0 then return val
return (const(ln2)*xp) + val
|
|
|
|
|
Hello,
Suppose that we have a NxN square filled with letters. Which algorithm is the best to find any words starting with NiNj and continue from the starting point through adjacent squares (left-right-cross) where the word is in any length L?
Thanks and best regards..
.:: Something is Wrong ::.
|
|
|
|