scallopedpancake

25 Reputation

3 Badges

4 years, 232 days

MaplePrimes Activity


These are questions asked by scallopedpancake

I'm having some trouble finding how to do this: given some field with spacetime indices, say h[mu,nu] and a Lagrangian L of that field, I want to do a n+1 split to find the canonical momentum pi[~mu,~nu]. I can do the splitting fine, but it's calculating the canonical momentum that is the problem. I've tried a couple of different methods using diff and SubstituteTensorIndices but I can't get it to work: I either get the wrong answer or zero (also wrong). Anyone with any ideas or a working example of this, I'd appreciate to hear from!

I've got a really bizarre error. In my quite short code, if I do not have the print statement, I get the error message 'Error, (in fib_even_sum) illegal use of an object as a name'. If I do use the print statement, the code runs fine, albeit having printed an unnecessary zero.

Here's the code:

fib_even_sum := proc()::integer:

options threadsafe,autocompile:

uses combinat:

local val := 0, n := 1, FN := 0:

#print(%);

while FN <= 4000000 do:

if type(FN,even) then:

val += FN:

else end if:

++n:

FN := fibonacci(n):

end do:

return val:

end proc:

fib_even_sum();

I can't see what would be making it behave like this; perhaps I'm missing something really obvious?

I'm asking this because I'm sure I'm just missing something.

If I solve a DE with numerics, i.e., dsolve(...,numeric), I get a procedure, say h. I want to answer: if I have a point a that I know, what are the root(s) of h(x) - h(a) = 1? In other words, solve for x.

I thought this would just involve something like fsolve or solve/evalf, or perhaps a root finding package, but I can't figure it out. What I want to avoid is having to write a procedure to hone in on the root myself, since my code is already quite slow.

Any help would be greatly appreciated.

EDIT 1: Here is my MWE (or, what should work in my mind but doesn't). The ODE isn't important, it's just an easy example.

restart;

ode := diff(f(x),x) = f(x);

initial_condition := f(0)=1;

a := 1;

h := dsolve({ode,initial_condition},numeric);

solution := fsolve(h(x) - rhs(h(a)[2]) = 1);

If I have a tensor T[mu,nu,alpha] in 3-dimensions which is symmetric on {mu,nu} and anti-symmetric on {nu,alpha}, then the number of independent components should be zero. However, if I put this into Maple, using Library:-MinimizeTensorComponents followed by Library:-NumberOfIndependentTensorComponents it returns 4.

Any insight into why it does this would be great, thanks.

Page 1 of 1