solve differential equation with initial conditions

59 views
Skip to first unread message

Andrea Köcher

unread,
Jan 29, 2010, 3:09:26 PM1/29/10
to FriCAS - computer algebra system
Is it possible to solve ODEs with initial conditions like this
Mathematica command:

>DSolve[{y''[x] == y[x], y[0] == 1, y'[0] == 1}, y[x], x]

I tried the following:

>y:=operator 'y
>deq:=D(D(y x,x),x) = y(x)
>solve(deq,y,x)

and got the general solution:

>[particular= 0,basis= [%e^x ,%e^(-x) ]]

But I have no idea how to specify initial conditions. This attempt
produced an error message:

>solve([deq,y(0)=1],y,x)

Can I find somewhere a practical tutorial on solving ODEs with Axiom?

And two more general questions from an Axiom beginner:

What are the strengths and weaknesses of Axiom vs. FriCAS vs.
openAxiom? Which one is recommended for beginners?

Which of Axiom, Reduce and Maxima is most powerful as a general
purpose CAS? For our chemistry classes we were advised to use Maple to
help with exercises on quantum mechanics, but I need a free tool for
use at home.

Please help me with the first steps in CAS
Andrea

Waldek Hebisch

unread,
Jan 29, 2010, 7:48:34 PM1/29/10
to fricas...@googlegroups.com
Andrea K?cher

> Is it possible to solve ODEs with initial conditions like this
> Mathematica command:
>
> >DSolve[{y''[x] == y[x], y[0] == 1, y'[0] == 1}, y[x], x]
>
> I tried the following:
>
> >y:=operator 'y
> >deq:=D(D(y x,x),x) = y(x)
> >solve(deq,y,x)
>
> and got the general solution:
>
> >[particular= 0,basis= [%e^x ,%e^(-x) ]]
>
> But I have no idea how to specify initial conditions. This attempt
> produced an error message:
>
> >solve([deq,y(0)=1],y,x)
>

Try:

solve(deq, y, x = 0, [1, 1])

> Can I find somewhere a practical tutorial on solving ODEs with Axiom?
>

In HyperDoc go to 'Topics', then choose 'Solving Equations' and then
'Solution of Differential Equations'. Your equations appers as one
of examples in subsection 'Closed-Form Solutions of Linear Differential
Equations'.

If for some reason you can not use HyperDoc the same material is
in Chapter 8.10 of Axiom book:

http://fricas.sourceforge.net/doc/book.pdf
http://axiom-wiki.newsynthesis.org/JenksSutorInXhtml

> And two more general questions from an Axiom beginner:
>
> What are the strengths and weaknesses of Axiom vs. FriCAS vs.
> openAxiom? Which one is recommended for beginners?

Basically, FriCAS wants to best system. In past two years vast
majority of mathematical improvements and bug fixes was developed
for FriCAS (some are ported to other flavours, some not). In
particular HyperDoc help system in FriCAS works much better
than in the past. Also, FriCAS has an automatic procedure to
regenerate results of examples in documentation, so the help
system shows you almost exactly what system should produce
(some examples like random numbers produce different result on
each run). AFAIK other flavours depend on manually updating examples,
with risk of not beeing up to date.
Let me add currently all flavours, Axiom, FriCAS and openAxiom
are mostly compatible so it is possible to move code between
then with reasonable effort (and such movements do happen).
I believe that FriCAS has most additions, so I general moving
code to FriCAS should be the easiest direction (in opposite
direction one may need to move dependencies first).

I am affraid that does not anwer your question directly, but
there are few large user visible changes to FriCAS, the largest
beeing guessing package, and hundreds of small ones. IMHO
cumulative effect of small changes is significant, but it make
no sense to list them here (if you are interested look at
"What's New" in HyperDoc).

For beginners it may matter that FriCAS has strongest community.

What about weaknesses? Well, we are trying to eliminate them.
One notable thing to do (but not done) is integration of Arthur
Ralfs code which allows connection via web browser.

Also, note that deep reason for having separate systems was
that Axiom leader used quite different criteria for goodness
than what FriCAS (and I think also Open Axiom) use. So it
possible some differences for Axiom point of view are
advantages of Axion, but from FriCAS point of view are
disadvantages of Axiom. In particular, IMO Axiom
documentation efforts actually decrease quality of
documentation.

> Which of Axiom, Reduce and Maxima is most powerful as a general
> purpose CAS? For our chemistry classes we were advised to use Maple to
> help with exercises on quantum mechanics, but I need a free tool for
> use at home.

It depends on what "powerful" and "general purpose" mean. Axiom
is more general than Reduce and Maxima, more precisely has support
to do computations various algebraic structures which would
be awkward to do in Reduce or Maxima. I believe that core algorithms
in Axiom are better than what is in Reduce and Maxima. But end
user probably would ask "what built in functions can do?". Axiom
has thousends of built in functions, Reduce and Maxima probably
hundreds, it is huge task to compare them. It depends on
what you want ot compute. For me FriCAS can do more than the
other, but I have found computations that only one of them
can do. For example Reduce had trouble with many integrals
that FriCAS and Maxima can do, but Reduce has powerful package
(Redlog) for handling inequalites, much better than what Maxima
can do with inequalites (and FriCAS can do almost nothing with
inequalities). Maxima has elliptic functions, FriCAS (and IIRC
also Reduce) not. FriCAS has guessing package (AFAIK currently
better than what you can get for Maple or Mathematica, and
Reduce and Maxima have nothing similar), trianglar systems
and probably many more things that Reduce and Maxima can not
do.

--
Waldek Hebisch
heb...@math.uni.wroc.pl

Andrea Köcher

unread,
Jan 30, 2010, 12:58:29 PM1/30/10
to FriCAS - computer algebra system
Thank you, Waldek, to take the time to answer my questions very
thoroughly. I knew that asking for the "most powerful" CAS is very
subjective, but your explanations make me feel that FriCAS was the
right choice. (I only wonder what would have come out if I had asked
in a Maxima forum...)

One thought about inequalities. Not that I think I need such feature.
But does FriCAS allow to call functions of Reduce or Maxima where
Axiom is lacking algorithms? If not, does the design of the different
CAS's forbid to share code among them? Just random thoughts, I am more
of a user than a programmer. But I am wondering why there are no
attempts to combine the capabilities of *all* free CAS's into the
ultimate one.

Finally, back to my initial question. Your suggestion "solve(deq, y, x
= 0, [1, 1])" does what I need. For a better understanding, would
there also be an equivalent of

DSolve[{y''[x] == y[x], y'[0] == 1}, y[x], x],

namely fixing only one integration constant (by y'[0] == 1), but
freeing y(0)?

Or an equivalent of

DSolve[{y''[x] == y[x], , y[0] == 1, y'[1] == 1}, y[x], x] or
DSolve[{y''[x] == y[x], , y[0] == 1, y[1] == 1}, y[x], x],

namely fixing y(a) and y(b) or y'(b) at two different points? After
reading the suggested chapters I still could not find the appropriate
Axiom syntax.

Thank you for your help
Andrea

Martin Rubey

unread,
Jan 30, 2010, 1:35:43 PM1/30/10
to fricas...@googlegroups.com
Andrea Köcher <kocher...@yahoo.com> writes:

> Finally, back to my initial question. Your suggestion "solve(deq, y, x
> = 0, [1, 1])" does what I need. For a better understanding, would
> there also be an equivalent of
>
> DSolve[{y''[x] == y[x], y'[0] == 1}, y[x], x],
>
> namely fixing only one integration constant (by y'[0] == 1), but
> freeing y(0)?

just use a free variable as initial value:

solve(D(y x, x, 2) - y x + 1, y, x=0, [a, b])

> Or an equivalent of
>
> DSolve[{y''[x] == y[x], , y[0] == 1, y'[1] == 1}, y[x], x] or
> DSolve[{y''[x] == y[x], , y[0] == 1, y[1] == 1}, y[x], x],
>
> namely fixing y(a) and y(b) or y'(b) at two different points?

Hm, I don't think that's possible right now.

Which university are you from? (I'm from Hannover)

Martin

Andrea Köcher

unread,
Jan 30, 2010, 3:56:46 PM1/30/10
to FriCAS - computer algebra system
> > Or an equivalent of
>
> > DSolve[{y''[x] == y[x], , y[0] == 1, y'[1] == 1}, y[x], x] or
> > DSolve[{y''[x] == y[x], , y[0] == 1, y[1] == 1}, y[x], x],
>
> > namely fixing y(a) and y(b) or y'(b) at two different points?
>
> Hm, I don't think that's possible right now.

Hm, but I think this is exactly what we need to solve the Schrodinger
equation with boundary conditions. I will try to find a workaround by
solving the system of the general solution together with the equations
for the boundary conditions. If this is described elsewhere, please
give a reference?

>
> Which university are you from? (I'm from Hannover)

Oldenburg. Studying chemistry, not algebra.

Andrea

Reply all
Reply to author
Forward
0 new messages