Items tagged with functions functions Tagged Items Feed

Hi all

I have written the following code in maple to approximate arbitrary functions by hybrid of block-pulse and bernstein functions but it doesn't work properly especially for f(t)=1.0, so what is the matter?

bb1.mws

 


best wishes

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

I do not like to load a package using with() and then use its commands and functions, since I then lose track knowing from which package a function or command being used in the code came from when I look at the code later on. So I like to write

pkg:-f() or pkg[f]() instead of with(pkg); f()

This seems to work most of the time, except I just found a case where I am forced to do with(pkg) at the top. Here is the example. I'd like to know if there is a workaround where I can avoid with(pkg) in this case as well:

restart;
f:=t->piecewise(t<0,0,t>=0 and t<z,t,t>z,z):
r:=convert(f(t),Heaviside):
r:=inttrans[laplace](r,t,s);


Now since Maple does not know what z is, it could not fully evaluate the result above (I can handle this with assumptions, but this is just an example). So now I replaced z by 0.5, but since laplace is not loaded, it still could not do it:

r:=subs(z=0.5,r);

So now I had to load the package, just to simply the above expression:

with(inttrans);
r;

This all becuase the expression earlier was left with only "laplace" in it, and not "inttrans[laplace]" as I typed. (why this happend, I do not know).

My question is: How would you do the above, without loading the package? I really do not like loading packages as I said, and like to keep the name of the package attached to each function to help me know where each function is coming from.

 

Hello everybody,

I want to find all of roots of the complex variables functions in two ways.

(1) find the value which can make the function equals 0

(2) find the real value and imaginary value which make real part and imaginary part of function equal 0

(I know answers of these two case is not equal completely.)

 

The function is a non-linear function, including sin, cos and Bessel function, such as:

 


And, I used Analytic and fsolve to do case (1) and (2), but failure. The follow result is how I tried to find the real value answer:

 

It seems that both of two commands can only find some of roots. 

How to find all of roots of these cases? The related .mw file is attached.

Cannot_find_all_of_roots.mw

 

Thanks a lot.

 

I'm writing some code that computes a positive integer N and I'd like Maple to define a function of N variables. I've tried writing 

f := (seq(t[i],i=1..N))-> MY EXPRESSION;

but I receive the error

Error, invalid parameter; functional operators require their parameters to be of type symbol or (symbol::type)

Is there anything I can do here?

I've been using a maple package (written by another author) on earlier versions of Maple.  Recently I have been trying to rewrite it so it's a bit more Maple 16+ friendly (since I've read that Maple is not forward-compatible). However, I have been experiencing similar strange behavior in both the original and my current version: 

After saving the module to my personal library, I load with(MyPackage). Most functions work fine (all but a handful out of dozens).  However, some functions won't be recognized (e.g., Coproduct(...) will return itself Coproduct(...)).  

HOWEVER, when I execute the code in the module in its own Maple worksheet, all functions are recognized and work perfectly.  I look at the difference in the code between the functions that work upon loading the package (using with(MyPackage) command in a separate sheet) and those that don't, and there is no difference.

I'm assuming I'll just have to cut and paste the hundreds of lines of code for my package into each sheet I'd like to use it in, since I haven't been able to find others experience this problem in the knowledge base.  I'm hoping someone will be able to help out, however.

hi all.

I have wrore the following program for optimization with bernstein and block pulse hybrid functions.

the program have some errors which i can't understand.

Bernestien1.mws

restart:

alias(C=binomial):
with(LinearAlgebra):
macro(LA= LinearAlgebra):


HybrFunc:=proc(N, M,  tj)               # N=Number of subintervals,  M=Number of functions in subintervals
 
local B, n, m;

global b;

for n from 1 to N do
for m from 0 to M-1 do

B := (i,m,t) -> C(m,i)*(1-t)^(m-i)*t^i:

b[n,m]:=unapply(piecewise(t>=(n-1)*tj/N and t<n*tj/N, B(m,2,N*t-(n-1)*tj), 0), t):
 od:od:


Array(1..N, 0..M-1, (n,m)->b[n,m](t)):

#convert(%,vector);
end proc:

HybrFunc(3, 3, 1);




                                       # End Of Definition
 
g2(t):=t;            #*exp(t-1):                      # Any other function can be replaced here
    

g1(t):=add(add(c[n,m]*b[n,m](t), m=0..2), n=1..3);
Optimization[Minimize](sqrt(int((g2(t)-g1(t))^2, t=0.. 1)));
assign(op(%[2]));
plot([g2(t),g1(t)], t=0..1, 0..5, color=[blue,red],thickness=[1,3],discont, scaling=constrained);

Array(1 .. 3, 0 .. 2, {(1, 0) = piecewise(0 <= t and t < 1/3, (1-3*t)^2, 0), (1, 1) = piecewise(0 <= t and t < 1/3, (6*(1-3*t))*t, 0), (1, 2) = piecewise(0 <= t and t < 1/3, 9*t^2, 0), (2, 0) = piecewise(1/3 <= t and t < 2/3, (2-3*t)^2, 0), (2, 1) = piecewise(1/3 <= t and t < 2/3, (2*(2-3*t))*(3*t-1), 0), (2, 2) = piecewise(1/3 <= t and t < 2/3, (3*t-1)^2, 0), (3, 0) = piecewise(2/3 <= t and t < 1, (3-3*t)^2, 0), (3, 1) = piecewise(2/3 <= t and t < 1, (2*(3-3*t))*(3*t-2), 0), (3, 2) = piecewise(2/3 <= t and t < 1, (3*t-2)^2, 0)}, datatype = anything, storage = rectangular, order = Fortran_order)

g2(t) := t

"g1(t):=c[1,0] ({[[(1-3 t)^2,0<=t and t<1/3],[0,otherwise]])+c[1,1] ({[[6 (1-3 t) t,0<=t and t<1/3],[0,otherwise]])+c[1,2] ({[[9 t^2,0<=t and t<1/3],[0,otherwise]])+c[2,0] ({[[(2-3 t)^2,1/3<=t and t<2/3],[0,otherwise]])+c[2,1] ({[[2 (2-3 t) (3 t-1),1/3<=t and t<2/3],[0,otherwise]])+c[2,2] ({[[(3 t-1)^2,1/3<=t and t<2/3],[0,otherwise]])+c[3,0] ({[[(3-3 t)^2,2/3<=t and t<1],[0,otherwise]])+c[3,1] ({[[2 (3-3 t) (3 t-2),2/3<=t and t<1],[0,otherwise]])+c[3,2] ({[[(3 t-2)^2,2/3<=t and t<1],[0,otherwise]])"

Error, (in Optimization:-NLPSolve) complex value encountered

Error, invalid left hand side in assignment

(1)



Download Bernestien1.mws

 I'll be so grateful if any one can help me.

Mahmood   Dadkhah

Ph.D Candidate

Applied Mathematics Department

Can anyone help to compute the following integral in terms of the bessel functions in maple.

Hello,

I would like to solve easily this equation with maple.

When i use solve or isolate functions, i have a result with arctan function.

"sol := solve(a*cos(gamma)+b*sin(gamma)+c, gamma):
isolate(a*cos(gamma)+b*sin(gamma)+c=0,gamma); "

It is good but i would like solutions with arccos.

In other words, i would like to have these calculations :

a*cos(gamma)+b*sin(gamma)+c=0

cos(psi)=a/sqrt(a²+b²)

sin(psi)=b/sqrt(a²+b²)

thus 

cos(psi)*cos(gamma)+sin(psi)*sin(gamma)=-c/sqrt(a²+b²)

cos(psi+gamma)=-c/sqrt(a²+b²)

gamma=-psi -/+ arccos(c/sqrt(a²+b²))

Is there a possibility to lead this calculation automatically with maple? For example, is it possible to force isolate function to seek for this kind of solution.

Thanks a lot for your help

How do I plot the graph of 3 functions into one page (that is, as a series). Thank you.

Please this is urgent! I can't seem to be able to upload my job on here.

Thanks.

This is the first presentation of updates for the DE and Mathematical Functions programs of Maple 18. It includes several improvements, all in the Mathematical Functions sector, as well as some fixes. The update and instructions for its installation are available on the Maplesoft R&D webpage for DEs and mathematical functions. Some of the items below were mentioned here in Mapleprimes - you are welcome to present suggestions or issues; if possible they will be addressed right away in the next update.

  • Filling gaps in the FunctionAdvisor regarding all the 6 complex components: abs, argument, conjugate, Im, Re, signum, as well as regarding Heaviside (step function), Dirac, min and max.
  • Fix the simplification and differentation rule for doublefactorial
  • Make convert(..., hypergeometric) work the same way as convert(blabla, hypergeom)
  • Implement integral forms for Heaviside(z) and JacobiAM(z, k) via convert(..., Int)
  • Implement appropriate display for the inert %intat function as well as its conversion to the inert Int
  • Make the FunctionAdvisor/DE return not just the PDE system satisfied by f(z, k) = JacobiAM(z, k)and also (new) the ODE satisfied by f(z) = JacobiAM(z, k)
  • Fix conversion rule from Heaviside(z) to Sum
  • Fix unexpected error interruption when differentiating min(...) and max(...) containing more than three arguments
  • Fix issue in simplify/conjugate
  • Improvement in expand/int: factors in disguise are put outside the integration sign
  • Various improvements in the case of multiple integrals involving the Dirac function
  • Make Intat fully inert (before it was evaluating its arguments)
  • Make value of inert indexed objects work

Edgardo S. Cheb-Terrab
Physics, Differential Equations and Mathematical Functions, Maplesoft

Hi:
i have two functions(f(x)&g(x)),i calculated values this functions with numerical method(dsolve,numeric),
now i will plot the f(x)-g(x) for 0<x<1,how do this work?

has anybody any idea for this?  been stuck on it for a while now.

 

let f0 € V be any given function and define a sequence (fn)n€(No) of functions fn € V by 

f:= f0 and fn+1 =Af for all n € (N0)        #A could be the average of the four surrounding points to (i,j) or it could be an N x N matrix with spectral radius less than 1.  not entirely sure. I dont know what it should be but im sure one of you guys know.

prove that this sequence converges pointwise,

 i.e that for all i,j €  [N] x [N], foo(i,j) := limn-> oo fn(i,j) exists.   and that Δfoo=0 

 

it  says to be in the notation of (" http://www.mapleprimes.com/questions/201278-Fix-A-Syntax-Error-In-My-Simple-Function-please-Help")  but it doesnt matter if its not.  I can adapt to what its meant to be if I can get any way to prove it

Thanks in advance.

 

 

Hello!

I am trying to write the following function in maple:

f(P(x)) = (x-1)*P'(x)-x*P(1) 

Where P(x) = 1 + x + x^2 

 

My approach thus far has yielded limited results; i am able to get some, but not all, of the results expected.

This is my code,( the relevant bits ):

p := x-> 1+x+x^2

f:= P -> (x-1)*P'(x)-x*P(1); 

if i then type f(1); in maple i get the expected result of -x

if however i type f(x) i get an equation that is unable to produce the expected result when simplified - seemingly, it doesn't parse for maple. The expected result would be -1 

Using unapply make's no difference. Either i have made a mistake typing in my functions - in which case i would like an ëxplanation as to what i did wrong, or seemingly there is a different approach here? Perhaps solving this problem with maple is simply not doable? - anyway my line of reasoning leads me to finally ask how i write a function within a function in this nice program :) 

Any help in this matter is greatly appreciated - i only just recently started using this program. 


firstly apologies in advance for stuff in this question such as "triangle symbol",  my computer is pretty old. 


ok so i was confused a bit here, what i'm trying to do is write a maple procedure that computes Af for a given f contained in V . except we only need to correct the bug in the script below. This script demonstrates such a procedure in the case that omega is a square. The domain is given here as the negative set of a function F contained in V .  I have left in notes where/what i think we need to do but i dunno how to...

N:=10 ; # Global Var
F:=(x,y)->sgn(abs(x-N/2)+abs(y-N/2)-N/4);
Average := proc(F, f0) local f, i, j;
f := f0; # !!!!!!!!!!!!!! something is bad here...
for i to N do for j to N do
if F(i, j) < 0 then
f[i, j] := (f0[i - 1, j] + f0[i + 1, j] + f0[i, j + 1] + f0[i, j - 1])/4 ;
end if;
end do;end do;
return f;
end proc;
f0:=Matrix(N,F); # just to have something to test the procedure
Average(F,f0); # does not return the expected average, modifies f0

 

the necessary information we were given to produce this so far was..

Let N be a positive integer and [N] = {i contained in N | 1<= i <=N }  Let "Omega" C {(i,j) contained in [N] x [N] | 2<=i,j<=N-1} be a subset. Let V = R^([N]x[N]) be the vector space of real valued functions [N]x[N] -> R
and A, "triangle symbol":V->V (average) and "triangle symbole" (Laplacian) be the linear maps such that
[Af](i; j) = f(i; j)      if (i; j) not contained in "Omega"   OR

                             [f(i, j + 1) + f(i, j - 1) + f(i + 1, j) + f(i - 1, j)]/4 if (i,j) is contained in "Omega"

["traingle symbol"f](i,j) =  0 if (i,j) isnt contained in "Omega"   OR

                            ( f(i,j) - [f(i, j + 1) + f(i, j - 1) + f(i + 1, j) + f(i - 1, j)]/4 )    if (i,j) is contained in "Omega"

 Please and thank you for any help in advance <3

                           

x*(y+z)/x

convert any polynomial to Divide(Mult(x, Plus(y+z)), x)

 

1 2 3 4 5 6 7 Last Page 1 of 41