bpourhamzeh

45 Reputation

6 Badges

11 years, 285 days

MaplePrimes Activity


These are questions asked by bpourhamzeh

Is there a way to loop over an entire worksheet I already have? I am too lazy to retype everything into one for loop, and I couldn't just copy and paste everything into one command thing (the space you make when you shift-enter). Is there something I can put before my worksheet that runs it, changes one variable, runs it again, etc.?

Thanks! I hope it is clear what I am asking. 

Bad title, I know. 

Suppose I have solved an ODE numerically, say for a function f(x). Now, I want to solve another ODE numerically, given by

diff(g(x),x) = f(x)*g(x)

I want to solve for g(x), and I only know f(x) from the numerical solution I obtained in the first ODE. How do I implement this in Maple?

I attached a worksheet with my naive attempt with this simple example. Basically I do not know how to set up the differential equation which I would then input to dsolve. 

ode.mw

Thanks!

I am trying to integrate solutions to a set of differential equations I have obtained numerically but keep getting this error:

Error, (in solW) invalid input: subs received sol(r), which is not valid for its 1st argument

For simplicity, let's say I am interested in integrating the function W(r), which I obtain from 

sol := dsolve({eqns, ics}, numeric, abserr = 10^(-10), relerr = 10^(-10), range = ymin .. ymax)

I then use

solW := r -> subs(sol(r), W(y))

This gives me W(r) for any r in the range ymin to ymax. But I cannot do anything with this function. For example, 

int(solW(r),r=ymin..ymax) or plot(solW(r),r=ymin..ymax) give the error above. I know that I can plot the solutions using odeplot, but is there something analogous for integrating the solutions? 

Thanks!

Hi! I was wondering if anyone knows of a way to taylor expand an expression around a function. For example, let's say I have an expression like

expression := diff(f(r), r$2) + exp(-f(r))*(1 - g(r))^2

and I want this expression to be linear order in f and g. If I try

mtaylor(expression, [f(r), g(r)], 2)

I get an error. I don't want to replace f(r) with just f (for example) because then all of the derivative terms vanish, and I want this to also be of linear order. 

Page 1 of 1