Hi all,
I have this equation
y = \frac{1}{e^{\frac{t}{2}}} \left[ \int_{t_{0}}^{t} e^{\frac{s}{2}} (10 + 5 \ sin(2s)) \ ds + c \right] \\
I want to ask how to solve this with Symbolics.jl and DiffRules.jl (even if the packages are derivatives, I know they can be used to check whether the integration is correct)
or are there any package that can help for the integration analytically? or both if possible…
From an old 2021 thread on this discourse I try this code (Derivative of a Symbolic Expression as a Symbol Valued Function):
using Symbolics
@variables a3, a2, a1, a0, t
f0(t) = a3*t^3 + a2*t^2 + a1*t + a0
and it does not work:
┌ Info: Precompiling Symbolics [0c5d862f-8b57-4792-8d23-62f2024744c7]
└ @ Base loading.jl:1423
ERROR: LoadError: UndefVarError: similar_type not defined
Stacktrace:
** [1] include**
** @ ./Base.jl:418 [inlined]**
** [2] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)**
** @ Base ./loading.jl:1318**
** [3] top-level scope**
** @ none:1**
** [4] eval**
** @ ./boot.jl:373 [inlined]**
** [5] eval(x::Expr)**
** @ Base.MainInclude ./client.jl:453**
** [6] top-level scope**
** @ none:1**
in expression starting at /home/browni/.julia/packages/DiffResults/YLo25/src/DiffResults.jl:1
ERROR: LoadError: Failed to precompile DiffResults [163ba53b-c6d8-5494-b064-1a9d43ac40c5] to /home/browni/.julia/compiled/v1.7/DiffResults/jl_sNyCGj.
I also try this:
using Symbolics
@variables x, y, z
f(x,y,z) = x^2 + sin(x+y) - z
Symbolics.derivative(::typeof(my_function), args::NTuple{N,Any}, ::Val{i})
from Derivatives and Differentials · Symbolics.jl
still not working:
Info: Precompiling Symbolics [0c5d862f-8b57-4792-8d23-62f2024744c7]
└ @ Base loading.jl:1423
ERROR: LoadError: UndefVarError: similar_type not defined
Stacktrace:
** [1] include**
** @ ./Base.jl:418 [inlined]**
** [2] include_package_for_output(pkg::Base.PkgId, input::String, depot_path::Vector{String}, dl_load_path::Vector{String}, load_path::Vector{String}, concrete_deps::Vector{Pair{Base.PkgId, UInt64}}, source::String)**
** @ Base ./loading.jl:1318**
** [3] top-level scope**
** @ none:1**
** [4] eval**
** @ ./boot.jl:373 [inlined]**
** [5] eval(x::Expr)**
** @ Base.MainInclude ./client.jl:453**
** [6] top-level scope**
** @ none:1**
in expression starting at /home/browni/.julia/packages/DiffResults/YLo25/src/DiffResults.jl:1
ERROR: LoadError: Failed to precompile DiffResults [163ba53b-c6d8-5494-b064-1a9d43ac40c5] to /home/browni/.julia/compiled/v1.7/DiffResults/jl_ixnUlq.
Stacktrace:
Thanks