From 68aa8cb130ff68395c416b36a1e5661e6fa18e5d Mon Sep 17 00:00:00 2001 From: bnewbold Date: Sun, 25 Dec 2016 22:04:07 -0800 Subject: update/de-cruft notes directory --- notes/background.txt | 13 ++ notes/dae_libs.txt | 9 ++ notes/examples.txt | 59 ------- notes/goals.txt | 9 -- notes/ideas.txt | 4 - notes/implementation_libs.txt | 44 ------ notes/julia_libs.txt | 34 ++++ notes/list_of_examples.txt | 64 ++++++++ notes/modelica.txt | 2 - notes/modelica33r1_grammar.txt | 347 +++++++++++++++++++++++++++++++++++++++++ notes/modelica33r1_spec.txt | 347 ----------------------------------------- notes/modelica_limitations.txt | 2 + notes/parsing.txt | 3 + notes/solve_for.txt | 58 +++++++ notes/spec.txt | 10 -- notes/tangle_demo.txt | 31 ++++ notes/webface.txt | 15 ++ 17 files changed, 576 insertions(+), 475 deletions(-) create mode 100644 notes/dae_libs.txt delete mode 100644 notes/examples.txt delete mode 100644 notes/goals.txt delete mode 100644 notes/ideas.txt delete mode 100644 notes/implementation_libs.txt create mode 100644 notes/julia_libs.txt create mode 100644 notes/list_of_examples.txt delete mode 100644 notes/modelica.txt create mode 100644 notes/modelica33r1_grammar.txt delete mode 100644 notes/modelica33r1_spec.txt create mode 100644 notes/modelica_limitations.txt create mode 100644 notes/solve_for.txt delete mode 100644 notes/spec.txt create mode 100644 notes/tangle_demo.txt diff --git a/notes/background.txt b/notes/background.txt index 700926d..72991e3 100644 --- a/notes/background.txt +++ b/notes/background.txt @@ -4,6 +4,12 @@ "CellML Model Repository" http://models.cellml.org/cellml +OpenCell tool for CellML +https://www.cellml.org/tools/opencell + +NeuroML +https://en.wikipedia.org/wiki/NeuroML + "BioModels Database" http://www.ebi.ac.uk/biomodels-main/ @@ -82,3 +88,10 @@ Luna Lang so far, vaporware http://www.luna-lang.org/ +### Other + +"HOW TO SIMULATE THE UNIVERSE IN 134 EASY STEPS" +Nicky Case, 2016 +http://ncase.me/OVC2016/ + +also: http://blog.ncase.me/evolution-not-revolution/ diff --git a/notes/dae_libs.txt b/notes/dae_libs.txt new file mode 100644 index 0000000..762d21b --- /dev/null +++ b/notes/dae_libs.txt @@ -0,0 +1,9 @@ + +##### Solvers/"Codes" + +SUNDIALS + http://computation.llnl.gov/projects/sundials + +DAEPACK + http://yoric.mit.edu/DAEPACK + diff --git a/notes/examples.txt b/notes/examples.txt deleted file mode 100644 index 5f5d4d3..0000000 --- a/notes/examples.txt +++ /dev/null @@ -1,59 +0,0 @@ - -Newer list: -https://en.wikipedia.org/wiki/Radioactive_decay#One-decay_process -https://en.wikipedia.org/wiki/Hodgkin%E2%80%93Huxley_model -logistic function -Black–Scholes -https://en.wikipedia.org/wiki/Sethi_model -von Bertalanffy growth equation - -### Models - -Simple, equation based: -- World3 (from limits to growth report) -- classic predator-prey (Lotka–Volterra) -- attractors -- that vegan paper -- whatever Fe is the minimal of (function of protons/neutrons? discrete) -- urban subsidized housing (thinking in systems) -- Pulse Tube Cooler -- Hodgkin–Huxley model for neurons -x Uranium Critical Mass (meh, too complicated) -- black body (thermal emission) -- compton scattering -- Schwarzschild Radius -- three-body, eg - http://nbviewer.jupyter.org/github/pjpmarques/Julia-Modeling-the-World/blob/master/Three-Body%20Problem.ipynb - -Not-Time-Oriented -- high-precision model for water (enthalpy, etc) - -Economics: -- rent control -- supply/demand curve -- World3 -- https://en.wikipedia.org/wiki/Category:Economics_models - -Harder, Time/State Based: -- Schmitt trigger (hysteresis) - -Environment/Energy: -- pretty much everything from Sustainable w/o Hot Air - -### Non-Model (?) Equations -- logistic function -- statistical distributions -- volume or surface area of platonic solids - -http://equator.memeschemes.com/equation/ -https://en.wikipedia.org/wiki/Category:Equations - -### Constants - - - -https://www.wikidata.org/wiki/Q173227 (physical constant) - -### Units - -https://www.wikidata.org/wiki/Q15088658 (measured value) diff --git a/notes/goals.txt b/notes/goals.txt deleted file mode 100644 index d3e4bc4..0000000 --- a/notes/goals.txt +++ /dev/null @@ -1,9 +0,0 @@ -- simple wiki/database tool with web front end -- some support or UI for compound models -- code generation: - - julia - - javascript - - rust? - - C? - - modelica -- Elm interactive front-end / debugger diff --git a/notes/ideas.txt b/notes/ideas.txt deleted file mode 100644 index 2f5d5ac..0000000 --- a/notes/ideas.txt +++ /dev/null @@ -1,4 +0,0 @@ -- FRP-based integration of models (via signals) -- Elm-based browser simulation environment -- fast simulator/plotter in Rust -- try to integrate or use "Luna" language diff --git a/notes/implementation_libs.txt b/notes/implementation_libs.txt deleted file mode 100644 index 94a961f..0000000 --- a/notes/implementation_libs.txt +++ /dev/null @@ -1,44 +0,0 @@ - -##### Julia Web Framework - -Morsel.jl - Classic web framework paradigm. Use this for the wiki. - http://juliawebstack.org/ - -Escher.jl - Sort of PHP-like single-file UIs. - Might be good for exploration/visualization? - - -##### Julia Markdown Rendering - -Try using the Julia built-in stuff, which seems to support basic LaTeX -rendering. -If that isn't powerful enough, or seems to "custom", switch to pandoc as an -external tool. - - -##### Julia Computer Algebra Stuff - -Use Sims.jl for flattening, etc! Otherwise this will be really hard. - -##### Julia Parser Framework (eg, parser generator) - -Parsimonious.jl - Fairly close to BNF? Good tutorial. Start with this. - -PEGParser.jl - Also pretty BNF-like - -ParserCombinator.jl - More Haskell-like. Meh. - -##### GUI Demos - -numeric.js - Has an ODE solver. Use with Elm? - -Tangle.js - Brett's JS widget-y thing. Very simple. - How did he do plots/graphs for those demos? - http://worrydream.com/Tangle/guide.html diff --git a/notes/julia_libs.txt b/notes/julia_libs.txt new file mode 100644 index 0000000..3ab17c8 --- /dev/null +++ b/notes/julia_libs.txt @@ -0,0 +1,34 @@ + +##### Julia Web Framework + +Morsel.jl + Classic web framework paradigm. Use this for the wiki. + http://juliawebstack.org/ + +Escher.jl + Sort of PHP-like single-file UIs. + Might be good for exploration/visualization? + + +##### Julia Markdown Rendering + +Try using the Julia built-in stuff, which seems to support basic LaTeX +rendering. +If that isn't powerful enough, or seems to "custom", switch to pandoc as an +external tool. + + +##### Julia Computer Algebra Stuff + +Use Sims.jl for flattening, etc! Otherwise this will be really hard. + +##### Julia Parser Framework (eg, parser generator) + +Parsimonious.jl + Fairly close to BNF? Good tutorial. Start with this. + +PEGParser.jl + Also pretty BNF-like + +ParserCombinator.jl + More Haskell-like. Meh. diff --git a/notes/list_of_examples.txt b/notes/list_of_examples.txt new file mode 100644 index 0000000..b8b416f --- /dev/null +++ b/notes/list_of_examples.txt @@ -0,0 +1,64 @@ + +Newer list: +- https://en.wikipedia.org/wiki/Radioactive_decay#One-decay_process +- https://en.wikipedia.org/wiki/Hodgkin%E2%80%93Huxley_model +- logistic function +- Black–Scholes +- https://en.wikipedia.org/wiki/Sethi_model +- von Bertalanffy growth equation + +### Models + +Simple, equation based: +- classic predator-prey (Lotka–Volterra) +- attractors +- that vegan paper +- whatever Fe is the minimal of (function of protons/neutrons? discrete) +- urban subsidized housing (thinking in systems) +- Pulse Tube Cooler +- Hodgkin–Huxley model for neurons +x Uranium Critical Mass (meh, too complicated) +- black body (thermal emission) +- compton scattering +- Schwarzschild Radius +- three-body, eg + http://nbviewer.jupyter.org/github/pjpmarques/Julia-Modeling-the-World/blob/master/Three-Body%20Problem.ipynb + +Not-Time-Oriented +- high-precision model for water (enthalpy, etc) + +Economics: +- rent control +- supply/demand curve +- World3 +- https://en.wikipedia.org/wiki/Category:Economics_models + +Harder, Time/State Based: +- Schmitt trigger (hysteresis) + +Environment/Energy: +- pretty much everything from Sustainable w/o Hot Air + +### Non-Model (?) Equations +- logistic function +- statistical distributions +- volume or surface area of platonic solids + +http://equator.memeschemes.com/equation/ +https://en.wikipedia.org/wiki/Category:Equations + +### Constants + + + +https://www.wikidata.org/wiki/Q173227 (physical constant) + +### Units + +https://www.wikidata.org/wiki/Q15088658 (measured value) + +### Existing / Import +- World3 (from limits to growth report) +- Tennessee Eastman Process Control Challenge Problem + http://yoric.mit.edu/DAEPACK/Examples/Eastman +- OpenWorm (in NeuroML) diff --git a/notes/modelica.txt b/notes/modelica.txt deleted file mode 100644 index 69457c1..0000000 --- a/notes/modelica.txt +++ /dev/null @@ -1,2 +0,0 @@ - -Double derivative (eg, "der(der(x)) = a") is not allowed. diff --git a/notes/modelica33r1_grammar.txt b/notes/modelica33r1_grammar.txt new file mode 100644 index 0000000..2df42dd --- /dev/null +++ b/notes/modelica33r1_grammar.txt @@ -0,0 +1,347 @@ +# These come directly the Modelica 3.3 Spec, Appendix B + +## B.1 Lexical Convetions + +IDENT = NONDIGIT { DIGIT | NONDIGIT } | Q-IDENT +Q-IDENT = "’" ( Q-CHAR | S-ESCAPE ) { Q-CHAR | S-ESCAPE } "’" +NONDIGIT = "_" | letters "a" to "z" | letters "A" to "Z" +STRING = """ { S-CHAR | S-ESCAPE } """ +S-CHAR = any member of the Unicode character set (http://www.unicode.org; see Section 13.2.2 for storing as UTF-8 on files) except double-quote """, and backslash "\" +Q-CHAR = NONDIGIT | DIGIT | "!" | "#" | "$" | "%" | "&" | "(" | ")" | "*" | "+" | "," | "-" | "." | "/" | ":" | ";" | "<" | ">" | "=" | "?" | "@" | "[" | "]" | "^" | "{" | "}" | "|" | "~" | " " +S-ESCAPE = "\’" | "\"" | "\?" | "\\" | "\a" | "\b" | "\f" | "\n" | "\r" | "\t" | "\v" +DIGIT = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" +UNSIGNED_INTEGER = DIGIT { DIGIT } +UNSIGNED_NUMBER = UNSIGNED_INTEGER [ "." [ UNSIGNED_INTEGER ] ] [ ( "e" | "E" ) [ "+" | "-" ] UNSIGNED_INTEGER ] + +## B.2 Grammar + +### B.2.1 + +stored_definition: + [ within [ name ] ";" ] + { [ final ] class_definition ";" } + +### B.2.2 Class Definition + +class_definition : + [ encapsulated ] class_prefixes + class_specifier + +class_prefixes : + [ partial ] + ( class | model | [ operator ] record | block | [ expandable ] connector | type | + package | [ ( pure | impure ) ] [ operator ] function | operator ) + +class_specifier : + long_class_specifier | short_class_specifier | der_class_specifier + +long_class_specifier : + IDENT string_comment composition end IDENT + | extends IDENT [ class_modification ] string_comment composition + end IDENT + +short_class_specifier : + IDENT "=" base_prefix name [ array_subscripts ] + [ class_modification ] comment + | IDENT "=" enumeration "(" ( [enum_list] | ":" ) ")" comment + +der_class_specifier : + IDENT "=" der "(" name "," IDENT { "," IDENT } ")" comment + +base_prefix : + type_prefix + +enum_list : + enumeration_literal { "," enumeration_literal} + +enumeration_literal : + IDENT comment + +composition : + element_list + { public element_list | + protected element_list | + equation_section | + algorithm_section + } + [ external [ language_specification ] + [ external_function_call ] [ annotation ] ";" ] + [ annotation ";" ] + +language_specification : + STRING + +external_function_call : + [ component_reference "=" ] + IDENT "(" [ expression_list ] ")" + +element_list : + { element ";" } + +element : + import_clause | + extends_clause | + [ redeclare ] + [ final ] + [ inner ] [ outer ] + ( ( class_definition | component_clause) | + replaceable ( class_definition | component_clause) + [constraining_clause comment]) + +import_clause : + import ( IDENT "=" name | name ["." ( "*" | "{" import_list "}" ) ] ) comment + +import_list : + IDENT { "," IDENT } + +### B.2.3 Extends + +extends_clause : + extends name [ class_modification ] [annotation] + +constraining_clause : + constrainedby name [ class_modification ] + +### B.2.4 Component Clause + +component_clause: + type_prefix type_specifier [ array_subscripts ] component_list + type_prefix : + [ flow | stream ] + [ discrete | parameter | constant ] [ input | output ] + +type_specifier : + name + +component_list : + component_declaration { "," component_declaration } + +component_declaration : + declaration [ condition_attribute ] comment + +condition_attribute: + if expression + +declaration : + IDENT [ array_subscripts ] [ modification ] + +### B.2.5 Modification + +modification : + class_modification [ "=" expression ] + | "=" expression + | ":=" expression + +class_modification : + "(" [ argument_list ] ")" + +argument_list : + argument { "," argument } + +argument : + element_modification_or_replaceable + | element_redeclaration + element_modification_or_replaceable: + [ each ] [ final ] ( element_modification | element_replaceable) + +element_modification : + name [ modification ] string_comment + +element_redeclaration : + redeclare [ each ] [ final ] + ( ( short_class_definition | component_clause1) | element_replaceable ) + +element_replaceable: + replaceable ( short_class_definition | component_clause1) + [constraining_clause] + +component_clause1 : + type_prefix type_specifier component_declaration1 + +component_declaration1 : + declaration comment + +short_class_definition : + class_prefixes short_class_specifier + +### B.2.6 Equations + +equation_section : + [ initial ] equation { equation ";" } + +algorithm_section : + [ initial ] algorithm { statement ";" } + +equation : + ( simple_expression "=" expression + | if_equation + | for_equation + | connect_clause + | when_equation + | name function_call_args ) + comment + +statement : + ( component_reference ( ":=" expression | function_call_args ) + | "(" output_expression_list ")" ":=" component_reference function_call_args + | break + | return + | if_statement + | for_statement + | while_statement + | when_statement ) + comment + +if_equation : + if expression then + { equation ";" } + { elseif expression then + { equation ";" } + } + [ else + { equation ";" } + ] + end if + +if_statement : + if expression then + { statement ";" } + { elseif expression then + { statement ";" } + } + [ else + { statement ";" } + ] + end if + +for_equation : + for for_indices loop + { equation ";" } + end for + +for_statement : + for for_indices loop + { statement ";" } + end for + +for_indices : + for_index {"," for_index} + +for_index: + IDENT [ in expression ] + while_statement : + while expression loop + { statement ";" } + end while + +when_equation : + when expression then + { equation ";" } + { elsewhen expression then + { equation ";" } } + end when + +when_statement : + when expression then + { statement ";" } + { elsewhen expression then + { statement ";" } } + end when + +connect_clause : + connect "(" component_reference "," component_reference ")" + +### B.2.7 Expressions + +expression : + simple_expression + | if expression then expression { elseif expression then expression } + else expression + +simple_expression : + logical_expression [ ":" logical_expression [ ":" logical_expression ] ] + +logical_expression : + logical_term { or logical_term } + +logical_term : + logical_factor { and logical_factor } + +logical_factor : + [ not ] relation + +relation : + arithmetic_expression [ rel_op arithmetic_expression ] + +rel_op : + "<" | "<=" | ">" | ">=" | "==" | "<>" + +arithmetic_expression : + [ add_op ] term { add_op term } + +add_op : + "+" | "-" | ".+" | ".-" + +term : + factor { mul_op factor } + +mul_op : + "*" | "/" | ".*" | "./" + +factor : + primary [ ("^" | ".^") primary ] + +primary : + UNSIGNED_NUMBER + | STRING + | false + | true + | ( name | der | initial ) function_call_args + | component_reference + | "(" output_expression_list ")" + | "[" expression_list { ";" expression_list } "]" + | "{" function_arguments "}" + | end + +name : + [ "." ] IDENT { "." IDENT } + +component_reference : + [ "." ] IDENT [ array_subscripts ] { "." IDENT [ array_subscripts ] } + +function_call_args : + "(" [ function_arguments ] ")" + function_arguments : + function_argument [ "," function_arguments | for for_indices ] + | named_arguments + +named_arguments: + named_argument [ "," named_arguments ] + +named_argument: + IDENT "=" function_argument + +function_argument : + function name "(" [ named_arguments ] ")" | expression + +output_expression_list: + [ expression ] { "," [ expression ] } + +expression_list : + expression { "," expression } + +array_subscripts : + "[" subscript { "," subscript } "]" + +subscript : + ":" | expression + +comment : + string_comment [ annotation ] + +string_comment : + [ STRING { "+" STRING } ] + +annotation : + annotation class_modification + diff --git a/notes/modelica33r1_spec.txt b/notes/modelica33r1_spec.txt deleted file mode 100644 index 2df42dd..0000000 --- a/notes/modelica33r1_spec.txt +++ /dev/null @@ -1,347 +0,0 @@ -# These come directly the Modelica 3.3 Spec, Appendix B - -## B.1 Lexical Convetions - -IDENT = NONDIGIT { DIGIT | NONDIGIT } | Q-IDENT -Q-IDENT = "’" ( Q-CHAR | S-ESCAPE ) { Q-CHAR | S-ESCAPE } "’" -NONDIGIT = "_" | letters "a" to "z" | letters "A" to "Z" -STRING = """ { S-CHAR | S-ESCAPE } """ -S-CHAR = any member of the Unicode character set (http://www.unicode.org; see Section 13.2.2 for storing as UTF-8 on files) except double-quote """, and backslash "\" -Q-CHAR = NONDIGIT | DIGIT | "!" | "#" | "$" | "%" | "&" | "(" | ")" | "*" | "+" | "," | "-" | "." | "/" | ":" | ";" | "<" | ">" | "=" | "?" | "@" | "[" | "]" | "^" | "{" | "}" | "|" | "~" | " " -S-ESCAPE = "\’" | "\"" | "\?" | "\\" | "\a" | "\b" | "\f" | "\n" | "\r" | "\t" | "\v" -DIGIT = "0" | "1" | "2" | "3" | "4" | "5" | "6" | "7" | "8" | "9" -UNSIGNED_INTEGER = DIGIT { DIGIT } -UNSIGNED_NUMBER = UNSIGNED_INTEGER [ "." [ UNSIGNED_INTEGER ] ] [ ( "e" | "E" ) [ "+" | "-" ] UNSIGNED_INTEGER ] - -## B.2 Grammar - -### B.2.1 - -stored_definition: - [ within [ name ] ";" ] - { [ final ] class_definition ";" } - -### B.2.2 Class Definition - -class_definition : - [ encapsulated ] class_prefixes - class_specifier - -class_prefixes : - [ partial ] - ( class | model | [ operator ] record | block | [ expandable ] connector | type | - package | [ ( pure | impure ) ] [ operator ] function | operator ) - -class_specifier : - long_class_specifier | short_class_specifier | der_class_specifier - -long_class_specifier : - IDENT string_comment composition end IDENT - | extends IDENT [ class_modification ] string_comment composition - end IDENT - -short_class_specifier : - IDENT "=" base_prefix name [ array_subscripts ] - [ class_modification ] comment - | IDENT "=" enumeration "(" ( [enum_list] | ":" ) ")" comment - -der_class_specifier : - IDENT "=" der "(" name "," IDENT { "," IDENT } ")" comment - -base_prefix : - type_prefix - -enum_list : - enumeration_literal { "," enumeration_literal} - -enumeration_literal : - IDENT comment - -composition : - element_list - { public element_list | - protected element_list | - equation_section | - algorithm_section - } - [ external [ language_specification ] - [ external_function_call ] [ annotation ] ";" ] - [ annotation ";" ] - -language_specification : - STRING - -external_function_call : - [ component_reference "=" ] - IDENT "(" [ expression_list ] ")" - -element_list : - { element ";" } - -element : - import_clause | - extends_clause | - [ redeclare ] - [ final ] - [ inner ] [ outer ] - ( ( class_definition | component_clause) | - replaceable ( class_definition | component_clause) - [constraining_clause comment]) - -import_clause : - import ( IDENT "=" name | name ["." ( "*" | "{" import_list "}" ) ] ) comment - -import_list : - IDENT { "," IDENT } - -### B.2.3 Extends - -extends_clause : - extends name [ class_modification ] [annotation] - -constraining_clause : - constrainedby name [ class_modification ] - -### B.2.4 Component Clause - -component_clause: - type_prefix type_specifier [ array_subscripts ] component_list - type_prefix : - [ flow | stream ] - [ discrete | parameter | constant ] [ input | output ] - -type_specifier : - name - -component_list : - component_declaration { "," component_declaration } - -component_declaration : - declaration [ condition_attribute ] comment - -condition_attribute: - if expression - -declaration : - IDENT [ array_subscripts ] [ modification ] - -### B.2.5 Modification - -modification : - class_modification [ "=" expression ] - | "=" expression - | ":=" expression - -class_modification : - "(" [ argument_list ] ")" - -argument_list : - argument { "," argument } - -argument : - element_modification_or_replaceable - | element_redeclaration - element_modification_or_replaceable: - [ each ] [ final ] ( element_modification | element_replaceable) - -element_modification : - name [ modification ] string_comment - -element_redeclaration : - redeclare [ each ] [ final ] - ( ( short_class_definition | component_clause1) | element_replaceable ) - -element_replaceable: - replaceable ( short_class_definition | component_clause1) - [constraining_clause] - -component_clause1 : - type_prefix type_specifier component_declaration1 - -component_declaration1 : - declaration comment - -short_class_definition : - class_prefixes short_class_specifier - -### B.2.6 Equations - -equation_section : - [ initial ] equation { equation ";" } - -algorithm_section : - [ initial ] algorithm { statement ";" } - -equation : - ( simple_expression "=" expression - | if_equation - | for_equation - | connect_clause - | when_equation - | name function_call_args ) - comment - -statement : - ( component_reference ( ":=" expression | function_call_args ) - | "(" output_expression_list ")" ":=" component_reference function_call_args - | break - | return - | if_statement - | for_statement - | while_statement - | when_statement ) - comment - -if_equation : - if expression then - { equation ";" } - { elseif expression then - { equation ";" } - } - [ else - { equation ";" } - ] - end if - -if_statement : - if expression then - { statement ";" } - { elseif expression then - { statement ";" } - } - [ else - { statement ";" } - ] - end if - -for_equation : - for for_indices loop - { equation ";" } - end for - -for_statement : - for for_indices loop - { statement ";" } - end for - -for_indices : - for_index {"," for_index} - -for_index: - IDENT [ in expression ] - while_statement : - while expression loop - { statement ";" } - end while - -when_equation : - when expression then - { equation ";" } - { elsewhen expression then - { equation ";" } } - end when - -when_statement : - when expression then - { statement ";" } - { elsewhen expression then - { statement ";" } } - end when - -connect_clause : - connect "(" component_reference "," component_reference ")" - -### B.2.7 Expressions - -expression : - simple_expression - | if expression then expression { elseif expression then expression } - else expression - -simple_expression : - logical_expression [ ":" logical_expression [ ":" logical_expression ] ] - -logical_expression : - logical_term { or logical_term } - -logical_term : - logical_factor { and logical_factor } - -logical_factor : - [ not ] relation - -relation : - arithmetic_expression [ rel_op arithmetic_expression ] - -rel_op : - "<" | "<=" | ">" | ">=" | "==" | "<>" - -arithmetic_expression : - [ add_op ] term { add_op term } - -add_op : - "+" | "-" | ".+" | ".-" - -term : - factor { mul_op factor } - -mul_op : - "*" | "/" | ".*" | "./" - -factor : - primary [ ("^" | ".^") primary ] - -primary : - UNSIGNED_NUMBER - | STRING - | false - | true - | ( name | der | initial ) function_call_args - | component_reference - | "(" output_expression_list ")" - | "[" expression_list { ";" expression_list } "]" - | "{" function_arguments "}" - | end - -name : - [ "." ] IDENT { "." IDENT } - -component_reference : - [ "." ] IDENT [ array_subscripts ] { "." IDENT [ array_subscripts ] } - -function_call_args : - "(" [ function_arguments ] ")" - function_arguments : - function_argument [ "," function_arguments | for for_indices ] - | named_arguments - -named_arguments: - named_argument [ "," named_arguments ] - -named_argument: - IDENT "=" function_argument - -function_argument : - function name "(" [ named_arguments ] ")" | expression - -output_expression_list: - [ expression ] { "," [ expression ] } - -expression_list : - expression { "," expression } - -array_subscripts : - "[" subscript { "," subscript } "]" - -subscript : - ":" | expression - -comment : - string_comment [ annotation ] - -string_comment : - [ STRING { "+" STRING } ] - -annotation : - annotation class_modification - diff --git a/notes/modelica_limitations.txt b/notes/modelica_limitations.txt new file mode 100644 index 0000000..5c4294d --- /dev/null +++ b/notes/modelica_limitations.txt @@ -0,0 +1,2 @@ +Double derivative (eg, "der(der(x)) = a") is not allowed. +Partial derivatives are not allowed. diff --git a/notes/parsing.txt b/notes/parsing.txt index 6a13b76..a3c29ef 100644 --- a/notes/parsing.txt +++ b/notes/parsing.txt @@ -3,3 +3,6 @@ Parser Refs: http://notes.willcrichton.net/parsing-strategies-in-rust/ http://smallcultfollowing.com/babysteps/blog/2015/09/14/lalrpop/ https://github.com/nikomatsakis/lalrpop/ + + +libsyntax: rust lib for parsing rust itself diff --git a/notes/solve_for.txt b/notes/solve_for.txt new file mode 100644 index 0000000..b1cf81d --- /dev/null +++ b/notes/solve_for.txt @@ -0,0 +1,58 @@ + + x = a*y + c + y = 4 * c + + solve for [c] in terms of [a, x] + first solve for other unknowns: [y] + + x = a*(4*c) + c + + x = c * (1 + 4*a) + c = (1 + 4*a) / x + +N equations in M unknowns, P constants + + 0 = x + y + 0 = y*2 + 1 - x + +----------------------------------- + +solve_for(self, P: Vec, M: Vec, Q: HashMap) + + +returns a ModelicaModel with fixed components; equations are LHS identifier, in + correct order, no extends, no connections, name suffixed " (rewritten)", + components as Parameter (w/ val), Input, or Output + + +V variables +Q constants (become kwargs) +P bound vars (independent, inputs/passed, become like constants) +M unknowns (dependent, outputs) +N' total equations +N equations with unknowns + + V = Q + P + M + check: each Q is Integer or Float UnderSpecifiedConstant + filter N' to get N OverConstrained if extra equations + check: N >= M UnderConstrained + +while len(eqns) > 0: + 1. find first eqn with single unknown, and pop it + 2. rebalance to get unknown on LHS + 3. remove unknown from unknown list + +return: sort equations to match order + +solve_for(var) impl for SimpleEquation => Result + check: var only on one side VariableNotFound or NaiveImplementation + put var on LHS + recursively apply rules to symmetrically unwrap LHS onto RHS + if try to unwrap Abs: NaiveImplementation + +----------------------------------- +systems of differential equations: + will be N equations of N variables, in terms of implied time + +should be no unknowns; odex thing is just varying initial equations +have JS boxes to show ranges of initial conditions diff --git a/notes/spec.txt b/notes/spec.txt deleted file mode 100644 index 405629b..0000000 --- a/notes/spec.txt +++ /dev/null @@ -1,10 +0,0 @@ - -variable types: - state - parameter - constant - independent (?) - dependent (?) - time (special case?) - -"variables"? or "symbols"? or "quantities"? diff --git a/notes/tangle_demo.txt b/notes/tangle_demo.txt new file mode 100644 index 0000000..463abe1 --- /dev/null +++ b/notes/tangle_demo.txt @@ -0,0 +1,31 @@ + + +/experiments/%model/tangle.html +/experiments/%model/tangle-model.js + + + +this part in body's onLoad; after live script has downloaded. +var table = new Tangle (document.getElementById("MODELNAME"), { + initialize: function () { + this.CONSTANT = INIT; + this.IN_VAR = INIT; + }, + update: function () { + var vals = model(); + this.OUT_VAR = vals[0]; + this.OUT_VAR = vals[1]; + [...] + }, +}); + +

+ + +When the parameters are for VARSLUG, [...], + and the variables are + for VAR, then you get for OUTVAR + + + diff --git a/notes/webface.txt b/notes/webface.txt index 2932f8e..78306bd 100644 --- a/notes/webface.txt +++ b/notes/webface.txt @@ -21,3 +21,18 @@ hyperphysics plotly.js: d3.js and stack.gl https://plot.ly/javascript/ https://github.com/plotly/plotly.js + + +##### GUI Demos + +numeric.js + Has an ODE solver. Use with Elm? + +Tangle.js + Brett's JS widget-y thing. Very simple. + How did he do plots/graphs for those demos? + http://worrydream.com/Tangle/guide.html + +KaTeX LaTeX rendering + Faster than mathjax? + https://github.com/Khan/KaTeX -- cgit v1.2.3