hello sci i have one question say you have two numbers a and b how can you equate them to equal the bigger number of the two? i have a solution but i was wondering if there is one without abs (a+b+abs(a-b))/2 please post your solution pic unrelated
[eqn]\mathrm{max}\{a,b\}=\lim_{p \rightarrow \infty} \left( \frac{a^p + b^p}{2} \right)^{1/p}[/eqn]
https://en.wikipedia.org/wiki/Generalized_mean
>>8731069
this doesnt work its always 1 and also i need to use only the a and b not any other variable
>>8731069
that's exactly what OP meant I am sure
>>8731071
and without limit
answer pleas
>>8731086
use an if statement
>>8731092
thats the point i have to do it in one line
get a and b from the user
put it in a variable and print it
>>8731096
it was a joke, but you could exchange abs for the root of the square
>>8731103
aren't square roots massively more inefficient than absolute values? In terms of computational time.
Not that it matters for this silly question
>>8731156
I would assume so, but you haven't said why you can't use abs yet.
>>8731096
a>b?a:b
>>8731062
listen, you are either going to have to use abs(), a limit (or an infinite sum, which is also a limit), or the step function (which is just a re-scaled abs),
there arnt nice elementary functions with the non smooth behavior needed for the max function.