Open nedisy opened 2 years ago
oh well, I don't know why it fails then 😂
sorry, there's still a bug. I didn't check for scope changes, so the integral result can't be updated. I couldn't find a way to pass scope change condition to my mathjs integrate function in the evaluation
This commit fixes bugs related to scope change, so now integral results will change as the math scope changes. As I mention I couldn't find a way to pass scope change condition to math.eval(), so I use cached scope and fast-deep-equal instead. Might add some performance penalty (about half of second maybe?).
minor changes:
@nedisy Thanks for this PR—numerical integration would be a nice complement to the diff
function we already have. I probably won't be able to look at this in much depth till this weekend, but I'll try to dig into it a bit then.
sorry, there's still a bug. I didn't check for scope changes, so the integral result can't be updated. I couldn't find a way to pass scope change condition to my mathjs integrate function in the evaluation
I'll look at this when I review, but...math3d-react
isn't super well organized in general, and the MathScope stuff is probably a particular weak point.
Incidentally: I will say I am a little hesitant to expand math3d-react
functionality too much right now. The reason is that I've started working on a re-write of math3d (https://github.com/ChristopherChudzicki/math3d-next) and I'd like to save any big changes for that rollout. (Which might not be particularly soon, but I'd like to get it done this year.) But adding an integration function like a reasonable step, and shouldn't present much difficulty in the migration.
IMO numerical integration makes sense for math3d, but mathjs-simple-integral
is for simple symbolic integration, right? That might be hard to fit into the existing framework, and I'm guessing it doesn't do very complicated integrals? Maybe not worth it. Also, I took a quick look at its github repo and, like math3d-react, it's using mathjs version 3. Good that it's using the same version as mathjs, but I'd really like to upgrade to mathjs 10 (!) in math3d-next.
Your recent PR #320 is deployed to production! 👏
Wow thanks for the deployment! I'm sorry I didn't fix the edge cases as you mentioned first, as I worked in the integral code.
Okay so as you stated, it's probably appropriate to not wait for your rewritten version of math 3d react. But if you are really hesitate to add, it's okay to wait for your rewrite. Coincidentally, my code is not too heavily depends on react or flow, so it should be easy to migrate it myself once your math3d-next is ready.
About mathjs-simple-integral, I used it because it's very fast, as it return a node that can be complied and stored in cache. I hope I still can use it tho in mathjs 10 because I couldn't find a way to make numerical integrator accurate and fast. For example integral from 0 to 1 of x dx might return 0.499999 and it would be very nice for simple integral to be exact. I can make it accurate by decreasing the step but it would not be very fast.
Oh my bad, the build fails because my GitHub setting will apply lowercase to my files, I don't know why, but should not be too hard to fix
Hello, this PR will add support for integration, with mathjs-simple-integral and numerical. As I mentioned in this #323, I tried to implement a cache system, and it works as expected. In my laptop (i5-10th gen), it took about a second to process the integration system, with most of the time is used to compile integration boundaries (probably more than 80%), as I can't find a way to cache it.
I made several changes in :
I also made minor changes in preprocessor for it to be able to process norm with vertical brackets, and add join operator to join list.
hope you like it 😁