Comments (2)
I'm surprised you ever had a vector return work with that. @register_symbolic
always assumed a scalar output. You need to update this to @register_array_symbolic
for array functions and it should be fine.
from symbolics.jl.
Ok I see that is was added in 5.13.0. Thanks for letting me know!
I am trying to test the script on 5.13.0, but I am still getting stumped with figuring out the exact implementation. I think I am closely following the example near line 530 in the MTK test file
If you don't mind taking a peak below and offering some guidance, would be much appreciated.
function vec_return(T, n)
[T, T, T]
end
@register_array_symbolic vec_return(T, n) begin
size=(3,)
eltype=promote_type(eltype(T), eltype(n)) #=optional?, fails to build eqs if I do not specify this=#
end
nx=3.0
Tx=500.0
vars = @variables (x[1:3], a, b, c)
pars = @parameters (n=nx, T=Tx)
eqs = [
x ~ vec_return(T, n)
a ~ 1 + x[1]
b ~ 2 + x[2]
c ~ 3 + x[3]
]
@show eqs
@named sys = NonlinearSystem(eqs, vars, pars)
guess = [x[1] => 1, x[2] => 1, x[3] => 1,
a => 1, b => 1, c => 1]
prob = NonlinearProblem(sys, guess, [])
sol = solve(prob, NewtonRaphson())
The eqs print as:
eqs = Any[(broadcast(~, x, Main.var"##mock test#292".vec_return(T, n)))[1], (broadcast(~, x, Main.var"##mock test#292".vec_return(T, n)))[2], (broadcast(~, x, Main.var"##mock test#292".vec_return(T, n)))[3], a ~ 1 + x[1], b ~ 2+ x[2], c ~ 3 + x[3]]
The error is:
LoadError: MethodError: no method matching -(::SymbolicUtils.BasicSymbolic{Any}, ::SymbolicUtils.BasicSymbolic{Real})
Does anything look blatantly incorrect in the implementation when using @register_array_symbolic
in your mind? Thanks.
from symbolics.jl.
Related Issues (20)
- Finding Coefficients of Cross Terms HOT 1
- Can't define custom derivative dependent on model parameters (locally) HOT 3
- Rational or integer coefficients with simplify? HOT 2
- Cannot sum an array of symbolics because of conversion error HOT 2
- Indexing vector of variables has strange repr
- Representation of AND `&` between symbolic vars HOT 1
- Error on violation of default type HOT 1
- Docstring of Differential instances is irrelevant
- `Differential`s display differently in a REPL than their docstring indicates they should HOT 1
- `derivative` gives wrong answer when differentiating with respect to an expression HOT 2
- Wrong answer for derivative at branch points
- Tracking issue for Gruntz's limit algorithm's dependencies HOT 1
- Simplified derivative expansion gives float coefficients HOT 7
- Passing function to `derivative` results in zero HOT 1
- Structs in structs
- Error with Julia 1.10 HOT 1
- How to @register_symbolic a function by a non-interactive way HOT 1
- Can you remove NanMath from build_function output? HOT 5
- isaffine and islinear not handling differentials correctly
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from symbolics.jl.