Skip to content

Support for equation systems - #183

Merged
PaddiM8 merged 8 commits into
PaddiM8:masterfrom
f0ss117:master
May 1, 2026
Merged

PaddiM8 merged 8 commits into
PaddiM8:masterfrom
f0ss117:master

Conversation

@f0ss117

@f0ss117 f0ss117 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor

Here is a support for equation systems as discussed in #182
The syntax is simple, the equation system begin with {, end with } and equations are separed with ; (it is optionnal but possible to use a new line for each equation, the ; remains needed)

Here is a simple example :

>> {2a + b = 7;
a - b = 2}
(a, b) ≈ (3, 1)

Hugo Galli added 5 commits March 15, 2026 17:46
A user reported that kalker outputs `0b0.001 = 0.1_2`. The problem was coming from `to_radix`pretty`
After this commit, kalker outputs correcty `0b0.001 = 0.001_2`
@f0ss117

f0ss117 commented Apr 16, 2026

Copy link
Copy Markdown
Contributor Author

I think I need to write some doc to explain what were my choices and where are the differents parts of the code/what they do. Do you have an idea where I can do so ?

@PaddiM8 PaddiM8 left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow this is really cool actually. I have a few minor suggestions but apart from that I think it looks good.

I agree that it would be good to document it a bit. I like to keep it in the code, like above function(s) with /// syntax even if it goes quite deeply into detail. And maaybe a link to some description of the algorithm in a comment for eval_equation_system.

Comment thread kalk/src/parser.rs Resolved
Comment thread kalk/src/parser.rs Resolved
Comment thread kalk/src/interpreter.rs
numerical::find_root(context, &expr, &unknown_var.full_name)
}

fn eval_equation_system(

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are some similar functions in numerical.rs so it might make sense it to place this function in that file as well

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I will change the location of the function !

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just checked, but it seems that there are no "eval_..." function declared in numerical.rs. They are all in interpreter.rs. Are you sure you want me to move the function ?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh sorry, I meant moving the logic to numerical.rs but yeah there would still be a eval_equation_system function in interpreter.rs. Similar to eval_equation in interpreter.rs, which calls find_root in numerical.rs.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've just moved almost everything to numerical.rs, so now eval_equation_system really looks like eval_equation
What do you think of that ?

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great! Looks good

@PaddiM8
PaddiM8 merged commit 70ac224 into PaddiM8:master May 1, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants