You are not logged in.

- Topics: Active | Unanswered

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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,797

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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.**

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

```
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.**

Offline

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

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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,797

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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,797

Ok.Let's go step by step.

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

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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,797

And what is N[l,dig]?

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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: 91,693

```
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,797

hi bobbym

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

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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,797

What is that vector? I am confused.

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

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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,797

hi bobbym

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

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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,797

Oh,ok.

So what is multiplied by 10^dig?

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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,797

See if this helps:

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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,797

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

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

The knowledge of some things as a function of age is a delta function.

Offline

**bobbym****Administrator**- From: Bumpkinland
- Registered: 2009-04-12
- Posts: 91,693

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