15 Reputation

One Badge

1 years, 140 days

MaplePrimes Activity

These are replies submitted by naili

@Carl Love 


Yes I wasn't aware of the difference then. But thank you for your advice! I've now read into it.


That explains a lot. The results now look very differently. I'm new to Maple so I didn't really know if it was wrong, but the 2 variables in my list did put me off ^^.

But now I've read more into the differences and how to initialize it. Thank you for your time, it works now.

(Also I've finally realized the use of PolynomialInterpolation. I knew befhorehand that it was used for approximation, but visually seeing it helped.)

Thanks all of you for your advice!

Especially the zip command is going to be of use to me. It's really convenient and much easier to use than to write a procedure for it.



Wow thank you it works! Good that zip exists ^^. I tried writing a procedure with a for-loop. But that was very long and unnecessary it seems.

And thank you for showing me how it's done with sequence. I tried it before but always got an error of some sorts, because I was out of range. nops is the number of operands. Never heard of that expression before. It's certainly useful!

For my original problem I still can't seem to plot them.

> F:= (sin(sqrt(x^2+y^2)))/(sqrt(x^2+y^2));

                                                                                           sin(sqrt(x^2 + y^2))/sqrt(x^2 + y^2)

> h:= F(x, -1.8);

                                                                           sin(sqrt(x^2 + y^2))(x, -1.8)/sqrt(x(x, -1.8)^2 + y(x, -1.8)^2)

> ListeHy:= [seq(h, x = -10..10, 1.0)];                                         

> ListeHx:= [seq(x, x = -10..10, 1)];

> HxHy:= zip(`[]`,ListeHx,ListeHy);

> with(CurveFitting):
> polyInterHxHy:= PolynomialInterpolation(HxHy, x):

> with(plots):
> plotHxHy:= plot(polyInterHxHy, x = -10..10, size=[400,400]);

This is my code. The PolynomialInterpolation works. But when I try plotting it, I always get an error in plot. I actually tried to do it all again. Fresh. And I tried swapping all of your values with the one from my problem, because I thought I maybe forgot something minor. But it stops working at the same thing. (When it comes to plotting.) It's also no difference if I leave out the (plotHxHy:=) and try plot right away. Or if I change the range to variables min(ListF) ...max(ListF) or (ListHx in my case)





First of all thank you for you answer. I tried your example, but it is different for complex values, not? Because I now did this:


F:= (sin(sqrt(x^2+y^2)))/(sqrt(x^2+y^2));

H:= F(x, -1.8);

ListeH:= [seq(H, x = -10..10, 1)];

ListeHx:= [seq(x,x=-10..10)];

                                                                  // until here it works perfectly

List:= '[]'~(ListeHx,ListeH);

interpolyh:= PolynomialInterpolation(List, x);


So I want in the end to have a List:=[ [-10, H(-10)], [-9, H(-9)], .... [10, H(10)] ] like this and then use PolynomialInterpolation.

But I don't know how to combine the two ListeHx and ListeH. I tried the advice from Carl with []~(A,B), but I don't know how to implement it correctly (how this method works). Is there another way to add all the values from list one to list two like this? Maybe with a for-loop?



@Carl Love 


Thank you! Though I'm not sure if I did it correctly.

At first I left the brackets empty and then only:

FH := [[], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], [], []]

appeared (which is logical on second thought. The numbers of brackets match)

Then I tried putting in x and I think it is correct. At least all the values match, but there's an x now before every ( , ) bracket, which I think causes the following problem for me.

polyInterFH:= PolynomialInterpolation(FH,x);
Error, (in CurveFitting:-PolynomialInterpolation) data must be 2-dimensional

I wanted to do that, so afterwards I can plot the Polynomialinterpolation.

plotFH:= plot(interFH, x = -10..10, color = blue):


Is that a wrong approach?

Page 1 of 1