Linear mapping interval of numbers to [0,1] [closed] - math

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 know it should be trivial, but tonight I'm not finding a solution.
Suppose I have a series of float in a given range such [0.25, 1.0]. For example:
{0.25, 0.625, 1.0}
What's the correct way to transform them in order to map the [0.25,1.0] interval to [0.0,1.0]?
The example sequence should become:
{0.0, 0.5, 1.0}
Second question, how to generalize that? How is the correct way to map a given interval [a,b] to [0,1]?

fun lin-map(list) :=
mx = max(list), mn = min(list)
return [ (x - mn)/(mx-mn) | x <- list ]

Related

Solving equation with an exponential [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 1 year ago.
Improve this question
I want to solve for x:
1 = a b e^(b(x-c))
That's where I'm stuck. I want to solve for x, and all the other letters are constants. I've forgotten how to solve that equation with the embedded "b(x-c)" for x.
Use logarithm
e^(b(x-c)) = 1/(ab)
ln(e^(b(x-c))) = ln(1/(ab))
b*(x-c) = -ln(a*b)
x-c = -ln(a*b)/b
x = c - ln(a*b)/b

Find the approximate value in the vector [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
I have a number of the vector with the numbers.
test <- 0.495
vector <- c(0.5715122, 2.2860487, 5.1436096, 9.1441949)
This vector is the need to take an approximate number to the number 0.495.
Help me.
If I've understood correctly, you want to extract the value from a vector that is closest to your test value.
vector[which.min(abs(vector - test))]
#[1] 0.5715122
If two different values could be closest, you could do this:
vector <- c(0.5715122, 2.2860487, 5.1436096, 9.1441949, 0.4184878)
tol <- sqrt(.Machine$double.eps)
vector[which(abs(vector - test) - min(abs(vector - test)) < tol)]
#[1] 0.5715122 0.4184878
tol is a tolerance accounting for floating point accuracy and usually chosen based on help(".Machine").

How do I access random elements from a vector in R studio? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
Lets say I have a vector c(1,2,3,4,5,6,7,8,9) how can I get a print of just 1,3,and 5 ?
For a sample of n random elements from vector X you can use sample(x = X, size = 3, replace = FALSE). To get the ith element of X you simply use X[i].

Mathematical notation: x ◁ y [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 10 years ago.
Improve this question
I have googled for the meaning of ◁ without avail.
Can anyone explain to me what x ◁ y means? For example:
z ⊢ x ◁ y
could it mean that we can derive an agreement between x and y from z?
Thanks.
I had a look at the Wikipedia List of Mathematical Symbols and it seems that this symbol defines a normal subgroup.

Is there a simplification for x power log to base (1/x)? [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 11 years ago.
Improve this question
Is there a simplification for x^(log base (1/x) of N)?
Yes, it's 1 / N (the reciprocal of N), provided of course that both N and x are positive and x != 1.
x^(log[1/x](n)) = e^(log[1/x](n)*ln(x)) = e^((ln(n)/ln(1/x))*ln(x)) = e^(ln(n)*ln(x)/(-ln(x)) = e^(-ln(n)) = 1/n

Resources