| Author |
Comment/Response |
Scott
|
06/20/12 00:14am
Hi,
I need to perform a check on and then a possible modification to a value to ensure it is an integer.
For example Let A=4/3 and dx=1/2. I want to check if A/dx is an integer and if it is increase A by the minimum amount to ensure that it is an integer.
The result must not be an approximation as I will use it in an indexing system for a grid to solve a PIDE by finite differences (perhpas this is a misguided attempt to do this anyway).
My attempt is:
A = A + u /. Solve[Mod[A + u, dx] == 0, u][[1]]
This has multiple problems: the result includes an InverseFunction object, an error message and, disregarding these, a smaller value for A (not larger).
Any help would be much appreciated...
URL: , |
|