0
$\begingroup$

I'm wondering if is it possible to plot a graph of a function with arbitrary constants.

Here's an example to make things clearer. If I have a function $$f(x) = \cos(bx) + bx$$ Can I plot this f(x) without giving a specific value for b?

$\endgroup$
5
  • $\begingroup$ With Manipulate you can set a range for b and see how it affects the plot. $\endgroup$ Commented Nov 18, 2022 at 22:24
  • 3
    $\begingroup$ Manipulate[Plot[Cos[b x] + b x, {x, 0, 2Pi}], {b, 0, 3}] $\endgroup$ Commented Nov 18, 2022 at 22:25
  • $\begingroup$ Can I plot this f(x) without giving a specific value for b? The short answer is "no". Please lookup FunctionDomain and FunctionRange as those may help you in certain instances to plot a region of interest. $\endgroup$ Commented Nov 19, 2022 at 3:39
  • $\begingroup$ Do you want to draw all of the curves for -2<=b<=2? $\endgroup$ Commented Nov 19, 2022 at 3:46
  • $\begingroup$ If you use free form syntax with Ctrl + = then type plot Cos[xb]+xb you will get a 3 D plot if you want that. It might be easier to visualize the curve for different b with the suggestion above to use Manipulate or the answer below. $\endgroup$ Commented Nov 19, 2022 at 7:45

1 Answer 1

2
$\begingroup$

Different values of $b$ correspond to different scales of the $x$-axis (I will assume $b>0$). Therefore, one could use a plot of this kind:

enter image description here

Code:

With[{xs=Range[-3*Pi,3*Pi,Pi]},
 Plot[Cos[x]+x,{x,Min[xs],Max[xs]},
  Ticks->{{xs,xs/"b"}//Transpose,Automatic}]]
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.