BennyMopps

40 Reputation

One Badge

1 years, 63 days

MaplePrimes Activity


These are replies submitted by BennyMopps

@Carl Love 

Yes, i guess I could find certain combinations and use them as reference points such as if the combinations were only made up of a single element such as 1, or 5 or 256. 
applying a formula to these actually indicates all of these 'like' combinations are of equal value, from there I could 'dissect' the combinations eg half of the elements are 1 and the other half 2, then the next combination would be half of the elements 1 and the other half 3... etc. 

might be the best way to go about this.

@Jean-Claude Arbaut 

awesome, i will have a read.

@Kitonum @Carl Love

You guys helped me beforehand with a smaller problem which worked, wherefore in this one i have to deal with much larger combinations. The only real difference i made is the number of elements from which a combination is formed.

I tried two variations for this problem.

Ultimate.mw

 

@Kitonum @Carl Love that make sense, thank you so much

@tomleslie thank you very much. Having issues with getting maple onto my new computer atm, but hopefully i can test these variations soon.

@Kitonum thank you very much for your time and response.

 

It looks a lot simpler to use your format but are you able to explain why using '$'~ gives me combinations with repitition? for future reference, these little details can be a bit of a hunt.

thank you very much, this is exactly what I need @acer 

@nm That's ok, I really appreciate your help. I think I was very vague.

All I meant was that the values from the file represent the variables and their coefficients in the conic equation, 

I was hoping not to have to change the equation in maple or the values in the file, but i may have to change the equation.

as follows.

#Original

Conic:=a*x^2+2*h*x*y+b*y^2+2*f*x+2*g*y+c;
Delta[1]:=h^2-a*b;
Delta[2]:=<<a,h,f>|<h,b,g>|<f,g,c>>;
 
#new
Conic:=a*x^2+h*x*y+b*y^2+2*f*x+g*y+c;
Delta[1]:=(h/2)^2-a*b;
Delta[2]:=<<a,h/2,f>|<h/2,b,g/2>|<f,g/2,c>>
 
 

@nm thank you for pointing out the number of variables i had, i didn't notice. easy fix though.

 

This is great, the only issue i have with this is that the values i have in the file are a system of these equations, and so i need to account for the coefficients.

eg. where you have 

conic:=2*x^2-12*x*y+3*y^2+4 #(4=c)
it should be 

conic:=2*x^2-6*x*y+3*y^2+4

is this easily addressed by dividing the assignments by 2? 

 

@mmcdara thank you for that, i might experiment with it when given the time.

@nm Thank you very much, i think the issue was a lack of captial letters for Matrix and Vector, as you might see here

 

M:=readdata("C:\\Users\\bjense04.CSUMAIN.001\\Documents\\ass1Q2.txt",[float,float,float,float,float]):
convert(M,Matrix):
with(LinearAlgebra):
n:=RowDimension(convert(M,Matrix));
X:=convert(M[1..n,1..4],Matrix):
Y:=convert(M[1..n,5..5],Vector):
with(Statistics):
FullEQN:=LinearFit([1,a,b,c,d],X,Y,[a,b,c,d]);
#the next part is incomplete
rmse_mlr:=proc(model,X,Y)
local i, sq, n, predicted;
sq:=0:
n:=RowDimension(convert(M,Matrix)):
for i from 1 to n do
 predicted:=subs([a=X[i,1],b=X[i,2],c=X[i,3],d=X[i,4]],model);
 sq:=sq+(Y[i]-predicted)^2;
end do:
return sqrt(sq/n);
end proc;
 
 
it now works as intended
 
rmse_mlr(FullEQN,X,Y)
                       0.0663252848150695
 
Page 1 of 1