dsolve_ode
Solve ordinary differential equations (ODEs) using SymPy's dsolve function, providing the equation and function to solve. Returns the solution in LaTeX format or an error message.
Instructions
Solves an ordinary differential equation using SymPy's dsolve function.
Args:
expr_key: The key of the expression (previously introduced) containing the differential equation.
func_name: The name of the function (previously introduced) to solve for.
hint: Optional solving method from ODEHint enum. If None, SymPy will try to determine the best method.
Example:
# First introduce a variable and a function
intro("x", [Assumption.REAL], [])
introduce_function("f")
# Create a second-order ODE: f''(x) + 9*f(x) = 0
expr_key = introduce_expression("Derivative(f(x), x, x) + 9*f(x)")
# Solve the ODE
result = dsolve_ode(expr_key, "f")
# Returns solution with sin(3*x) and cos(3*x) terms
Returns:
A LaTeX string representing the solution. Returns an error message string if issues occur.
Input Schema
Name | Required | Description | Default |
---|---|---|---|
expr_key | Yes | ||
func_name | Yes | ||
hint | No |
Input Schema (JSON Schema)
{
"$defs": {
"ODEHint": {
"enum": [
"factorable",
"nth_algebraic",
"separable",
"1st_exact",
"1st_linear",
"Bernoulli",
"1st_rational_riccati",
"Riccati_special_minus2",
"1st_homogeneous_coeff_best",
"1st_homogeneous_coeff_subs_indep_div_dep",
"1st_homogeneous_coeff_subs_dep_div_indep",
"almost_linear",
"linear_coefficients",
"separable_reduced",
"1st_power_series",
"lie_group",
"nth_linear_constant_coeff_homogeneous",
"nth_linear_euler_eq_homogeneous",
"nth_linear_constant_coeff_undetermined_coefficients",
"nth_linear_euler_eq_nonhomogeneous_undetermined_coefficients",
"nth_linear_constant_coeff_variation_of_parameters",
"nth_linear_euler_eq_nonhomogeneous_variation_of_parameters",
"Liouville",
"2nd_linear_airy",
"2nd_linear_bessel",
"2nd_hypergeometric",
"2nd_hypergeometric_Integral",
"nth_order_reducible",
"2nd_power_series_ordinary",
"2nd_power_series_regular",
"nth_algebraic_Integral",
"separable_Integral",
"1st_exact_Integral",
"1st_linear_Integral",
"Bernoulli_Integral",
"1st_homogeneous_coeff_subs_indep_div_dep_Integral",
"1st_homogeneous_coeff_subs_dep_div_indep_Integral",
"almost_linear_Integral",
"linear_coefficients_Integral",
"separable_reduced_Integral",
"nth_linear_constant_coeff_variation_of_parameters_Integral",
"nth_linear_euler_eq_nonhomogeneous_variation_of_parameters_Integral",
"Liouville_Integral",
"2nd_nonlinear_autonomous_conserved",
"2nd_nonlinear_autonomous_conserved_Integral"
],
"title": "ODEHint",
"type": "string"
}
},
"properties": {
"expr_key": {
"title": "Expr Key",
"type": "string"
},
"func_name": {
"title": "Func Name",
"type": "string"
},
"hint": {
"anyOf": [
{
"$ref": "#/$defs/ODEHint"
},
{
"type": "null"
}
],
"default": null
}
},
"required": [
"expr_key",
"func_name"
],
"title": "dsolve_odeArguments",
"type": "object"
}