@@ -316,3 +316,53 @@ function (f::AbstractSysToExpr)(O)
316
316
end
317
317
return build_expr (:call , Any[operation (O); f .(arguments (O))])
318
318
end
319
+
320
+ function Base. show (io:: IO , sys:: AbstractSystem )
321
+ eqs = equations (sys)
322
+ Base. printstyled (io, " Equations ($(length (eqs)) ):\n " ; bold= true )
323
+ Base. print_matrix (io, eqs)
324
+ println (io)
325
+
326
+ rows = first (displaysize (io)) ÷ 3
327
+ limit = get (io, :limit , false )
328
+
329
+ vars = states (sys); nvars = length (vars)
330
+ Base. printstyled (io, " States ($nvars ):" ; bold= true )
331
+ nrows = min (nvars, limit ? rows : nvars)
332
+ limited = nrows < length (vars)
333
+ d_u0 = default_u0 (sys)
334
+ for i in 1 : nrows
335
+ s = vars[i]
336
+ print (io, " \n " , s)
337
+
338
+ val = get (d_u0, s, nothing )
339
+ if val != = nothing
340
+ print (io, " [defaults to $val ]" )
341
+ end
342
+ end
343
+ limited && print (io, " \n ⋮" )
344
+ println (io)
345
+
346
+ vars = parameters (sys); nvars = length (vars)
347
+ Base. printstyled (io, " Parameters ($nvars ):" ; bold= true )
348
+ nrows = min (nvars, limit ? rows : nvars)
349
+ limited = nrows < length (vars)
350
+ d_p = default_p (sys)
351
+ for i in 1 : nrows
352
+ s = vars[i]
353
+ print (io, " \n " , s)
354
+
355
+ val = get (d_p, s, nothing )
356
+ if val != = nothing
357
+ print (io, " [defaults to $val ]" )
358
+ end
359
+ end
360
+ limited && print (io, " \n ⋮" )
361
+
362
+ s = get_structure (sys)
363
+ if s != = nothing
364
+ Base. printstyled (io, " \n Incidence matrix:" ; color= :magenta )
365
+ show (io, incidence_matrix (s. graph, Num (Sym {Real} (:× ))))
366
+ end
367
+ return nothing
368
+ end
0 commit comments