1
$\begingroup$

I know there is a way of making your own commands that outputs your desired information but I'm not sure how to do this. How do you format/modify/make your own command that outputs what you want.

E.g. How do you make a code that whenever you put in a function, it gives you information such as its domain, range, turning points, intercepts and so on...

$\endgroup$
2
$\begingroup$

This provides a couple of examples of information types, you can add other information as required.

Clear["Global`*"]

funcInfo[func_, var_Symbol] := Module[
  {dom, critPts, roots},
  dom = FunctionDomain[func, var] /. True -> {-Infinity, Infinity};
  roots = Solve[func == 0, var, Method -> Reduce];
  critPts = Solve[
    D[func, var] == 0, var, Reals, Method -> Reduce];
  {{TraditionalForm@func, SpanFromLeft},
   {"Domain", dom},
   {"Roots", roots},
   {"Critical Points", critPts}}]

funcInfo[x^2 + 2 x - 3, x] // Grid[#, Frame -> All] &

enter image description here

funcInfo[x^3 - 6 x^2 + 13 x - 10, x] // Grid[#, Frame -> All] &

enter image description here

funcInfo[x*E^-x, x] // Grid[#, Frame -> All] &

enter image description here

| improve this answer | |
$\endgroup$
  • $\begingroup$ Wow this is great. Thank you so much, really appreciate it. So I assume we can use this as a building block to make self made commands? $\endgroup$ – Krishiv SURESH Jul 7 at 3:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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