NaturalLanguage
|
send a query directly to a large language model
|
|
Calling Sequence
|
|
RawQuery()
RawQuery(, )
|
|
Parameters
|
|
|
-
|
string, query to send to a large language model.
|
|
-
|
(optional) option of the form , where is , , , or .
|
|
|
|
|
Description
|
|
•
|
The RawQuery command sends the string query to one of several models from OpenAI, through a Maplesoft server; and returns the response as a string. Most other commands in the NaturalLanguage package are routed through RawQuery, with some pre- and/or post-processing.
|
•
|
Maple can interface with OpenAI's GPT-4o, o1-mini, and o3-mini models. You can select these by using the options ; ; and , respectively. By default, or when explicitly selected with the option, a Maplesoft server chooses an appropriate model. (At the time of release of Maple 2025, this was the o3-mini model.) Note that OpenAI may deprecate and disable models, so the set of models supported may change in the future.
|
|
Note: Large language models often generate inaccurate statements. Please keep this in mind: this is not technology for building a bridge with.
|
|
|
Examples
|
|
in Maple, you can use the `plot` command, which is a powerful tool for creating graphical representations of mathematical functions. Below are the steps and sample code to help you generate the plot:
## Step-by-Step Guide
1. **Start Maple:** Open your Maple software to access the command interface where you can enter the necessary commands.
2. **Use the `plot` Command:** The basic syntax for plotting a function in Maple is:
```maple
plot(function, variable_range);
```
For the sine function, it would look like this:
```maple
plot(sin(x), x = a..b);
```
Here, `a` and `b` define the range of the variable x over which you want to plot the function.
3. **Specify the Range:** It's common to plot trigonometric functions like sine over an interval that covers multiple periods to capture their repeating nature. A typical choice is from -2\pi to 2\pi .
4. **Enhance the Plot (Optional):** You can add titles, labels, and other styling options to make the plot more informative and visually appealing.
## Sample Maple Code
Here's a complete example that plots \sin(x) from -2\pi to 2\pi with additional customization:
```maple
# Define the range for x
start := -2*Pi:
end := 2*Pi:
# Plot sin(x) with customization
plot(sin(x), x = start..end,
title = "Plot of sin(x)",
labels = ["x", "sin(x)"],
color = blue,
thickness = 2,
style = line);
```
### Explanation of the Code:
- **Defining the Range:**
```maple
start := -2*Pi:
end := 2*Pi:
```
These lines set the lower and upper bounds for x to -2\pi and 2\pi , respectively.
- **Plot Command:**
```maple
plot(sin(x), x = start..end, ...)
```
This command tells Maple to plot the sine function within the specified range.
- **Customizations:**
- `title = "Plot of sin(x)"`: Adds a title to the graph.
- `labels = ["x", "sin(x)"]`: Labels the x-axis and y-axis.
- `color = blue`: Sets the color of the sine curve to blue.
- `thickness = 2`: Makes the curve thicker for better visibility.
- `style = line`: Plots the function as a continuous line.
## Result
Executing the above code in Maple will generate a graph of \sin(x) spanning from -2\pi to 2\pi , complete with axis labels, a title, and a neatly styled sine curve.
## Additional Tips
- **Dynamic Exploration:** You can use Maple's interactive features to zoom in and out of different sections of the plot or to explore how changes to parameters affect the graph.
- **Multiple Functions:** To plot multiple functions on the same graph, you can list them within the `plot` command. For example:
```maple
plot([sin(x), cos(x)], x = -2*Pi..2*Pi, labels = ["x", "Function"], legend = ["sin(x)", "cos(x)"]);
```
- **Exporting the Plot:** After creating the plot, you can export it in various formats (e.g., PNG, PDF) using Maple's export features for use in reports or presentations.
By following these steps and utilizing the sample code, you should be able to successfully plot \sin(x) in Maple and customize it to suit your needs.
| (1) |
using Maple, you can follow these steps:
1. Start Maple.
2. Use the `int` function to calculate the integral.
Here is the Maple code to find the integral:
```maple
# Define the function
f := (x^2 - 1)/(x + 2);
# Compute the integral
integral := int(f, x);
# Display the result
integral;
```
When you execute this code, Maple will compute the indefinite integral of the function (x^2-1)/(x+2) with respect to x.
Alternatively, you can execute the integration in a more compact form directly:
```maple
int((x^2 - 1)/(x + 2), x);
```
This will provide the same result when you run it in Maple.
| (2) |
|
|
References
|
|
|
|
Compatibility
|
|
•
|
The NaturalLanguage:-RawQuery command was introduced in Maple 2024.
|
•
|
The NaturalLanguage:-RawQuery command was updated in Maple 2025.
|
|
|