Discussion about math, puzzles, games and fun. Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ π -¹ ² ³ °

You are not logged in.

- Topics: Active | Unanswered

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

Nothing, if it is working. But built in functions are faster and use less memory.

**In mathematics, you don't understand things. You just get used to them.**

**I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

Ok,I'm gonna try both.I think there is a time measuring function in Maxima.Let me see if I can use it somehow.

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

It will you be your code so use whichever one you like, we have several more lines to translate.

**In mathematics, you don't understand things. You just get used to them.**

**I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.**

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

```
pslq[l_, dig_] := Module[{a},
a = IdentityMatrix[Length[l]];
a = Append[a, 10^dig*N[l, dig]];
(*a=Transpose[a];
a=Rationalize[a,10^-dig];
a=LatticeReduce[a];
Take[a,All,{1,Length[l]}]*)
a];
```

Use the addrow function to replace the append.

**In mathematics, you don't understand things. You just get used to them.**

**I agree with you regarding the satisfaction and importance of actually computing some numbers. I can't tell you how often I see time and money wasted because someone didn't bother to run the numbers.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

Hi bobbym

Should the function append it on the right or down?

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

On top of the identity matrix. Addrow is the maxima command to do that.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

Ok.I found the Transpose.What is Rationalize?

Here lies the reader who will never open this book. He is forever dead.

Taking a new step, uttering a new word, is what people fear most. ― Fyodor Dostoyevsky, Crime and Punishment

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

Maxima has a rationalize command.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

Ok.Let's go step by step.

What is what in here: 10^dig*N[l, dig]

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

The parameter of the function call pslq(l,dig). l is basis vector and dig is the number of digits.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

And what is N[l,dig]?

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

That is mathematica taking the list of constants and turning them into floating point numbers.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

```
pslq[l_, dig_] := Module[{a},
a = IdentityMatrix[Length[l]];
a = Append[a, 10^dig*N[l, dig]];
(*a=Transpose[a];
a=Rationalize[a,10^-dig];
a=LatticeReduce[a];
Take[a,All,{1,Length[l]}]*)
a];
```

The lattice reduce command that is the problem.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

hi bobbym

How does one append a vector length 2 to a square matrix of arbitrary size?

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

The vector is 1 x n and the matrix is n x n.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

What is that vector? I am confused.

How does the vector look like? And how would that translate to Maxima?

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

The vector is inputted by the user it contains the constants and the value to be fit.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

hi bobbym

And 'dig' is the number of digits of what?

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

For the PSLQ you have your constants, like 5, pi, sqrt(3), e and you have the value you want to determine to some amount of digits.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

Oh,ok.

So what is multiplied by 10^dig?

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

The vector of constants and the number.

That is easy, the problem is there does not seem to be a lattice reduce. This is the heart of the algorithm.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

See if this helps:

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

Yes, I have already been looking at that. It is written in Lisp, which I have entirely forgotten. The chances of getting that to work are one in ten thousand.

**In mathematics, you don't understand things. You just get used to them.**

Offline

**anonimnystefy****Real Member**- From: The Foundation
- Registered: 2011-05-23
- Posts: 15,657

But,if we don't get to the lattice reduce part,there is no point in being able to do the lattice reduce part.

Here lies the reader who will never open this book. He is forever dead.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 90,485

All the rest of my function is simple almost cosmetic. I could get around all of it one way or another. The lattice reduce is the actual algorithm.

**In mathematics, you don't understand things. You just get used to them.**

Offline