How to calculate current velocity using Euler integration [closed] - physics

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I want to know if I convert formula correctly. I'm not sure of that.
I know:
force = mass * acceleration
acceleration = (Velocity - previousVelocity) / deltaTime
acceleration = force / mass
So:
(Velocity - previousVelocity) / deltaTime = Force / Mass
If I know the force to apply , the mass , deltaTime and previousVelocity, to convert it in the new velocity for a euler integration? This formula is correct ?:
Velocity = (Force / mass * deltaTime) + previousVelocity
I feel like something is wrong or missing, I need the real formula.
thanks a lot!

What you've written is Forward Euler on dv/dt = f(t) (with m=1) ... i.e. v(n+1) = v(n) + f(n) * dt.

Related

nCr mod 10^9 + 7 for n<=10^9 and r <=1000 [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 4 years ago.
Improve this question
This may have been asked before but none of the answers I saw worked for me. I tried Lucas Theorem,Fermat's theorem but none of them worked. Is there an efficient way to find the value of:
nCr mod 10^9+7 where n<=10^9 and r<=1000
Any help will be very useful
n is large while r is small, you are better off compute nCr by n(n-1)...(n-r+1)/(1*2*...*r)
You may need to find multiplicate inverse of 1, 2, ... r mod 10^9+7

Calculus with Constants [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
An electric current, I, in amps, is given by
I=cos(wt)+√(8)sin(wt),
where w≠0 is a constant. What are the maximum and minimum values of I?
I have tried finding the derivative, but after that, I do not know how to solve for 0 because of the constant w.
Well David,you can convert this function into one trigonometric function by multiplying and dividing it by
√(1^2 + 8) i.e, 3. So your function becomes like this
I = 3*(1/3 cos(wt) + √8/3 sin(wt))
= 3* sin(wt + atan(1/√8))
Now, you can easily say its maximum value is
I = 3 amp
and minimum value is
I = 0 amp.

Confused to get that 2^(n^2 )=Θ(2^(n^3 ))? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about programming within the scope defined in the help center.
Closed 8 years ago.
Improve this question
Can anyone help me to understand that Is 2^(n^2 )=Θ(2^(n^3 )) ? it will be great if also provide the proof for this. As per my view this does not need to be equal.
The given assumption is not true:
First of all, 2^(n^2) is a function and Theta(2^(n^3)) is a set of functions, so it would be correct to say that 2^(n^2) ∈ Theta(2^(n^3)). The = is just a common abuse of notation, but it actually means ∈. To find out whether that statement is true, solve the following limit:
lim (n->infinity) of (2^(n^2)) / (2^(n^3))
If the result is 0 or infinite then the function does not belong to that particular Theta class. If it is some other value, it does belong to that class.

Why does this code work in Objective-C? I'm getting BAD_ACCESS [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
int RandomSource_next(int bits, double* seed) {
*seed = (((long long) *seed * 0x5DEECE66DLL) + 0xBLL) & ((1LL << 48) - 1);
return (int)((signed long long) *seed >> (48 - bits));
}
I think it got something to do with the address.
Most probably you are passing incorrect address as seed. Maybe you're passing not an address but a value?
The following should work
double seed = 0;
RandomSource_next(48, &seed);
The following should crash
RandomSource_next(48, 0);

How can I resize a fat32 file system in an LVM partition? [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 9 years ago.
Improve this question
Simple enough: I have an LVM partition (e.g. /dev/mapper/foo-fat) that contains a Fat32 file system. Prior to reducing the size of this LVM partition (which I'll do with lvmreduce), I want to reduce the size of the Fat32 filesystem it contains.
It looks like parted should be able to do it, but I can't find the magic invocation to make it work.
Use fatresize (manpage) and then proceed with lvresize.
To avoid truncating the FS, you should first shrink the VFAT volume a few hundreds (to be safe) megabytes more than wanted, then resize the LVM container and finally grow the volume to fill the LVM partition.
Besides, this question does not belong to StackOverflow but to ServerFault.
No answers + deadline to meet = write it myself.
For future reference, it was only a few lines of code, using libparted. For readability, I've omitted error checking, etc. Caller is responsible for ensuring there's enough space in the partition for the new filesystem size.
#include <parted/parted.h>
int
resize_filesystem(const char *device, PedSector newsize)
{
PedDevice *dev = NULL;
PedGeometry *geom = NULL;
PedGeometry *new_geom = NULL;
PedFileSystem *fs = NULL;
int rc = 0;
dev = ped_device_get(device);
ped_device_open(dev);
geom = ped_geometry_new(dev, 0LL, dev->length);
fs = ped_file_system_open(geom);
new_geom = ped_geometry_new(dev, 0LL, newsize / dev->sector_size);
ped_file_system_resize(fs, new_geom, NULL);
ped_file_system_close(fs);
ped_geometry_destroy(geom);
ped_geometry_destroy(new_geom);
ped_device_close(dev);
return rc;
}
This appears to be what you want, http://www.gnu.org/software/parted/manual/html_chapter/parted_2.html#SEC25