dharr

Dr. David Harrington

8697 Reputation

22 Badges

21 years, 80 days
University of Victoria
Professor or university staff
Victoria, British Columbia, Canada

Social Networks and Content at Maplesoft.com

Maple Application Center
I am a retired professor of chemistry at the University of Victoria, BC, Canada. My research areas are electrochemistry and surface science. I have been a user of Maple since about 1990.

MaplePrimes Activity


These are replies submitted by dharr

@sursumCorda Here's an algorithm using IntegerRelations:-LinearDependency, based on the LLL algorithm. It uses floats as an intermediate step but checks the obtained result is exact. It does the original examples, but not their reverse (expressing degree 6 roots in terms of degree 2 or 3 roots).

restart;

local gamma:

algconvert := proc(a::algnumext, b::algnumext)
description "writes algebraic number a as a polynomial in algebraic number b";
local Bs, i, Banum, cfs;
Bs := seq(b^i, i = 0..degree(op(1,b), ':-_Z')-1);
Banum:=evalf([Bs,a]);
cfs := IntegerRelations:-LinearDependency(Banum);
if evala(add(cfs*~[Bs,a])) <> 0 then return FAIL end if;
-evala(add(cfs[1..-2]*~[Bs]))/cfs[-1];
end proc:

Example 1.

a := RootOf(4*_Z^3 - 12*_Z^2 - 24*_Z - 25, index=1);
b := RootOf(2*_Z^3 - 3, index=1);
alias(alpha = a, beta = b);

RootOf(4*_Z^3-12*_Z^2-24*_Z-25, index = 1)

RootOf(2*_Z^3-3, index = 1)

alpha, beta

algconvert(a, b);
evala(a - %);
algconvert(b, a);
evala(b - %);

beta^2+2*beta+1

0

-(2/13)*alpha^2+(12/13)*alpha+2/13

0

Example 2

c := RootOf(_Z^4 + 1, index=1);
d := RootOf(_Z^4 + 6*_Z^2 + 1, index=1);
alias(gamma = c, delta = d);

RootOf(_Z^4+1, index = 1)

RootOf(_Z^4+6*_Z^2+1, index = 1)

alpha, beta, gamma, delta

algconvert(c, d);
evala(c - %);
algconvert(d, c);
evala(d - %);

(1/4)*delta^3+(1/4)*delta^2+(7/4)*delta+3/4

0

gamma^3-gamma^2+gamma

0

Example 3

a1 := convert(3^(1/3), RootOf);
a2 := convert(4^(1/4), RootOf);
3^(1/3) + 2^(1/2) + 1^(1/1);
B := RootOf(evala(Minpoly(%, x)), index=2);
evala(%% - B);
alias(alpha__1 = a1, alpha__2 = a2, beta = B);
 

RootOf(_Z^3-3, index = 1)

RootOf(_Z^2-2, index = 1)

3^(1/3)+2^(1/2)+1

RootOf(_Z^6-6*_Z^5+9*_Z^4-2*_Z^3+9*_Z^2-60*_Z+50, index = 2)

0

alpha, beta, gamma, delta, alpha__1, alpha__2

algconvert(a1, B);

FAIL

Succeeds with higher digits

Digits := 50;

50

algconvert(a1, B);
evala(a1 - %);
algconvert(a2, B);
evala(a2 - %);

277/151-(232/755)*beta-(174/755)*beta^2-(52/755)*beta^3+(213/755)*beta^4-(48/755)*beta^5

0

-428/151+(987/755)*beta+(174/755)*beta^2+(52/755)*beta^3-(213/755)*beta^4+(48/755)*beta^5

0

These fail

algconvert(B, a1);
algconvert(B, a2);

FAIL

FAIL

NULL

Download evala.mw

@sand15 That's a nice analysis. Both fits basically treat the first two points the same, so really many functions can fit equally "well" through two points. Condition numbers this high just confirm meaningless data. As you probably deduced, a+b*nu_c*nu^2 might make some sense since log(1+x) is approx x for small x = A*c*nu^2.

But really, better data more spread out is needed before one spends more time.

@MichaelVio Here's some plots to emphasize @sand15's point that your data do not fit to a parabola shape centered at positive nu, if that is what your are expecting.

MLfit.mw

@sand15 Nice analysis. The wildly different orders of magnitudes of the various quantities makes me nervous, aside from the likely poorly posed problem.

@Alfred_F @janhardo Maple's isolve finds the general formula for the Pell's equation, so no extra procedure is required. (It expresses it in terms of an arbitrary integer parameter _Z1 rather than the equivalent recursion.) My point to @janhardo was that his procedure testing if integers on a grid satisfied this equation is not a realistic way since very large numbers can be needed even for equations with relatively small coefficients.

@janhardo The test-on-a-grid method fails fairly quickly - try to find a solution for x^2 - 151*y^2 = 1 aside from (1,0) and (-1,0).

It's not clear what you want to do "on line". If you just want help with your integration, please upload a worksheet showing the example and what you mean by unstable. Use the green up-arrow, choose your file, click upload and then one of insert link or insert contents.

@GunnerMunk If you put simplify in the definition of the velocity function, then it works.

This is a bug and I have submitted an SCR ("bug report") to Maple.

 

restart  

Opgave b

 

Udbredelsesfarten er givet ved

 

"v(d):=simplify(sqrt(g*d)):"

 

med

 

g := 9.82*Unit('m'/'s'^2)

 

Vanddybden er 2,0 km. Dermed er farten af tsunamien

 

v__s := v(2.0*Unit('km'))"(=)"140.1427843*Units:-Unit(m/s)

 

Bølgelængden er

lambda := 120*Unit('km')

 

Dermed er perioden``

T := lambda/v__s

856.2695582*Units:-Unit(s)

T := lambda/v__s"(=)"856.2695582*Units:-Unit(s)

 

Dermed er tsunamiens fart v = 141 m/s og perioden

 

Download Error_2.mw

@MichaelVio Here is the other approach. I don't follow what you are trying to do, but the values you are using don't seem reasonable. Note that the approximations made in deriving the Planck law assume the volume is much much larger than the photon wavelengths and there are many many photon energy states in the frequency range; not sure they apply here.

phot3.mw

@GunnerMunk Please upload.

@C_R I think the new rule based system is likely an extra layer on top of the existing system to give more flexibility, but didn't change the existing lower-level system.

@salim-barzani It works after you remove "=0".

sys-Dr-D.mw

@salim-barzani As usual I do not set the ODE =0.
If you put the coeffs in a list rather than a set, they are in 1:1 correspondence with the monomials.

system1.mw

@MichaelVio The worksheet uses dsolve to solve your equation, but it has a singularity and won't work for the values you use.

phot2.mw

It explains how to find k*T, but doesn't work here because of the strange function.

In terms of the photon gas, it seems what you are doing is backwards. In the photon gas we have a formula for diff(E(nu),nu) which is a function g(nu) of nu (or omega) Eq 63.5, which is a peaked function (Fig. 7). So to find E(nu) you would integrate the right-hand side. If you want h*nu on the right hand side to be a function h(nu)*nu or E(nu) because you are doing some different physics, then the differential equation would just be diff(E(nu),nu) = g(nu,E(nu)).

If one integrates a peaked function, then the energy will be an increasing function of nu, and you will not find two values of nu with the same energy.

Instead you have written E(nu) = diff(g(nu,E(nu)), nu) for your similar function g, which seems backwards to me.

Edit: I am thinking of E(nu) as the energy of the photons in the gas with frequencies up to nu, but maybe you want some other interpretation. I am not following what you are trying to do.

@MichaelVio I cannot see the Landau&Lifsch.pdf, probably because the system doesn't like the & in the filename. Please upload again.

For 1, you have both he(nu) and h(nu), but I assume you mean to solve the de that led to it, assuming he(nu)=h(nu).

For 2, I am assuming that when you say "fit" you mean find the single value of k*T that makes those two conditions true.

1 2 3 4 5 6 7 Last Page 2 of 92