Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: 'Check if integer' topicStudent Support Forum > General > Archives > "Check if integer"

Next Comment >Help | Reply To Topic
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: ,

Subject (listing for 'Check if integer')
Author Date Posted
Check if integer Scott 06/20/12 00:14am
Re: Check if integer Bill Simpson 06/20/12 10:56am
Re: Re: Check if integer Scott 06/20/12 9:06pm
Next Comment >Help | Reply To Topic