cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - Help us improve the PTC Community by taking this short Community Survey! X

How to correct the Pell(n) function ? (for n = 181)

lvl107
20-Turquoise

How to correct the Pell(n) function ? (for n = 181)

Hello Everyone,

Pell%28181%29.PNG

How to correct the Pell(n) function ? ( for n = 181)

Thanks in advance for your time and help.

Regards.

ACCEPTED SOLUTION

Accepted Solutions
Werner_E
25-Diamond I
(To:lvl107)

For some N (like 2,5,10) m is just 1 (second element of C is already greater than the root of N) and so your calculation of the rearranged vector c fails. Either include another if-statement to cope with that case (then c<--C) or do it completely different like in the attached.

1.png

0.png

View solution in original post

14 REPLIES 14
StuartBruff
23-Emerald III
(To:lvl107)

Looking at Numerical Recipes, I think you need to add a correction factor in for when w[0,1 is zero.

Stuart

lvl107
20-Turquoise
(To:StuartBruff)

I greatly appreciate your help, Stuart.

With :

Pell

http://www.jakebakermaths.org.uk/maths/jshtmlpellsolverbigintegerv10.html

(2).PNG

Best Regards.

StuartBruff
23-Emerald III
(To:lvl107)

Unfortunately, I'm Mathcadless for a week or so, but you can define your function as follows.

Rename my function to PellA.

Define

Pell(n):=p <-PellA(n, infinity)

stack (p[1, p[2)

thenPell(P181).

Stuart

lvl107
20-Turquoise
(To:lvl107)

Hello Everyone again,

1.PNG

2.PNG

Now I need help with correcting the Pell_Test(N) function, the above. ("This array index is invalid for this array")

Thanks in advance for your time and help.

Best Regards.

Werner_E
25-Diamond I
(To:lvl107)

For some N (like 2,5,10) m is just 1 (second element of C is already greater than the root of N) and so your calculation of the rearranged vector c fails. Either include another if-statement to cope with that case (then c<--C) or do it completely different like in the attached.

1.png

0.png

lvl107
20-Turquoise
(To:Werner_E)

I greatly appreciate your help. The answer is very neat . Many, many thanks, Werner.

3.PNG

By the way, I need help with how to type "the thin equal sign" (the green circle) in Mathcad 14.

Best Regards.

Message was edited by: Loi Le

Werner_E
25-Diamond I
(To:lvl107)

By the way, I need help with how to type "the thin equal sign" (the green circle) in Mathcad 14.

Same way as the * and the +. If you create a math region and you type Ctrl-Shift-K (cursor gets red as in a text region) you can use literally any character in a variable name. Pressing Ctrl-Shift-K again brings you back to normal mode. That way you can use characters in variable names which normally would be taken as operators. The sam way you can also insert some spaces instead of using the underline character as you had done.

lvl107
20-Turquoise
(To:Werner_E)

I got it. . Many, many, many thanks, Werner. .

Best Regards.

lvl107
20-Turquoise
(To:Werner_E)

I guess the Pell_Test(N) function need to adjust a little bit :

4.PNG

after adjusting a little bit :

5.PNG

And while I am learning about match( ) , submatrix( ) function, I adjust the function a little bit :

3.PNG

Thanks again.

Best Regards.

Message was edited by: Loi Le

lvl107
20-Turquoise
(To:lvl107)

Or :

Pell

Regards.

lvl107
20-Turquoise
(To:lvl107)

Pell Equation Example (57,58,59,60,61,62).PNG

lvl107
20-Turquoise
(To:lvl107)

Pell Equation Example (57,58,59,60,61,62).PNG

lvl107
20-Turquoise
(To:lvl107)

Pell(2 to 15).PNG

lvl107
20-Turquoise
(To:lvl107)

Pell(2 to 14).PNG

Announcements

Top Tags