Comments (8)
Hi,
actually the api shouldn‘t have changed from 0.5.2 to 0.6.0 and the examples should still apply... don‘t they?
Well, but you are right, the readme is incorrect there. But it’s not only ‚y’ either. It should contain the „coords“ keyword. I will correct it tomorrow after work.
You can find some non-uniform examples in the test folder in the test_findiff module.
If you have any questions or notice bugs, please let me know. :-)
from findiff.
Using the examples found in the readme and /examples, the same error appears (in 0.6.0):
Traceback (most recent call last):
File "test2.py", line 58, in <module>
d_dx = FinDiff(0, x_nu, acc=2)
File "C:\Programs\Anaconda3\lib\site-packages\findiff\findiff.py", line 21, in __init__
self.root = PartialDerivative(*args)
File "C:\Programs\Anaconda3\lib\site-packages\findiff\findiff.py", line 210, in __init__
tuples = self._convert_to_valid_tuple_list(args)
File "C:\Programs\Anaconda3\lib\site-packages\findiff\findiff.py", line 262, in _convert_to_valid_tuple_list
self._assert_tuple_valid(t)
File "C:\Programs\Anaconda3\lib\site-packages\findiff\findiff.py", line 273, in _assert_tuple_valid
if h <= 0:
ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
The code used in /test is working.
from findiff.
OK, I tested a bit more. FinDiff still requires at least two arguments when using the coords kwarg, but it ignores the second argument (the spacing). To change the order of the derivative, we need to give FinDiff three arguments.
Code used to test it: https://gist.github.com/duartenina/d02791e2b3733d3e18ff829bc6e8b241.
EDIT: For 1D grids, it is necessary to wrap the coords in a list. The documentation is ambiguous in this case.
from findiff.
Thanks for the sample! I see I have mixed up the 0.5.2 API and what I tried out during development. Then I accidentally merged the experiments into the master, including their correctly running tests. ;-) I fixed that now and published a patch version 0.6.1 where the examples should run as in 0.5.2 with the same API. Could you try it, please?
from findiff.
The 0.5.2 API now works correctly, but the new one doesn't. It should accept "(axis, count)" for non-uniform grids.
, but if you give two or three args and the coords kwarg, it will interpret the second arg as spacing and ignore the coords.
Code here.
EDIT: This was the same behaviour as 0.5.2.
from findiff.
Oh, I see. I shouldn't rely on memory but look up the code history instead. ;-)
To be honest, I regret having introduced the syntax corresponding to the orange dots in your picture and actually would prefer to support only the syntax corresponding to the green one. It would make maintenance life much easier and is also more in line with the pattern for uniform grids (axis, spacing,[order]) <--> (axis, coords, [order]), where [] means optional. I'd appreciate your opinion on this. What do you think?
from findiff.
I also think it's more intuitive just to replace the 'spacing' for the 'coords'. I'm not sure what would be the advantage of the other syntax.
from findiff.
Agreed then. I have published 0.6.2 accordingly.
from findiff.
Related Issues (20)
- multi dimensional coordinates HOT 1
- Derivatives for a single point in a vector space HOT 1
- PDEs HOT 1
- Using findiff to solve the stationary Schrödinger equation HOT 2
- Allow the user to specify difference method HOT 2
- Problems with the stencil matrix HOT 4
- Time-dependency HOT 2
- First Order Schemes HOT 1
- Replace math images by latex expressions HOT 2
- Analytic inversion of Vandermonde matrix HOT 5
- Outdated conda-forge builds HOT 2
- Higher accuracy derivatives in 3D HOT 3
- Accuracy HOT 2
- How are the higher order derivatives computed in your code? HOT 1
- integrals in boundary conditions? HOT 2
- DOC: Equations seem broken on documentation site HOT 1
- Input for non-uniform spacing HOT 2
- Single point derivative
- possible typo in theory section
- Numerical derivative?
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 findiff.