nodepy/runge_kutta_method.py
changed.
Showing 1 of 1 files from the diff.
@@ -16,8 +16,8 @@
Loading
16 | 16 | ||
17 | 17 | * Find its radius of absolute monotonicity:: |
|
18 | 18 | ||
19 | - | >>> ssp104.absolute_monotonicity_radius() |
|
20 | - | 5.999999999949068 |
|
19 | + | >>> ssp104.absolute_monotonicity_radius() # doctest:+ELLIPSIS |
|
20 | + | 5.9999999... |
|
21 | 21 | ||
22 | 22 | * Load a dictionary with many methods:: |
|
23 | 23 |
@@ -2436,7 +2436,7 @@
Loading
2436 | 2436 | ||
2437 | 2437 | indices = "ijklmnpqrstuvwxyz" |
|
2438 | 2438 | ||
2439 | - | def elementary_weight_str_jump(tree,parent_label_index=None,node_label_index=0): |
|
2439 | + | def elementary_weight_str_jump(tree,parent_label_index=None,node_label_index=0,method_type='ERK'): |
|
2440 | 2440 | """ |
|
2441 | 2441 | Constructs elementary weights for a Runge-Kutta method |
|
2442 | 2442 | as strings suitable for setting constraints in JuMP. |
@@ -2468,10 +2468,13 @@
Loading
2468 | 2468 | ||
2469 | 2469 | for t in subtrees: |
|
2470 | 2470 | ret_str += elementary_weight_str_jump(t, node_label_index, node_label_index+1) |
|
2471 | - | if parent_label_index is None: |
|
2471 | + | if (parent_label_index is None) or (method_type == 'IRK'): |
|
2472 | 2472 | ret_str += " for "+nl+" in 1:s)" |
|
2473 | 2473 | else: |
|
2474 | - | ret_str += " for "+nl+" in 1:"+pl+")" |
|
2474 | + | if method_type == 'ERK': |
|
2475 | + | ret_str += " for "+nl+" in 1:"+pl+"-1)" |
|
2476 | + | elif method_type == 'DIRK': |
|
2477 | + | ret_str += " for "+nl+" in 1:"+pl+")" |
|
2475 | 2478 | ||
2476 | 2479 | return ret_str |
|
2477 | 2480 |
@@ -2486,11 +2489,11 @@
Loading
2486 | 2489 | >>> from nodepy import rk, rt |
|
2487 | 2490 | >>> tree = rt.list_trees(5)[3] |
|
2488 | 2491 | >>> rk.elementary_weight_str_matlab(tree) |
|
2489 | - | "b'*(A*(A*c.*c))" |
|
2492 | + | "(b'*((A*((A*c).*c))))" |
|
2490 | 2493 | >>> rk.elementary_weight_str_matlab(rt.RootedTree('{T^10}')) |
|
2491 | - | "b'*(c.^10)" |
|
2494 | + | "(b'*(c.^10))" |
|
2492 | 2495 | >>> rk.elementary_weight_str_matlab(rt.RootedTree('{{T^11}T}')) |
|
2493 | - | "b'*(A*(c.^11))" |
|
2496 | + | "(b'*((A*(c.^11))))" |
|
2494 | 2497 | """ |
|
2495 | 2498 | if root: |
|
2496 | 2499 | start = "b'" |
@@ -2513,6 +2516,9 @@
Loading
2513 | 2516 | Constructs Butcher's elementary weights for a Runge-Kutta method |
|
2514 | 2517 | as strings suitable for numpy execution. |
|
2515 | 2518 | ||
2519 | + | For MATLAB code or JuMP code, use the corresponding dedicated function |
|
2520 | + | instead of this one. |
|
2521 | + | ||
2516 | 2522 | **Examples**: |
|
2517 | 2523 | ||
2518 | 2524 | >>> from nodepy import rk, rt |
@@ -2520,8 +2526,6 @@
Loading
2520 | 2526 | >>> rk.elementary_weight_str(tree) |
|
2521 | 2527 | 'dot(b,dot(A,c**3))' |
|
2522 | 2528 | ||
2523 | - | >>> rk.elementary_weight_str(tree,style='matlab') |
|
2524 | - | "b'*((A*c.^3))" |
|
2525 | 2529 | >>> rk.elementary_weight_str(rt.RootedTree('{T^10}')) |
|
2526 | 2530 | 'dot(b,c**10)' |
|
2527 | 2531 | >>> rk.elementary_weight_str(rt.RootedTree('{{T^11}T}')) |
Files | Coverage |
---|---|
nodepy | 81.41% |
Project Totals (21 files) | 81.41% |
424.1
TRAVIS_PYTHON_VERSION=3.5 TRAVIS_OS_NAME=linux
423.1
TRAVIS_PYTHON_VERSION=3.5 TRAVIS_OS_NAME=linux
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file.
The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files.
The size and color of each slice is representing the number of statements and the coverage, respectively.