kfli

70 Reputation

4 Badges

8 years, 81 days

MaplePrimes Activity


These are replies submitted by kfli

@tomleslie 

Hey thank you for the tips! The specific example above did not work on my computer. For some reason it just stopped. No error, no if statement break or nothing. So I was hoping for a solution to that but if it worked for you then I am not sure what is wrong. 

#1 Yes you are right, that was a bit lazy I suppose. I will fix that. 
I used Q := R/~df;

#2 I can't believe I didn't think of that... since I had the same notations in other parts of the code.

#3 Thanks, that's  fixed now.

@Adri van der Meer 

Right, is there a way to check in an if-statement if R1 is

R1 := [2];
 or 
R1 := 2;

for example?

And is there a way to convert R1 into a regular scalar instead of a 1x1 matrix?

@tomleslie 

 

Hey! 

Yes that was what I was looking for... but 

My specific procedure needs to be able to have differing x vector length

for example 

restart;

x = [x1 x2... xN]
myV:=proc(x)

                    N=length(x);
                    Vector(N,[x1+2*x2, x2^2+x1,..., xN+x[1]]);
          end proc;
CodeGeneration:-Matlab( myV,
                                            output="C:/Users/TomLeslie/Desktop/test.m"
                                         );

 

something like this... would that work you think?

@Carl Love @mehdi jafari 

Thanks for the reply!
I need the matrix for evaulations in another code. I build the equations and Jacobian in one file, save them, then upload them in another file wheere they are repeatedly evaluated/solved.

The jacobian looks something like 

J[1,1] = B*(x[1]+x[2])
J[1,2] = B*(3*x[2]) ....
etc. This is just made up but that is basically what the elements look like.

Then in the "solver" file I compute B and then evaluate the J with B and x values. So basically I only need it for numeric evaluations, not symbolic analysis.
 

@Carl Love Thank you for the reply! I was hoping the fix was going to be a easier. Do you know of any way I could apply the freeze and thaw to my specific problem? I couldn't seem to get it work.

1 2 Page 2 of 2