Axel Vogt

5821 Reputation

20 Badges

20 years, 228 days
Munich, Bavaria, Germany

MaplePrimes Activity


These are answers submitted by Axel Vogt

Hm ... do not want to comment your wish for fsolve ...

But solve( f(x)=0, x, UseAssumptions) assuming x>0; does not work for me (in Maple 12)
and it looks quite idiotic as command: why should I say "I want to be done what I want" ...

However solve( {f(x)=0, x>0}, x); returning a set seems natural to me (and if having only
1 element then op(%) is what you want): the solution of equations is a set and in best
cases that set is finite (or discrete in the Reals or Complex). I am fine with it.

Just my 2 Cents only ...
 

While your equations are almost clear - you want to know values for variables -
your last question is unclear. But you have to use the letter "I" for "sqrt(-1)",
it has that meaning in Maple (or first use j:= I, but just get used to that).

Maple 'almost' can do it. However you have to tell it what you mean:

  eq:=sqrt(5) = abs(1+z*I);
  solve(eq, z) assuming z::real;
  #            ^^^^^^^^^^^^^^^^

                                -2, 2

Here you tell Maple that your indeterminate is a Real. And in that case it finds
the solution of the quadratic equation sqrt(5) = sqrt(1+z^2). Fine.


If you do not do that, then the situation is *very* different (though it would
help if Maple would drop some warnings, there are more solutions then 2 ...):

  eq := sqrt(5) - abs(1 + r*exp(phi*I)*I);    # use polar coordinates
  [solve(eq, r)] assuming (0 < r, phi::real); # try to find the radius

This is a 'quadratic' equation with 2 solutions, we take the positive one, which
here is the 1st one:

  R:= op(1,%);
                                           2     1/2
                  R := sin(phi) + (sin(phi)  + 4)

Now it turns out that z = R*exp(phi*I) is a solution for *any* phi:

  eval(eq, r=R);
  simplify(%) assuming phi::real;

                                  0

Those z can be visualized they ly on a circle (center = I, radius = sqrt(5)):

  R*exp(phi*I);
  # % - I; % / sqrt(5);               # activate it to see it as the unit circle
  plot( [Re(%), Im(%), phi= - Pi .. Pi]);


For your first equation you also have to use 'assume' to tell Maple in which
situation you want to work.
seems your brackets do not match ... something like that
might answer your needs:
diff(y(t),t,t) + t*diff(y(t),t) + 4*y(t) = 0;
dsolve(%);
diff(%, t); simplify(%);

or

diff(y(t),t,t) + t*(diff(y(t),t) + 4*y(t)) = 0;
dsolve(%);
diff(%, t);

Just a quick try: isnt that a differential equation for g : = f @ e ?

Can't help myself, I find it funny anyway :-)

I struggled with it and think your maximum is 4*arctan(3) ~ 4.9... for h = L/2 = 1/400 and g = 0+
That would explain, why the optimizer 'fail': it is at the boundary. And h = L/2 gives numerical
troubles for y = 0 and x ---> 0 (i.e. for g ---> 0).

Edited: up to the factor B[r]/(4*Pi), which is not needed for the maximum

never will understand that ... though it is convenient for reading

mathematically it is equivalent to use t(n) instead of the indexed version,
whatever the notations are like (Maple's) t[n]

and using the 'function' notation seems not to disturb Maple

It seems you have some design in mind for a system, ask partial questions
and reject answers by refering to something never mentioned. More or less.

You may wish to consider rethinking that ...


More or less it sounds as if you want a kind of trading sheet or similar
and it simply may be, that Maple as interface is not the right tool. It
is not actually ripe for building applications (though you might try to
go towards Maplets).

A quite common way is to separate things and when I did such trading stuff
for a bank the common choice was Excel (else you need serious coding).

It allows for handling while 'in the background' several other stuff can
run, one has something like 'event driven', you can switch to 'data driven'
by code.

Though Excel is poor in some parts it is superior in others. Like that.
If you use it as an interface (and VBA for code).

The system was roughly a data source (delivered from a separate server(s),
no need to care for that), an inhouse access via DDE (to feed the Excel),
a timer in Excel VBA for updating data (which one can always shut down by
a 'button' or else), VBA code for processing data - and the good internal
ability of Excel to interact with the user (which it once was designed for).

But Maple primarily is a CAS. With some numerics. And very incomplete for
what you may have in mind:

It would make sense to devote computations to Maple, ok. But fetching data
already becomes questionable (what if the connection brakes down? data are
not valid? ...). Even the userinterface is hairy.

As soon as you step in you will notice, that you have 'sequentialize' your
demands. By own coding. Excel has a very ripe scheduler which does that.
It is one of the central, essential and proprietary parts.

Of course you do not need Excel for that and a serious application would
be better and that of course is done (in layered systems).

But not based on a CAS - currently not the right tool for an application.

a) Your e does not have a numerical value, if you mean the exponential function then just use it.
Moreover if you can not plot, then evaluate the function in some of the points to see what may be
the reason.

b) Maple simplifies to its known constants, of course. But you can fake:
 

sin(0):= 'sin'(0);

sin(0);
                                sin(0)

evalf(sin(0));
                                  0.

sin(0.0);
                                  0.

At least your eta is a function of 2 variables, so you have to say what you mean to us and Maple:
unary just means 'function of 1 variable'

eta:= (x,y) -> (D[1](u)(x,y))^2 + ((D[2](v)(x,y))^2)^n is what you want for eta, but may be you even
mean 'differentiating twice' with your powers of 2 ...

It has not so much to do with Maple ...

 restart: Digits:=14:

f:= x -> x^2-5:
NR:= proc(f,z,M)
local a,A:
  A:= 0;
  a := z:
  for A to M do:
    a := evalf(a) - (f(a)/D(f)(a))
  end do:
return("done.");
end proc:
 
# worm up: a first call enforces to load all one needs
NR(f,1,1): 

# now let it run
myM:=5;
start:=time[real]():
NR(f,1,myM);
finish:=time[real]():
`seconds` = finish-start;

                               myM := 5
                               "done."
                           seconds = 0.094

myM:=1600;
start:=time[real]():
NR(f,1,myM);
finish:=time[real]():
`seconds` = finish-start;

                             myM := 1600
                               "done."
                           seconds = 1.031


This is involves more Maple by computing f/f' first

 restart: Digits:=14:

f:= x -> x^2-5:
g:= f/D(f);
NR:= proc(f,z,M)
  local a,A:
  a := z:
  for A to M do:
    a := evalf(a) - g(a)
  end do:
return("done.");
end proc:
 
# worm up: a first call enforces to load all one needs
NR(f,1,1): 

# now let it run
myM:=1600;
start:=time[real]():
NR(f,1,myM);
finish:=time[real]():
`seconds` = finish-start;

                             myM := 1600
                               "done."
                           seconds = 0.094

Of course it does not make too much sense to have myM = 1600
here (for Newton's method), but I hope it gives you an idea.


[solve(f(x)=0,x)]; evalf(%);

                              1/2    1/2
                            [5   , -5   ]
                 [2.2360679774998, -2.2360679774998]

Besides Maple specifics (which I am only partly aware) this is quite common.

I would use more steps (so it need at least more than 1 sec).

And I would use a 'worming up' for loading needed components.

For Maple please be aware, that 'restart' does not really do what one would
expect from that name, it still holds some information in the system (but you
can overcome most of that issue for timing by the above).

You may wish to upload the question as worksheet (in classical format), your question is a bit too cryptic.

Anyway: the system alraedy replies by pointing you to some handling error: "Warning, inserted missing semicolon at end of statement"

I know forums, where you neither can delete nor modify uploaded sheets.

At first this sounds a bit odd, however it complements rules like not
allowing to earse or modify postings (except through the admin).

So you have to live with your sins :-)

Setting files to 'private' is a fair trade for me, usually.

If you want to be sure of your ownership: put it to your own web space
and reference by linking (drawback: will be lost if you gave it up).

BTW: if they have some good sense the files still are stored, but at
a different area, for rare but possible legal reasons.

Mike,

In coding you always should care for exceptions. Just do it.

log(x)*x; limit(%, x=0, right);
                                  0

First 59 60 61 62 63 64 65 Last Page 61 of 92