## 192 Reputation

15 years, 305 days

## gc()......

Maple

Long story short, running a loop that takes random variables and does various statistical things to them.

The loop has to run about 10^7 times with the final value going into an Array but I cant do that because the Statistical stuff such as CumulativeDistributionFunction takes up so much memory that I end up losing the kernel.

But... Today I came across the gc() command. I put this in at the end of my loop (before the end do), and lo and behold I was using virtually zero memory for the loop. Only what was needed to fill an Array.

## Efficiency and large arrays...

Maple

Is there a faster way to do the following code? This takes 6.5 hours to run for n:=10...

> with(Statistics):
n := 1:
A := Array(1..10000000):

> for k to 10000000 do
t := RandomTools:-Generate(list(float(range=0..1,digits=20,method=uniform), n)):  # chooses 6 random variables from the interval [0,1]

t := sort(t):   # sort them in ascending order

## subscripts and ordering...

Maple

Wondering if anyone can help me with this long winded problem...

So... What I have to do is randomly select 6 numbers from the interval [0,1], not hugely important how many decimal places there are but I've used 10.

Ive written some stuff to do this

T := rand(0..1000000000000):

t := proc()
evalf(T()/1000000000000)
end proc:

C := proc(n)
local S,i:
S := NULL:
for i from 1 to n do
S := S, t(i)
end do
end proc:

## Number of primes...

Maple

I'm trying to write a code that does the following...

It takes a polynomial of the form a*x + b*x + c and cycles through vales of x from say, 1 to 100 then tells me how many primes i get. But what i want to do is start with x + x + 1 and then do x + x + 2.. etc for values of a,b,c from again, 1-100.

The following code will print all polys of the form a*x + b*x + c for a,b,c from 1-100.

for a to 100 do

for b to 100 do

for c to 100 do

print(a*x + b*x + c)

## Phaseportraits......

Maple

Hello, I have a function that produces different phase portraits as you change the variable x in the original equation. Im trying to find out at what values of x this change occurs...

So far I have determined the eigenvalues with regards to x and have run loops to find out roughly when this happens but i would like to be able to do this with either a procedure of perhaps dsolve or solve maybe?

So, given the eigenvalues, how would i go about doing this?

 1 2 3 4 5 Page 4 of 5
﻿