David Sycamore

95 Reputation

4 Badges

6 years, 12 days

MaplePrimes Activity

These are replies submitted by David Sycamore

@Carl Love 

Thanks Carl.

Yes, single argument.

I have entered some data; two lines:



currently 11 numbers in each list. 

There is no formula linking the x to the f(x), it’s just an assignment of pairwise numbers, in which if x turns up in the calculation then I need the corresponding  f(x) value in order to continue. 

So let’s say there is variable A, being used in the calculation, whose current value is known. I  need to check if it is one of the x[i], and if it is, then I would like to assign variable B:=f([x[i]). Knowing B enables execution of the current calculation, si I can’t manage without it. There  is no proc in my script. 


Thanks, I am trying these options but not sure how (with any of them) to call f(x) for a given value of x. Also, above there are {  }  and [  ] brackets, does it matter which? 

@Carl Love 

Sorry for confusion. What I am trying to do is import data into a calculation in a code I already have. I have the data in the form (x,f(x)) for various values of x but I don’t yet have this anywhere in Maple, it’s all on paper at the moment. I am looking at ImportMatrix now.



ps: could we discuss on email? 


Thanks for your reply. 

The data is not yet in any file, I would need to create that. 

Example  of ( x,f(x)) are: (90,106), (94,48), (212,650).... I have ~50 data pairs like this and may need more later, but most likely not exceeding 100 pairs.  The variable x is a prime gap, f(x) is an associated parameter needed to perform a compatibility check consisting of an inequality. So the check would be : 

if Y< f(x) then proceed to calculation/output, otherwise select next prime in search list. Here Y is another variable associated with the prime in question, ie the current one in the list being checked.

Hope this makes some sense




@Carl Love 

Thanks very much for the replies. I will read ImportMatrix today.

The data does not exist yet in Maple, I have yet to learn how to do that. Can I incorporate it into the script or must it be a separate file? The code is looking for a prime having a particular property. It does this by checking each prime in turn, up to a limit. At each calculation, variable x is prime(n) - prime(n-1). The code must check to see if prime(n) fits the criteria of the associated x value, and this is what the data file is intended for. So f(x) should be imported to the calculation for the check, which decides if prime(n) meets the criteria or not. If yes the code does the rest of the calculation then proceeds  to output, if not it goes to prime(n+1). By « forgotten » I just mean that f(x), once used does not stay in the current memory because the next calculation will assign another value. The « used » current value should remain on file until needed again. Thanks so much for your advice, as you can see I am only a beginner.



Thank you very much, I included your script in my code and it works very well. 

much obliged



1 2 3 4 5 6 Page 6 of 6