# Question:problem with an equation passed from a procedure

## Question:problem with an equation passed from a procedure

Maple

Hi

when i pass a pair of differential equations from a procedure (called expressions in the code below) to another procedure (main) I am unable to solve the equations with dsolve.

If I explicity include the equations in main I can solve it fine.

Does anyone know what I'm doing wrong?

below is the code that 1) doesnt work 2)does work

> #doesnt work
> restart:
> main:=proc()
> local eqn1,eqn2,q,eqnset:DEBUG();
>
> eqn1:=expressions(label_activated):
> eqn2:=expressions(label_resting):
>
> eqnset:={eqn1=0,eqn2=0,Asy(0)=.1,Asx(0)=.2};
> print(eqnset);
> q:=dsolve(eqnset,{Asy(t),Asx(t)},numeric);
> print(q(5));
> end:
>
> expressions:=proc(expression)
> local exp:
>
>
>
> if expression =label_activated then exp:=-diff(Asy(t),t)+(1-exp(-0.8*t))+.7;fi:
> if expression =label_resting then exp:=-diff(Asx(t),t)+Asx(t);fi:
>
>
> return(exp):
> end:

#works

>restart:
> main:=proc()
> local eqn1,eqn2,q,eqnset:DEBUG();
>
>
> eqn1:=-diff(Asy(t),t)+(1-exp(-0.8*t))+.7:
> eqn2:=-diff(Asx(t),t)+Asx(t):
>
> eqnset:={eqn1=0,eqn2=0,Asy(0)=.1,Asx(0)=.2};
> print(eqnset);
> q:=dsolve(eqnset,{Asy(t),Asx(t)},numeric);
> print(q(5));
> end:
>

thanks

﻿