w-Teilchen

75 Reputation

5 Badges

7 years, 198 days

MaplePrimes Activity


These are replies submitted by w-Teilchen

@acer The only thing that is still strange is that the specified range is ignored (ca. -0.25..0.25 instead of -2..2 in your plot).

@Kitonum Thanks for your reply. I tried it and got the expected result. However, I agree with vv. I'm using Maple as part of an lecture and try to encourage the students to use it. But even in seemingly trivial examples one has to take care to not get strange/unwanted/wrong results. For absolute beginners this is especially frustrating.

@vv It takes a couple of seconds to calculate and then yields a solution that is visibly non-circular.

with(plots):

plots:-contourplot(1/(x^2+y^2+0.1e-2), x = -2 .. 2, y = -2 .. 2, contours = 5, grid = [500, 500]);

 

``

Download contourplot2.mw

@acer Thank you for your detailed response. It has been a long time since I heard a lecture in computer algebra and I didn't pay attention to the potential problems that come with floating point numbers. I will take this into consideration from now on.
Nontheless, I feel that this is a common mistake that a lot of users are prone to make. Would it be a good idea to implicitely check whether any constants in the integrand can be turned into rationals?

@ThU Thank you for your response. With your suggestion I get the result (56/5)*EllipticE((4/7)*sqrt(3)) which evaluates to the correct result (11.525671...).

While this fixes my problem and I know to be careful with floating point numbers in the future, I find this behavior very counterintuitive. The format of the input shouldn't matter.

@ecterrab 

Hej Edgardo,

have you found time to look into the problem? After all this time, I've come back to the problem, I had back then, and would be interested in anything you've come up with.

Best regards, Sören

@Markiyan Hirnyk Thank you! Do you mean by "old issue" that it is not an issue in newer versions anymore?

@vv Hi vv, thank you for your fast reply, that solved my problem. I saved in an m.file because the example in the help does so. I experimented with different versions of saving in .txt-file and saving in a .m-file, getting different results. Every combination of saving only x or both x and n in either .m-files or .txt-files lets me substitute n but the version saving only x in a .m-file. None of the version remembers the property of n (your suggestion to save my assumption in a procedure would take care of that). Is the different behaviour wanted? And why is there an output for the .txt-file and none for the .m-file?

Saving x and n in a .txt-file:

restart

assume(`in`(n, real))

x := n+1

n+1

(1)

save x, n, "./both_x_and_n.txt"

restart

read "./both_x_and_n.txt"

n+1

 

n

(2)

about(n)

n:
  nothing known about this object

 

x

n+1

(3)

subs(n = 1, x)

2

(4)

Saving only x in a .txt-file:

restart

assume(`in`(n, real))

x := n+1

n+1

(5)

save x, "./only_x.txt"

restart

read "./only_x.txt"

n+1

(6)

about(n)

n:

  nothing known about this object

 

x

n+1

(7)

subs(n = 1, x)

2

(8)

Saving x and n in a .m-file:

restart

assume(`in`(n, real))

x := n+1

n+1

(9)

save n, x, "./both_x_and_n.m"

restart

read "./both_x_and_n.m"

about(n)

n:

  nothing known about this object

 

x

n+1

(10)

subs(n = 1, x)

2

(11)

Saving only x in a .m-file (only version that fails):

restart

assume(`in`(n, real))

x := n+1

n+1

(12)

save x, "./only_x.m"

restart

read "./only_x.m":

about(n)

n:

  nothing known about this object

 

x

n+1

(13)

subs(n = 1, x)

n+1

(14)

``

Download assume_and_save.mw

@Thomas Richard Thanks, I meant to get the coefficients in q, however that doesn't change a thing, the programs runs just as slow (as should be expected exchanging a factor of 1 by a factor of 9 should't make the task any easier).

I will try the newer version, maybe the issue has been fixed and is only present in my slightly outdated version

@Carl Love I thought about using the functions you suggested as well. However, when having a more general setting with zeros that aren't integers, I get "Error, (in roots) argument must be a polynomial over an algebraic number field". From what is written in the help concerning the roots-function I couldn't figure out how to overcome this problem.

@Mac Dude Hej! You are right, the semicolon trips things up. Reading in the parameters is necessary as I want to run multiple instances in parallel each with its own parameters. I thought it might be easiest to just pass a different set of parameters to my script each time.
Following an example I found for C, I was trying to use

$(sed -n ${SGE_TASK_ID}'p' myArgList.txt)

to read from myArgList.txt an task id dependend set of parameters. Do you know a better way?

Sören

Hi Edgardo,
thanks, now it works perfectly.
The Bose-Hubbard model describes Bose particles on a lattice that exhibit a repulsive interaction (described by the part I put into H) and a hopping to neighbouring lattice sites (described by V). As done in this paper (http://arxiv.org/abs/1401.0680), I'm interested in the phase change this model undergoes if one varies the hopping strength J. One way of obtaining the necessary terms in Kato pertubation theory is the process-chain approach (briefly described in the paper). These expressions are commenly calculated numerically, however at the phase boundary, the perturbation series diverges so that, it is insufficient to obtain just the first few orders. I'm currently working on replacing the graphical extrapolation, which is used in the paper. To do so, I wanted to get some analytical results for the first few orders. I did some calculations by hand, but figured that I might safe a lot of time using Maple.

Choosing particular terms, was mainly to evaluate their contribution and I was trying to manoeuvre around the problem with the projections in perturbation theory (http://www.mapleprimes.com/questions/201948-How-Can-One-Use-Projectors-In-Pertubation-Theory).

As soon as I have a version, which is satisfactory, I could post it in either this post or the one about projections in perturbation theory.

Best regards,

Sören

@ecterrab Hi Edgardo, is it likely that you will find some time to look into the topic soon? It is still of interest to me and probably to others as well. Thanks in advance. Sören

@Markiyan Hirnyk I didn't think you would want to invest any time in something that couldn't work (as I argued in my last post), thus I didn't post any code. You can take a look at it, maybe you see something that I missed.

Minimize.mw

Concerning DirectSearch: I did install it and am currently experimenting with it. So far the results aren't very promissing, and as my fit function is fairly complicated and, I assume, hard to compute, the evaluation takes hours, that's why I have produced only a couple of numbers which aren't as good as the once I obtained using Fit. So far I think this might be a consequence of my use of DirectSearch. The following is an example of what I did. On my machine it would take at least an hour to get a result.

DataFit.mw

Thank you for your help.

@Markiyan Hirnyk Thanks for the alternative. I tried Optimization:-Minimize but it doesn't give me any useful results, as my numbers are growing exponentially, minimizing the norm without weighting them differently results in a fit that is dominated by the last points. I didn't give it much time and couldn't find a way to introduce weights in LinearAlgebra:-Norm.

1 2 Page 1 of 2