Aula 2- Definir e produzir gráficos de funções no Wolfram Mathematica
Introduction to Functions in Mathematics
Overview of the Lesson
- The session focuses on defining functions in mathematics, including how to create and plot them.
- The instructor discusses the interface of the mathematics software, emphasizing zooming features for better visibility.
Defining a Function
- To define a function, a name is assigned (e.g., F), followed by its variable (e.g., x).
- The correct syntax for defining a function includes using "colon equals" (:=) instead of just an equal sign.
- An example function f(x) = x^2 is defined, with optional parentheses for clarity.
Executing and Testing the Function
- After defining the function, it can be executed using Shift + Enter; this confirms that f(2) = 4 .
- Further testing shows that f(4) = 16 , validating the function's correctness.
Plotting Functions
Creating a Plot
- To plot the defined function f(x)=x^2 , use the command
Plotwith proper capitalization.
- The range for x values is specified from -4 to 4 when executing the plot command.
Customizing Graph Properties
- Additional customization options include labeling axes; Y-axis as f(x) , X-axis as x .
- Labels are enclosed in quotes to denote they are text rather than formulas.
Changing Graph Appearance
- Color customization is possible; users can specify colors like "Green" or "Darker Green" for visual preference.
How to Create and Customize Graphs in Python
Adding Titles to Graphs
- To add a title to a graph, use the
plot Labelfunction. Ensure the title is enclosed in quotes for it to be recognized as text.
- If not enclosed in quotes, the system interprets it as a mathematical function (e.g., f(x) = x^2 ).
- Correctly formatting the title allows for customization; you can name it anything you prefer.
Plotting Multiple Graphs
- When plotting multiple graphs together, you can either combine them into one plot or create separate plots and display them simultaneously.
- The preferred method is often to define each plot separately and then merge them later for clarity.
Defining Functions for Plots
- A new function can be defined using syntax like
g(x) = x. This allows for easy evaluation of specific values (e.g.,g(3)returns 3).
- After defining functions, they can be plotted over specified ranges (e.g., from -4 to 4).
Combining Plots
- Assign each plot to a variable (e.g.,
p1andp2) before combining them. This helps manage multiple plots effectively.
- Use the command
show(p1, p2)with proper capitalization to display both graphs together.
Customizing Axes Ranges
- You can customize the axes by specifying their ranges within curly braces when calling the show function.