Rouben Rostamian

MaplePrimes Activity


These are replies submitted by Rouben Rostamian

@Simon45 you write "I need to get a tridiagonal matrix somehow". The code that you have shown is very far from being there.  You need to fundamentally reformulate the algorithm. As vv has suggested, you should read your textbook to see what needs to be done.  Try to understand the algorithm. Don't think about Maple right now.  Maple will not help you to get there.

While you are reading your textbook, pay attention to what are called explicit method and implicit method for finite differences.  (Some books may call these the forward and backward methods.)

Have the following comments in mind as you read your textbook.

  • The algorithm that you have shown implements an explicit (or forward) finite difference algorithm.  That method is only conditionally stable.  To obtain a correct solution out of it you need to make sure that the CFL stability condition is satisfied. (Read about the CFL condition in your textbook.)  In the code that you have presented the CFL condition is not satisfied, therefore even if you follow the suggestions made so far for fixing it, you will have a code that runs but produces junk!
  • Once you have taken care of satisfying the CFL condition, you will find out that the solution does not deal with tridiagonal matrices at all.  That is, you are looking at the wrong algorithm if your aim is to arrive at a tridiagonal system.
  • The tridiagonal system enters the picture when you do the time discretization through the implicit (or backward) finite differences. Study that method to see how the tridiagonal system comes into play.  By the way, you will learn that the implicit method is unconditionally stable (check your textbook) and therefore you need not worry about the CFL condition in that case.

 

@mmcdara Any function defined on an interval [0,T] may be extended periodically to the entire real line. You yourself noted this in your comment. So what's the problem with viewing the function f(t)=t^2 as periodic?

Note to the original poster: It is not clear whether you are asking for help with the mathematics of the problem, or how to solve it in Maple.

If you know how to formulate the problem mathematically, then it will be good to show that in your post so that people know that you understand what you are talking about.  Then many will be happy to show how to do it in Maple.

But if you don't know the underlying math, this is not the right place to learn it. Go back to your textbook or ask the teacher for help.

@Eric-pascal To get a sorted random vector, replace the line
X := LinearAlgebra:-RandomVector[row](n, generator=rand(100));
with
X := sort(LinearAlgebra:-RandomVector[row](n, generator=rand(100)));

tizozadoxo, it is understandable that you wish to pass your course, but having other people do the work and then handing that work to your teacher as if it were your own, is not the best approach.

At least, attempt to solve the problems yourself. If you run into difficulties, show your work here and ask for help on specific issues that you are having. But just posting the statement of a homework problem and asking for someone to solve it for you is not quite the right thing.

 

@tizozadoxo Here is a stripped down version. I can's say that it's "easy" because that depends on what you already know in mathematics and Maple.

restart;
frames := seq(plot(1/(1+e*sin(t)), t=0..2*Pi, coords=polar), e=0..2, 0.1):
plots:-display([frames], insequence, scaling=constrained, view=[-3..3, -5..2]);

I have written up a detailed analysis of the rolling of an ellipse along a straight line.  I will put it under Posts in MaplePrimes, so you may want to check it out.

I haven't looked at the question that you have asked, that is, rolling of an ellipse on anything other than a straight line, but I expect it to be significantly more complex.

You should explain:

  • Which boundary layer equations are you interested in?
  • What is the "hmp method"?
  • Why do you want to solve with the hmp method rather than by some other method?

 

@ALIKHADEMI To get a helpful answer, you need to tell exactly what it is that you have in mind. Based on the little information that you have provided, I can think of a dozen different useless answers because your question is unclear.

As it has been suggested before, it is best if you upload your maple worksheet (not a screen image) and explain what you want to do with it.

@ALIKHADEMI

The help you receive is generally proportional to the amount of information you provide.  If you state your problem more fully, you may receive a more detailed answer.

Note the big green arrow in the toolbar of the panel where you edit your message before posting. Clicking on that arrow will enable you to attach your Maple worksheet to your message.  Do that, and also explain what it is that you want to do with it because it may not be very obvious by just looking at the worksheet.

 

@ALIKHADEMI Perhaps this is what you want.  Let

f := x -> x^2;

Then to print the values of the function as x goes from 0 to 5 in steps of 1, do
seq(print(x,f(x)), x=0..5);
                                     0, 0

                                     1, 1

                                     2, 4

                                     3, 9

                                     4, 16

                                     5, 25

To print the values of f(x) as x goes from 0 to 1 in steps of 0.2, do
seq(print(x,f(x)), x=0..1, 0.2);
                                     0, 0

                                   0.2, 0.04

                                   0.4, 0.16

                                   0.6, 0.36

                                   0.8, 0.64

                                   1.0, 1.00

 

@ALIKHADEMI See if you can formulate your question clearly.  Give an example of the kind of thing you want to do.

@vv You are right in that we need some conditions on f for the integral to make sense, It is known that any f in L1(0,∞) will do. Moreover, the resulting solution u(x,t) is in C((0,∞)×(0,∞)) and satisfies the PDE in the classical sense in that open set.

@Hassan Alkomy Yes, you need to reformulate your system as you do in Matlab.

As for the explicit Euler method, as far as I know there is no Maple procedure because it's quite trivial.  A first order system looks like
dx/dt = f(t,x),  x(a)=b
where x is the vector of the unknowns.  We discretize time into intervals t[0]=a, t[1]=a+h, t[2]=a+2h, ..., and let x[0], x[1], x[2], ... be the corresponding approximate values of the solution x(t).  In the k-th interval we approximate the derivative dx/dt by the difference quotient (x[k+1] - x[k])/h, therefore the differential equation takes the form
(x[k+1] - x[k])/h = f(t[k], x[k])
that is
x[k+1] = x[k] + h*f(t[k], x[k]).

Thus, we may compute the solution at step k+1 based on the knowledge of the quantities at step k.  We start with the known quantities at step k=0, and march forward one step at a time.

If this is all new to you, you should begin with some simpler cases (with known solutions) which you can practice with.  Take, for example:
x' = x,
x(0)=1,
whose exact solution is x(t)=exp(t), and
x'' + x = 0,
x(0)=1, x'(0)=0,
whose exact solution is x(t)=cos(t).

 

I can't tell how familiar you are with numerical methods for solving ODEs, therefore the following may or may not make any sense to you.

If I were to investigate the source of the problem, I would

  1. Reformulate your system of five second order equations into a system of 10 first order equations;
  2. Apply a few steps of the explicit Euler method to the system with a small stepsize to see what the system wants to do.  If there is indeed a singularity, you will probably detect it here.

@vv That's very nice.  I had not expected such a simple and explicit inverse function for Fibonacci.

First 51 52 53 54 55 56 57 Last Page 53 of 99