Carl Love

Carl Love

28045 Reputation

25 Badges

12 years, 335 days
Himself
Wayland, Massachusetts, United States
My name was formerly Carl Devore.

MaplePrimes Activity


These are replies submitted by Carl Love

@mehdi jafari I think that one problem is that in your eq1 (in problem 3.mws) there occurs both a[1](t) and a[1] without the (t). Is that what you really intended? I can't think of any reason why someone would want to use the same variable as both a function and a non-function in one expression.

For your sample probem with eq1, eq2, and eq3, can you write down "by hand" what the Matrix A should be? That is, does there exist A such that A . < a1(t),a2(t),a3(t) > = < eq1,eq2,eq3 >. It is not clear to me that such A exists.

Another way is to wrap the sum in a procedure. I think that that is more robust.

I see that you also asked for suggestions on simplifying your code. Well, all your procedures can be made one-liners with arrow -> notation. nn can be simplified further because function application distributes over operators. I also changed the grammar of your comments from passive declarative to active imperative.

restart:
with(Physics):
Setup(mathematicalnotation= true):
Setup(anticommutativeprefix= Psi):

#Define the annihilation operators, which depend on indicies (i, j, sigma).
am:= (i,j,sigma)-> Annihilation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):

#Define the creation operators, which depend on indicies (i, j, sigma).
ap:= (i,j,sigma)-> Creation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):

#Program the occupation number at state (i, j, sigma).
nn:= ap.am:

#Define an operator for the total number of particles.
N:= (i,j,Sigma,f)-> sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f):

Another way is to wrap the sum in a procedure. I think that that is more robust.

I see that you also asked for suggestions on simplifying your code. Well, all your procedures can be made one-liners with arrow -> notation. nn can be simplified further because function application distributes over operators. I also changed the grammar of your comments from passive declarative to active imperative.

restart:
with(Physics):
Setup(mathematicalnotation= true):
Setup(anticommutativeprefix= Psi):

#Define the annihilation operators, which depend on indicies (i, j, sigma).
am:= (i,j,sigma)-> Annihilation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):

#Define the creation operators, which depend on indicies (i, j, sigma).
ap:= (i,j,sigma)-> Creation(Psi, 6*(i-1)+2*(j-1)+sigma, notation= explicit):

#Program the occupation number at state (i, j, sigma).
nn:= ap.am:

#Define an operator for the total number of particles.
N:= (i,j,Sigma,f)-> sum(sum(sum(nn(i,j,sigma), sigma= 1..2), j= 1..3), i= 1..f):

I answered your followup question in the separate thread.

Don't crosspost, i.e., don't post the same thing in multiple places. I deleted three (!!!) copies of your followup question from this thread.

@Jimmy Here is your file with my modifications. It is essentially the same code as the one that I did with fake data. I needed to expand your parameter ranges in order to get a good fit. I hope the new parameter values make sense for your problem.

 

(**)

restart:

readdata(

V := Vector(%, datatype = float[8]):

readdata(

idata := Vector(%, datatype = float[8]):

dim := LinearAlgebra:-Dimension(V):

(**)

Model:= i0*(exp(1000*(v-i*rs)/n0/(259/100))-1)-i;

i0*(exp((100000/259)*(-i*rs+v)/n0)-1)-i

(**)

NewModel:= solve(Model, i);

(1/100000)*(259*n0*LambertW((100000/259)*i0*rs*exp((100000/259)*(i0*rs+v)/n0)/n0)-100000*i0*rs)/rs

FIT := Statistics:-NonlinearFit(Model, `<|>`(V, idata), Vector(dim), [v, i], parameterranges = [i0 = 10^(-8) .. 4*10^(-5), rs = 100 .. 1000, n0 = 1 .. 100], output = [residualsumofsquares, parametervalues]);

[0.362292011000478e-8, [i0 = HFloat(4.952580365537116e-6), n0 = HFloat(34.83341997726145), rs = HFloat(301.04879672903326)]]

(**)

Curve:= plot(eval(NewModel, FIT[2]), v= 0..1):

(**)

Points:= plot(< V | idata >, style= point, color= green):

(**)

plots:-display([Curve, Points], axis[2]= [mode= log]);

(**)

 

``

 

Download TE.mw

I don't think it fair that you criticize my answer so harshly when you didn't post your code. If I had seen that you were using big integers, I would've figured out the problem.

I don't think it fair that you criticize my answer so harshly when you didn't post your code. If I had seen that you were using big integers, I would've figured out the problem.

I think that learning the syntax of Maple "sharpens" or "focuses" the mind towards mathematical thinking.

(I think this is more appropriate as a Post rather than a Question as this is an open-ended topic.)

The fit is so good that you won't be able to distiguish the two parts of the combined plot. It will just look like one line.

The links to your data files do not work. Please try uploading them again.

@Markiyan Hirnyk Sorry, I forgot about opaquemodules because it is in my initialization file. Before doing the showstats, issue the command

kernelopts(opaquemodules= false):

@Markiyan Hirnyk Sorry, I forgot about opaquemodules because it is in my initialization file. Before doing the showstats, issue the command

kernelopts(opaquemodules= false):

Can you write down exactly what you expected the answer to be? Then I can tell you how to get that answer.

@Ahmadomari My code is just intended to replace the one procedure Chisqr1. Your code outside of that procedure was fine.

@Ahmadomari My code is just intended to replace the one procedure Chisqr1. Your code outside of that procedure was fine.

@Alejandro Jakubi It's like you say. In Maple 17.00/32/Windows 8, I killed it after 90 seconds. In Maple 16.02/64/Windows 8, it finished in 9-10 seconds (obtaining essentially the same answer).

First 621 622 623 624 625 626 627 Last Page 623 of 709