Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

I can put e.g. sin(x),cos(x) in google's search box and it will plot the 2 functions. But if I only want to plot the maximum value, how do I plot something like max(sin(x),cos(x)) or the minimum ? I'm not sure but if the max and min are not implemented maybe trigonometric functions can implement the max / min functions?

Update

I was not clear enough. I want something like max(sin(x), 0.5x) and only plot the maximum value at each x.

share|improve this question
2  
You mean like this and this? Maybe get MMA or some other CAS. –  Amzoti Mar 8 '13 at 23:56
1  
Find your answer below! –  Fardad Jalili Mar 9 '13 at 0:06

2 Answers 2

up vote 3 down vote accepted

Use $\frac{sin(x)+cos(x)+|sin(x)-cos(x)|}{2}$ or (sin(x)+cos(x)+abs(sin(x)-cos(x)))/2 for max(sin(x),cos(x)) and $\frac{sin(x)+cos(x)-|sin(x)-cos(x)|}{2}$ for min(sin(x),cos(x)).

like this.

EDIT: Seems like I wasn't clear enough, for any arbitrary f(x) and g(x) you can use 1/2*(f(x)+g(x)+abs(f(x)-g(x))) to plot max(f(x),g(x)).

EDIT 2: Note that $$ \forall x, f(x) < g(x): |f(x) - g(x)| = g(x) - f(x) \implies f(x) + g(x) + |f(x) - g(x)| = 2g(x). $$

$$ \forall x, f(x) > g(x): |f(x) - g(x)| = f(x) - g(x) \implies f(x) + g(x) + |f(x) - g(x)| = 2f(x). $$

$$ \implies \forall x: f(x) + g(x) + |f(x) - g(x)| = 2* max(f(x),g(x)). $$

$$ \square $$

share|improve this answer
1  
You beat me to it by a second :) +1 –  Sasha Mar 8 '13 at 23:59
    
Thank you but I think I want it more general i.e. max(f(x),g(x)) and I was not clear enough in the post. –  Niklas Rtz Mar 9 '13 at 0:07
    
Just replace the sin and cos with f and g. Edited. –  Fardad Jalili Mar 9 '13 at 0:08
1  
Proved it will work in any case :). Edited, second. –  Fardad Jalili Mar 9 '13 at 0:16
1  
Well, it will be ugly. Use the fact that max(f,g,h) = max(f,max(g,h)). example: max(sin(x),cos(x),tan(x)) will be 1/2*(sin(x)+(1/2*(cos(x)+tan(x)+abs(cos(x)-tan(x)))+abs(sin(x)-(1/2*(cos(x)+tan‌​(x)+abs(cos(x)-tan(x))))). I don't know if google's engine will parse such a big string as a formula or not. –  Fardad Jalili Mar 9 '13 at 0:26

You can use Wolfram Alpha to get this

share|improve this answer
    
Why can't google do simple math? Thanks for the answer. Google could let us make a macro or so for the max and min. –  Niklas Rtz Mar 9 '13 at 22:19

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.