lekcha

30 Reputation

One Badge

3 years, 140 days

MaplePrimes Activity


These are questions asked by lekcha

Hi.

I have to make a picture Polynomiograph from metrics such as

m:= Matrix([[1, 2, 3], [4, 5, 6]])

By assigning each number a color as follows.

1 = aquamarine

2 = blue

3 = brown

4 = coral

5 = cyan

6 = black

How should I write the code?

I'm trying to construct an iterative procedure al1(f,x0) where f is a function, x0 is an initial estimate.

Now for example by defining f:= x-> 4*x^4-4*x^2 and inputting x0=0.75 and N=10 i should be able to check that my procedure calculates 1 correctly.

f := x -> 4*x^4 - 4*x^2;
f1 := D(f);
f2 := D(f1);
x0 := 0.75;
Digits := 100;
tol := 10.^(-15);

al1:= proc(f,x0)
local y, z, s, i, fs, a, de;
s := x0:
a[0]:=x0;
for i from 1 to 10
while abs(fs)>tol and de>tol do
y := evalf(s- f(s)/f1(s)):
s:=evalf(y-f(y)/f1(y)):
fs:=evalf(f(s)):
a[i]:=s:
de:=abs(evalf(a[i]-a[i-1])):
end do:
return n, s, fs, de;
end proc;

> n, s, fs, de := al1(f, 0.75);
Error, (in al1) cannot determine if this expression is true or false: 0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-14 < abs(fs) and 0.1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e-14 < de

 

The code i've written so far is incorrect but i'm not sure where i'm going wrong. Would you be able to give me some pointers?

 

I have

f:=a^6*o + a^5*i + a^4*u + a^3*q + a^2*t + a

and

f1:=7*a^6*p + 6*a^5*o + 5*a^4*i + 4*a^3*u + 3*a^2*q + 2*a*t + 1

I want to divide two functions f/f1 to produce a result.

a^2*t+ a^3*(-2*t^2 + 2*q)+ a^4*(4*t^3 - 7*t*q + 3*u)(-8*t^4 + 20*t^2*q - 6*q^3 - 10*t*u + 4*i)*a^5+a^6*(16*t^5 - 52*t^3*q + 33*t*q^3 + 28*t^2*u - 13*i*t - 17*u*q + 5*o)+O(a^7)

 

I have tried collect and asympt, the result is not satisfactory.

 

Page 1 of 1